1

I am building the webrtc library for Android, using the following configuration:

gn gen out/Release-arm64 -args='target_os="android" target_cpu="arm64" use_custom_libcxx=false use_custom_libcxx_for_host=false is_debug=false is_component_build=false rtc_include_tests=false symbol_level=0 rtc_enable_symbol_export=false rtc_build_examples=false treat_warnings_as_errors=false rtc_build_ssl=false rtc_ssl_root="/usr/local/src/openssl-1.1.1k/include"'

but am getting the following errors:

FAILED: libjingle_peerconnection_so.so libjingle_peerconnection_so.so.TOC lib.unstripped/libjingle_peerconnection_so.so 
python3 "../../build/toolchain/gcc_solink_wrapper.py" --readelf="../../third_party/llvm-build/Release+Asserts/bin/llvm-readelf" --nm="../../third_party/llvm-build/Release+Asserts/bin/llvm-nm" --strip=../../third_party/llvm-build/Release+Asserts/bin/llvm-strip  --sofile="./lib.unstripped/libjingle_peerconnection_so.so" --tocfile="./libjingle_peerconnection_so.so.TOC" --output="./libjingle_peerconnection_so.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libjingle_peerconnection_so.so" -lEGL -Wl,--build-id -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,max-page-size=4096 -Wl,--icf=all -Wl,--color-diagnostics -Wl,--no-rosegment -Wl,--no-call-graph-profile-sort -Wl,--exclude-libs=libvpx_assembly_arm.a --unwindlib=none --target=aarch64-linux-android21 -Wl,-mllvm,-enable-machine-outliner=never -no-canonical-prefixes -Wl,--warn-shared-textrel -Wl,-O2 -Wl,--gc-sections --sysroot=../../third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Wl,--warn-shared-textrel -Wl,-z,defs -Wl,--as-needed -Wl,--version-script=../../build/android/android_only_jni_exports.lst -Wl,--dynamic-linker,/system/bin/linker64 -o "./lib.unstripped/libjingle_peerconnection_so.so" @"./libjingle_peerconnection_so.so.rsp" 
ld.lld: error: undefined symbol: SSL_ctrl
>>> referenced by openssl_adapter.cc
>>>               rtc_base/openssl_adapter.o:(rtc::OpenSSLAdapter::BeginSSL()) in archive obj/rtc_base/librtc_base.a
>>> referenced by openssl_adapter.cc
>>>               rtc_base/openssl_adapter.o:(rtc::OpenSSLAdapter::BeginSSL()) in archive obj/rtc_base/librtc_base.a
>>> referenced by openssl_adapter.cc
>>>               rtc_base/openssl_adapter.o:(rtc::OpenSSLAdapter::BeginSSL()) in archive obj/rtc_base/librtc_base.a
>>> referenced 5 more times

ld.lld: error: undefined symbol: SSL_CTX_ctrl
>>> referenced by openssl_adapter.cc
>>>               rtc_base/openssl_adapter.o:(rtc::OpenSSLAdapter::CreateContext(rtc::SSLMode, bool)) in archive obj/rtc_base/librtc_base.a
>>> referenced by openssl_adapter.cc
>>>               rtc_base/openssl_adapter.o:(rtc::OpenSSLAdapter::CreateContext(rtc::SSLMode, bool)) in archive obj/rtc_base/librtc_base.a
>>> referenced by openssl_stream_adapter.cc
>>>               rtc_base/openssl_stream_adapter.o:(rtc::OpenSSLStreamAdapter::SetupSSLContext()) in archive obj/rtc_base/librtc_base.a
>>> referenced 3 more times
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Interestingly enough, when I use the default boringssl in webrtc (which builds fine), I get these same link errors when building my app (I'm using a websockets lib that makes the same ssl calls).

Any feedback is appreciated.

jas
  • 63
  • 4
  • Turns out that Google got rid of the SSL_xxx_ctrl functions for boringssl and turned the macros that used those into concrete functions. Not sure exactly why I was getting the link errors when building webrtc with openssl, but I was able to fix my issue of building my app with boringsll by using the actual openssl headers from the webrtc code base, such that the calls don't map to the macros. – jas Jan 29 '22 at 13:25

0 Answers0