Error with make on *nix
Closed this issue · 5 comments
jnewing commented
When I run make on Deb this is the error I'm getting.
ln -s -f libscrypt.so.0 libscrypt.so
cc -Wall -o reference main.o b64.o -Wl,-rpath=. -L. -lscrypt
./libscrypt.so: undefined reference to `log'
collect2: error: ld returned 1 exit status
make: *** [reference] Error 1
technion commented
Can you show us your make command and the entire output? I've just retested Raspbian and CentOS and neither of them had such an error.
The "log" function is path of the math library that should be linked to libscrypt.so.0 using -lm.
jnewing commented
I've just tested again on my ubuntu box
$ make
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o crypto_scrypt-nosse.o crypto_scrypt-nosse.c
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o sha256.o sha256.c
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o crypto_scrypt-hexconvert.o crypto_scrypt-hexconvert.c
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o crypto-mcf.o crypto-mcf.c
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o b64.o b64.c
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o crypto-scrypt-saltgen.o crypto-scrypt-saltgen.c
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o crypto_scrypt-check.o crypto_scrypt-check.c
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o crypto_scrypt-hash.o crypto_scrypt-hash.c
cc -Wl,-z,now -Wl,-z,relro -Wl,-soname,libscrypt.so.0 -Wl,--version-script=libscrypt.version -shared -o libscrypt.so.0 -lc -lm crypto_scrypt-nosse.o sha256.o crypto_scrypt-hexconvert.o crypto-mcf.o b64.o crypto-scrypt-saltgen.o crypto_scrypt-check.o crypto_scrypt-hash.o
ar rcs libscrypt.a crypto_scrypt-nosse.o sha256.o crypto_scrypt-hexconvert.o crypto-mcf.o b64.o crypto-scrypt-saltgen.o crypto_scrypt-check.o crypto_scrypt-hash.o
cc -O2 -Wall -g -D_FORTIFY_SOURCE=2 -fstack-protector -fPIC -c -o main.o main.c
ln -s -f libscrypt.so.0 libscrypt.so
cc -Wall -o reference main.o b64.o -Wl,-rpath=. -L. -lscrypt
./libscrypt.so: undefined reference to `log'
collect2: error: ld returned 1 exit status
make: *** [reference] Error 1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 13.10
Release: 13.10
Codename: saucy
technion commented
Based on what Google tells me about Ubuntu doing unusual things with flags, can you try applying this patch:
https://gist.github.com/technion/9380115
jnewing commented
Yup that fixed it!
technion commented
Thanks for the confirmation. This seems to be an Ubuntuism, more info here:
http://stackoverflow.com/questions/7824439/c-math-linker-problems-on-ubuntu-11-10
I have just committed this fix.