open-quantum-safe / liboqs

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

Trouble building on Mac #1921

Closed maoudia-via closed 2 months ago

maoudia-via commented 2 months ago

Following the steps documented in the README, I tried to build on Mac

Darwin xxxxxx 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112 x86_64

I am seeing build errors such as :

: && /Library/Developer/CommandLineTools/usr/bin/cc -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  tests/CMakeFiles/example_kem.dir/example_kem.c.o -o tests/example_kem  lib/liboqs.a  lib/liboqs-internal.a  -lm  /opt/homebrew/opt/openssl@3/lib/libcrypto.dylib && :
ld: warning: ignoring file '/opt/homebrew/Cellar/openssl@3/3.3.2/lib/libcrypto.3.dylib': found architecture 'arm64', required architecture 'x86_64'
Undefined symbols for architecture x86_64:
  "_ERR_print_errors_fp", referenced from:
      _SHA2_sha256_inc_init in liboqs.a[1605](sha2_ossl.c.o)
      _SHA2_sha256_inc_ctx_clone in liboqs.a[1605](sha2_ossl.c.o)
      _SHA2_sha256_inc in liboqs.a[1605](sha2_ossl.c.o)
      _SHA2_sha256_inc_blocks in liboqs.a[1605](sha2_ossl.c.o)
      _SHA2_sha256_inc_finalize in liboqs.a[1605](sha2_ossl.c.o)
      _SHA2_sha384_inc_init in liboqs.a[1605](sha2_ossl.c.o)
      _SHA2_sha384_inc_ctx_clone in liboqs.a[1605](sha2_ossl.c.o)

OPENSSL_ROOT_DIR is set to /opt/homebrew/opt/openssl@3.3

Is there anything I am missing for a successful build ?

Thanks !

SWilson4 commented 2 months ago

I'm not a Mac expert, but it looks to me like your version of OpenSSL targets arm64 and you're running an x86_64 machine (or possibly vice versa).

dstebila commented 2 months ago

Yes, if I'm not mistaken on arm64 Mac's Homebrew is installed in /opt/homebrew, whereas on x86_64 Mac's it's in /usr/local, so this seems to indicate your building on arm64. Did you use some specific command line arguments mentioning x86_64?

dstebila commented 2 months ago

Closing due to lack of follow-up. Please re-open if you need to.