Agustin Lobo @ on
Problem with tephra2 compilation on linux
After downloading and uncompressing tephra2_r145.tar.gz, I navigate to the src directory (where the Makefile is located) $ cd /media/alobo/Iomega_HDD/VOLCAN/erupcion/tephra2-r145/src and run
$ make but get: make1: Entering directory `/media/alobo/Iomega_HDD/VOLCAN/erupcion/tephra2-r145/src/tephra2’ gcc -Wall -O3 -o tephra2 new_tephra.o tephra_calc.o -lgc -lm /usr/bin/ld: cannot find -lgc collect2: error: ld returned 1 exit status
I thought that perhaps -lgc is a typo (it should be -lgcc ?) thus I went to tephra2/makefile and changed: $(CC) $(CFLAGS) $(LIB) -o tephra2 new_tephra.o tephra_calc.o -lgc -lm to become $(CC) $(CFLAGS) $(LIB) -o tephra2 new_tephra.o tephra_calc.o -lgcc -lm
Then rerun make and, while this problem is solved, I get:
make1: Entering directory `/media/alobo/Iomega_HDD/VOLCAN/erupcion/tephra2-r145/src/tephra2’ gcc -Wall -O3 -I../include -c new_tephra.c new_tephra.c: In function ‘get_points’: new_tephra.c:366:10: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result -Wunused-result gcc -I../include -c tephra_calc.c gcc -Wall -O3 -o tephra2 new_tephra.o tephra_calc.o -lgcc -lm new_tephra.o: In function `get_eruptions’: new_tephra.c:(.text+0×74): undefined reference to `GC_malloc’ new_tephra.o: In function `get_points’: new_tephra.c:(.text+0×1c2): undefined reference to `GC_malloc’ new_tephra.o: In function `get_wind’: new_tephra.c:(.text+0×3a5): undefined reference to `GC_malloc’ new_tephra.c:(.text+0×3f8): undefined reference to `GC_malloc’ tephra_calc.o: In function `set_eruption_values’: tephra_calc.c:(.text+0×1333): undefined reference to `GC_malloc’ tephra_calc.o:tephra_calc.c:(.text+0×13c0): more undefined references to `GC_malloc’ follow tephra_calc.o: In function `set_eruption_values’: tephra_calc.c:(.text+0×145c): undefined reference to `GC_realloc’ tephra_calc.c:(.text+0×1509): undefined reference to `GC_realloc’ collect2: error: ld returned 1 exit status
I’m really clueless, any help?
Thanks
Agus
0 Like 0 Dislike
Sebastien Biass @ on
Did you manage to find a solution? If not, could you print a cleaner error message and I will try to help…
Reply Report abuse
Please login to answer the question.
0 Like 0 Dislike
Nicolas Mostert @ on
I know I'm probably many years late, but I'm posting this in case someone else runs into this problem.
"-lgc" is not a typo, it tells the "ld" command to look for the "libgc.so" package on your system.
If you run the command
"ld -lgc --verbose"
you should get ouput like this:
attempt to open //usr/local/lib/x86_64-linux-gnu/libgc.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libgc.a failed
attempt to open //lib/x86_64-linux-gnu/libgc.so failed
attempt to open //lib/x86_64-linux-gnu/libgc.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libgc.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libgc.a failed
attempt to open //usr/local/lib64/libgc.so failed
attempt to open //usr/local/lib64/libgc.a failed
attempt to open //lib64/libgc.so failed
attempt to open //lib64/libgc.a failed
attempt to open //usr/lib64/libgc.so failed
attempt to open //usr/lib64/libgc.a failed
attempt to open //usr/local/lib/libgc.so failed
attempt to open //usr/local/lib/libgc.a failed
attempt to open //lib/libgc.so failed
attempt to open //lib/libgc.a failed
attempt to open //usr/lib/libgc.so failed
attempt to open //usr/lib/libgc.a failed
attempt to open //usr/x86_64-linux-gnu/lib64/libgc.so failed
attempt to open //usr/x86_64-linux-gnu/lib64/libgc.a failed
attempt to open //usr/x86_64-linux-gnu/lib/libgc.so failed
attempt to open //usr/x86_64-linux-gnu/lib/libgc.a failed
ld: cannot find -lgc
This shows you where "ld" is looking for the package.
In order to find the package on your machine, run the command
"locate -i libgc.so"
Which should show you the actual path to the file.
In order for "ld" to find the file, make a symbolic link from the actual file to a location in which "ld" is looking:
"sudo ln -s /actual/path/to/libgc.so /usr/lib/libgc.so"
Which would enable "ld" to find it. This should enable you to build without problems.
Reply Report abuse
Please login to answer the question.