Topic: Issue linking to libwolfssl.a

Hello,

I am trying to build a static library for wolfssl for android using the ndk standalone toolchain. I believe I have built everything correclty, however when I go to link I get errors from the library.

/usr/local/lib/libwolfssl.a(src_libwolfssl_la-dh.o):dh.c:function wc_DhGenrateKeyPair: error: undefined reference to 'pow'
/usr/local/lib/libwolfssl.a(src_libwolfssl_la-dh.o):dh.c:function wc_DhGenrateKeyPair: error: undefined reference to 'log'
/usr/local/lib/libwolfssl.a(src_libwolfssl_la-dh.o):dh.c:function wc_DhGenrateKeyPair: error: undefined reference to 'pow'

I built like this:

./configure --enable-static --host=arm-linux-androideabi CC=/opt/android-toolchain/bin/arm-linux-androideabi-clang
make
sudo make install

then in my CMakeLists.txt I have:

add_executable(wolftest server.c)
target_include_directories(wolftest PRIVATE /usr/local/include)
target_link_libraries(wolftest /usr/local/lib/libwolfssl.a)

Am I missing something?

Share

Re: Issue linking to libwolfssl.a

Hi sean00mcc,

You need to include the "-lm" for the std math library or use internal DH math using `WOLFSSL_DH_CONST`.

Thanks,
David Garske, wolfSSL

Share