BoringSSL shared library?

544 views
Skip to first unread message

Lorenzo Miniero

unread,
Jan 22, 2015, 10:49:50 AM1/22/15
to discuss...@googlegroups.com
I know this might not be strictly webrtc related, but since BoringSSL is the fork Google is pushing to handle DTLS I thought I'd look into it as an alternative for our WebRTC gateway. Unfortunately, so far I haven't been able to build a shared version of the libraries. Did anyone succeed? If so, any hint on what I may be doing wrong?

I changed the STATIC in crypto/CMakeLists.txt and ssl/CMakeLists.txt to SHARED and I added the -DBORINGSSL_SHARED_LIBRARY definition to the already existing -DBORINGSSL_IMPLEMENTATION, as suggested in the BUILDING doc. I also had to remove the -Wshadow flag as it gave a warning on my compiler which caused an error (all warnings are treated as errors). Everything seems to go fine until it's time to link:

Linking C shared library libcrypto.so
/usr/bin/ld: sha/CMakeFiles/sha.dir/sha1-x86_64.S.o: relocation R_X86_64_PC32 against symbol `OPENSSL_ia32cap_P' can not be used when making a shared object; recompile with -fPIC
 
I already tried setting the -fPIC in several different ways as suggested, but that didn't solve it. When inspecting with readelf, I get this, so this might be a different issue:

readelf --relocs crypto/sha/CMakeFiles/sha.dir/sha1-x86_64.S.o

Relocation section '.rela.text' at offset 0x2370 contains 3 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000003  000800000002 R_X86_64_PC32     0000000000000000 OPENSSL_ia32cap_P - 4
00000000000a  000800000002 R_X86_64_PC32     0000000000000000 OPENSSL_ia32cap_P + 0
000000000011  000800000002 R_X86_64_PC32     0000000000000000 OPENSSL_ia32cap_P + 4

Any clue?

Thanks,
Lorenzo

globalik slivov

unread,
Mar 11, 2018, 1:36:05 PM3/11/18
to discuss-webrtc
cmake -DCMAKE_CXX_FLAGS="-lrt" -DBUILD_SHARED_LIBS=1

Then by using the lib in header file define BORINGSSL_SHARED_LIBRARY

Reply all
Reply to author
Forward
0 new messages