Library symbols can't be found
Closed this issue · 3 comments
After attempting to link the 434 and 751 libraries/add API includes to a project, the linker complains that symbols can't be found.
I can see the symbol by running strings on the library, still investigating deeper.
target_include_directories(client
PUBLIC
../deps/PQCrypto-SIDH/src
${CMAKE_BINARY_DIR}/proto)
target_link_libraries(client
PUBLIC
${PROTOBUF_LIBRARIES}
${CMAKE_BINARY_DIR}/proto/libsockproto.a
${CMAKE_BINARY_DIR}/../deps/PQCrypto-SIDH/lib434/libsidh.a)
[ 52%] Linking CXX executable client
/usr/bin/ld: CMakeFiles/client.dir/client.cc.o: in function `sockpuppet::client::exchange_keys()':
/home/jonesy/git/sockpuppet/include/sockpuppet/client.h:150: undefined reference to `random_mod_order_A_SIDHp434(unsigned char*)'
/usr/bin/ld: /home/jonesy/git/sockpuppet/include/sockpuppet/client.h:152: undefined reference to `EphemeralKeyGeneration_A_SIDHp434(unsigned char const*, unsigned char*)'
/usr/bin/ld: /home/jonesy/git/sockpuppet/include/sockpuppet/client.h:159: undefined reference to `EphemeralSecretAgreement_A_SIDHp434(unsigned char const*, unsigned char const*, unsigned char*)'
collect2: error: ld returned 1 exit status
make[2]: *** [example/CMakeFiles/client.dir/build.make:106: example/client] Error 1
make[1]: *** [CMakeFiles/Makefile2:261: example/CMakeFiles/client.dir/all] Error 2
Even manually linking is erroring.
$ g++ -std=c++20 client.cc -I../include -I../deps/PQCrypto-SIDH/src -I../build/proto -lprotobuf -L../deps/PQCrypto-SIDH/lib751comp -lsidh -L../build/proto -lsockproto -lpthread -o client
/usr/bin/ld: /tmp/ccd00KH1.o: in function `sockpuppet::client::exchange_keys()':
client.cc:(.text._ZN10sockpuppet6client13exchange_keysEv[_ZN10sockpuppet6client13exchange_keysEv]+0x29): undefined reference to `random_mod_order_A_SIDHp751(unsigned char*)'
/usr/bin/ld: client.cc:(.text._ZN10sockpuppet6client13exchange_keysEv[_ZN10sockpuppet6client13exchange_keysEv]+0x55): undefined reference to `EphemeralKeyGeneration_A_SIDHp751_Compressed(unsigned char const*, unsigned char*)'
/usr/bin/ld: client.cc:(.text._ZN10sockpuppet6client13exchange_keysEv[_ZN10sockpuppet6client13exchange_keysEv]+0xa6): undefined reference to `EphemeralSecretAgreement_A_SIDHp751_Compressed(unsigned char const*, unsigned char const*, unsigned char*)'
collect2: error: ld returned 1 exit status
Does it work if you only include one of the two options (434 or 751)? The problem might be that some symbols are redefined for each parameter set. You can look at the integration strategy in the open-quantum safe project, where all the SIKE parameter sets co-exist (see this directory).
Does it work if you only include one of the two options (434 or 751)? The problem might be that some symbols are redefined for each parameter set. You can look at the integration strategy in the open-quantum safe project, where all the SIKE parameter sets co-exist (see this directory).
Unfortunately not, I had tried them individually. I'll poke around and see if I come out with found symbols.
Holy moly, I had no Idea this library existed. Thank you.