Topic: Link wolfSSL embedded SSL Statically

Hello All,

I am trying to link statically to wolfSSL without success. This is process I follow:

./configure --enable-webServer --enable-static --disable-shared --prefix=<path to external_libs> --exec-prefix=< path to external_libs > CXXFLAGS="-fPIC"
    make
    make install

This produces the files in the given prefix directory.

Then, in my makefile I link it using :

EXTERNAL_LIBS = -L../external_libs/lib/ ../external_libs/lib/libcyassl.a -lcryptopp \
    /usr/lib/libboost_serialization.so.1.49.0

When I compile my program, I get the following error:

-L../external_libs/lib/ ../external_libs/lib/libcyassl.a -lcryptopp /usr/lib/libboost_serialization.so.1.49.0
/usr/bin/ld: ../external_libs/lib/libcyassl.a(src_libcyassl_la-ssl.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
../external_libs/lib/libcyassl.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status

I am unable to figure out what is wrong as I am using the -fPIC flag. Please help.

Nitin

Share

Re: Link wolfSSL embedded SSL Statically

Hi Nitin,

Can you try adding -fPIC to C_EXTRA_FLAGS instead of CXXFLAGS when building wolfSSL?

Thanks,
Chris

Re: Link wolfSSL embedded SSL Statically

Hi Chris,

This works !!.. Thanks wink

Nitin

Share