0

I'm trying to access functions from the crypto libray such as:
ge_frombytes_vartime(ge_p3 *h, const unsigned char *s)
ge_p3_to_p2(ge_p2 *r, const ge_p3 *p)
both in crypto-ops.c

I've added the crypto lib to the CMakeList:

target_link_libraries(wallet
  PUBLIC
    multisig
    common
    cryptonote_core
    mnemonics
    cncrypto <-- This one
    ${LMDB_LIBRARY}
    ${Boost_CHRONO_LIBRARY}
    ${Boost_SERIALIZATION_LIBRARY}
    ${Boost_FILESYSTEM_LIBRARY}
    ${Boost_SYSTEM_LIBRARY}
    ${Boost_THREAD_LIBRARY}
    ${Boost_REGEX_LIBRARY}
  PRIVATE
    ${EXTRA_LIBRARIES})

and I get the following error from the linker:

 98%] Linking CXX executable ../../bin/monero-wallet-cli
../wallet/libwallet.so: undefined reference to `ge_frombytes_vartime(ge_p3*, unsigned char const*)'
../wallet/libwallet.so: undefined reference to `ge_p3_to_p2(ge_p2*, ge_p3 const*)'
collect2: error: ld returned 1 exit status
src/simplewallet/CMakeFiles/simplewallet.dir/build.make:122: recipe for target 'bin/monero-wallet-cli' failed
make[3]: *** [bin/monero-wallet-cli] Error 1
CMakeFiles/Makefile2:2688: recipe for target 'src/simplewallet/CMakeFiles/simplewallet.dir/all' failed
make[2]: *** [src/simplewallet/CMakeFiles/simplewallet.dir/all] Error 2
CMakeFiles/Makefile2:2700: recipe for target 'src/simplewallet/CMakeFiles/simplewallet.dir/rule' failed
make[1]: *** [src/simplewallet/CMakeFiles/simplewallet.dir/rule] Error 2
Makefile:812: recipe for target 'simplewallet' failed
make: *** [simplewallet] Error 2

I can't figure out where the problem is coming from

2

You are probably linking them in as C++. Lookup the different in linkage between C and C++, and/or copy how Monero already does, ie:

extern "C"
{
#include "c_header.h"
}

Alternatively, rctOps.h has a convenience layer above these if performance isn't critical.

  • Could you elaborate on the difference between C and C++ linkage? or send me a link – joshuag Oct 8 '18 at 10:28
  • 1
    I added an example. – user36303 Oct 8 '18 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.