(09-16-2018, 06:52 AM)gijoe77 Wrote: so question 1: how do these library flags work? do I need to do something special for "-lgmp" or "-lnettle" to somehow now work? They are clearly not part of MIPSPro, is this some sort of gcc-ism? If they are in my lib path are they somehow now recognized?
I think this got already answered before, but anyway:
-l and -L are flags destined for the linker, ld.
-l specifies the name of a library to include in the linking
-L specifies a directory to be searched for libraries
Example:
ld object.o -labc -o executable_name
Would search for a library named libabc.so or libabc.a in the standard library paths (/lib, /usr/lib, /lib32, /usr/lib32, and so on).
If you had this library in a nonstandard path, say /home/gijoe77/libabc.so, how can the linker find it? Using -L to specify *additional* library paths to be searched:
ld object.o -L/home/gijoe77 -labc -o executable_name
Some important points to note here:
-L directs the linker to search *first* in this path, and then in the standard paths. Therefore, it is always inclusive.
-l and -L order is important:
ld ... -L/home/gijoe77 -labc ... (search libabc.so first in /home/gijoe77 and then in standard paths)
ld ... -labc -L/home/gijoe77 ... (search libabc.so first in standard paths and then prepend /home/gijoe77 to standard paths for further searches)
(09-16-2018, 06:52 AM)gijoe77 Wrote: Why am I doing this? I wanted to compile wget, but it said it wanted gnutls, gnutls wants nettle, nettle wants gmp. so here I am.
(09-16-2018, 06:52 AM)gijoe77 Wrote: question 2. when doing the "gmake check" for nettle, I get:
Code:
gmake[1]: Entering directory `/usr/people/develop/dev/nettle/nettle-3.4/testsuite'
/usr/bin/cc -c99 -g0 -woff all -O2 -mips4 -L.. pss-mgf1-test.o testutils.o ../nettle-internal.o -lnettle -o pss-mgf1-test
ld32: ERROR 33 : Unresolved text symbol "nettle_pss_mgf1" -- 1st referenced by pss-mgf1-test.o.
Use linker option -v to see when and which objects, archives and dsos are loaded.
ld32: INFO 152: Output file removed because of error.
gmake[1]: *** [pss-mgf1-test] Error 2
Okay, so the object pss-mgf1-test.o needs a symbol named nettle_pss_mgf1 (variable or function) and the linker doesn't find it.
It could be a programming error that makes this unnecessary symbol be included *or* it really is needed by that object file but missing in the linker command line.
I would do a search for all possible object files *.o in the build dir, display their symbols and grep those with the needed symbol defined:
# find . -name '*.o' -exec nm \{\} \; -print > find.out
# grep -n nettle_pss_mgf1 find.out
What you are looking for are entries with defined symbols:
1234: nettle_pss_mgf1 | 0000000000000000 | T | 0000000000000008
(T stands for Text section - this symbol would be defined in the Text section of the corresponding object file)
It could also be D (D stands for Data section) if the symbol you are looking for is a variable:
1234: nettle_myvar | 0000000000000000 | D | 0000000000000008
In either case, discard entries where this symbol is undefined (U stands for Undefined):
666: nettle_pss_mgf1 | 0000000000000000 | U | 0000000000000008
Once you have found an entry with a defined symbol, open find.out in a text editor, go to the corresponding line (1234 in my example) and look for the object file name where this symbol is defined. Now include that file in the link command line.
If this doesn't work, tell me and we might find another way.
Good luck!