open-quantum-safe / liboqs

C library for prototyping and experimenting with quantum-resistant cryptography
https://openquantumsafe.org/
Other
1.87k stars 459 forks source link

Link error for MacOS 10.14.5 #571

Closed saholmes closed 4 years ago

saholmes commented 4 years ago

While attempting to build the code: autoreconf -i ./configure make clean make -j

During make-j

..... libtool: link: gcc -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o .libs/liboqs.0.dylib -Wl,-force_load,src/common/.libs/libcommon.a -Wl,-force_load,src/crypto/aes/.libs/libaes.a -Wl,-force_load,src/crypto/sha2/.libs/libsha2.a -Wl,-force_load,src/crypto/sha3/.libs/libsha3.a -Wl,-force_load,src/kem/.libs/libkem.a -Wl,-force_load,src/sig/.libs/libsig.a -Wl,-force_load,src/sig/picnic/.libs/libpicnic_i.a -Wl,-force_load,src/sig/qtesla/.libs/libqtesla.a -Wl,-force_load,src/kem/bike/.libs/libkembike.a -Wl,-force_load,src/kem/kyber/.libs/libkemkyber.a -Wl,-force_load,src/kem/newhope/.libs/libkemnewhope.a -Wl,-force_load,src/kem/ntru/.libs/libkemntru.a -Wl,-force_load,src/kem/saber/.libs/libkemsaber.a -Wl,-force_load,src/sig/dilithium/.libs/libsigdilithium.a -Wl,-force_load,src/sig/mqdss/.libs/libsigmqdss.a -Wl,-force_load,src/sig/sphincs/.libs/libsigsphincs.a -Wl,-force_load,src/kem/frodokem/.libs/libkemfrodokem.a -Wl,-force_load,src/kem/sike/.libs/libkemsike.a -L/usr/local/opt/opencv@2/lib -L/usr/local/opt/openssl@1.1/lib -lcrypto -g -O3 -g -O2 -mmmx -mpopcnt -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mbmi -maes -install_name /usr/local/lib/liboqs.0.dylib -compatibility_version 1 -current_version 1.0 -Wl,-single_module ld: illegal text reloc in 'oqs_sig_qteslapi_poly_ntt_asm' to 'oqs_sig_qteslapi_PARAM_QINVx4' for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [liboqs.la] Error 1 make[1]: [all-recursive] Error 1 make: *** [all] Error 2

vsoftco commented 4 years ago

@saholmes cannot reproduce on macOS 10.15.1 (using appleclang/clang/gcc). Can you please specify the exact compiler version you used?

saholmes commented 4 years ago

Libtool and gcc versions:

Works fine on ubuntu on AWS... but want to work on my MacBook for development...

libtool -V Apple Inc. version cctools-927.0.2

gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

vsoftco commented 4 years ago

@saholmes can you try with autoreconf -i && ./configure --with-pic --with-openssl=/path/to/openssl && make

saholmes commented 4 years ago

Hi, tried but still fails... openssl is installed and path is correct.

Think it is related to error message:

ld: illegal text reloc in 'oqs_sig_qteslapi_poly_ntt_asm' to 'oqs_sig_qteslapi_PARAM_QINVx4' for architecture x86_64

baentsch commented 4 years ago

@vsoftco @saholmes: I can confirm the very same error message now also hit me on OSX (Catalina): libtool -V Apple Inc. version cctools-949.0.1 liboqs mib$ gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 11.0.0 (clang-1100.0.33.12) Target: x86_64-apple-darwin19.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

--> Temporary work-around: use configure option --disable-sig-qtesla -- not ideal, though as I want to test with qtesla.... --> Better solution would be very welcome (I'm not an asm-crack, sorry)!

saholmes commented 4 years ago

Thanks, workaround works but of course without qTesla.

christianpaquin commented 4 years ago

@saholmes, @baentsch, does PR #582 solves your issue?

dstebila commented 4 years ago

Closing since we've moved to CMake (#556) so build and linking are completely different. Please re-open if you encounter the problem again with the CMake build.

saholmes commented 4 years ago

Build works for me on Mac book. Thanks