Compiling with BoringSSL on Ubuntu fails with undefined reference to `__gxx_personality_v0' (minimal reproducible example included)
Compiling libwebsockets on Ubuntu 24.04 x64 with BoringSSL and LWS_WITH_SECURE_STREAMS_CPP=OFF fails with the following errors:
...
[207/316] Linking C executable bin/lws-minimal-ss-hello_world
FAILED: bin/lws-minimal-ss-hello_world
: && /usr/bin/cc -Wno-deprecated-declarations -Wno-deprecated -Wall -Wextra -Wno-unused-parameter -Wconversion -Wsign-compare -Wstrict-aliasing -fvisibility=hidden -Wundef -Wuninitialized -Wtype-limits -Wignored-qualifiers -Werror -pthread -g minimal-examples/client/hello_world/CMakeFiles/lws-minimal-ss-hello_world.dir/main.c.o minimal-examples/client/hello_world/CMakeFiles/lws-minimal-ss-hello_world.dir/hello_world-ss.c.o -o bin/lws-minimal-ss-hello_world -lpthread -lm -ldl lib/libwebsockets.a -lpthread -lm -ldl /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a /path/to/my/workdir/boringssl-install-Debug/lib/libcrypto.a -lpthread && :
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_asn1.cc.o):(.data.rel.local.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_cert.cc.o): in function `std::unique_ptr<ssl_credential_st, bssl::internal::Deleter>* std::__do_uninit_copy<std::move_iterator<std::unique_ptr<ssl_credential_st, bssl::internal::Deleter>*>, std::unique_ptr<ssl_credential_st, bssl::internal::Deleter>*>(std::move_iterator<std::unique_ptr<ssl_credential_st, bssl::internal::Deleter>*>, std::move_iterator<std::unique_ptr<ssl_credential_st, bssl::internal::Deleter>*>, std::unique_ptr<ssl_credential_st, bssl::internal::Deleter>*)':
/usr/include/c++/13/bits/stl_uninitialized.h:123:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrI17ssl_credential_stN4bssl8internal7DeleterEEES7_ET0_T_SA_S9_[_ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrI17ssl_credential_stN4bssl8internal7DeleterEEES7_ET0_T_SA_S9_]+0x7f): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: /usr/include/c++/13/bits/stl_uninitialized.h:126:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrI17ssl_credential_stN4bssl8internal7DeleterEEES7_ET0_T_SA_S9_[_ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrI17ssl_credential_stN4bssl8internal7DeleterEEES7_ET0_T_SA_S9_]+0x97): undefined reference to `__cxa_rethrow'
/usr/bin/ld: /usr/include/c++/13/bits/stl_uninitialized.h:123:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrI17ssl_credential_stN4bssl8internal7DeleterEEES7_ET0_T_SA_S9_[_ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrI17ssl_credential_stN4bssl8internal7DeleterEEES7_ET0_T_SA_S9_]+0xa3): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_credential.cc.o): in function `std::exception::exception()':
/usr/include/c++/13/bits/exception.h:62:(.text._ZNSt9exceptionC2Ev[_ZNSt9exceptionC5Ev]+0xf): undefined reference to `vtable for std::exception'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_credential.cc.o): in function `std::bad_optional_access::~bad_optional_access()':
/usr/include/c++/13/optional:102:(.text._ZNSt19bad_optional_accessD2Ev[_ZNSt19bad_optional_accessD5Ev]+0x2a): undefined reference to `std::exception::~exception()'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_credential.cc.o): in function `std::bad_optional_access::~bad_optional_access()':
/usr/include/c++/13/optional:102:(.text._ZNSt19bad_optional_accessD0Ev[_ZNSt19bad_optional_accessD5Ev]+0x29): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_credential.cc.o): in function `std::__throw_bad_optional_access()':
/usr/include/c++/13/optional:111:(.text._ZSt27__throw_bad_optional_accessv[_ZSt27__throw_bad_optional_accessv]+0x13): undefined reference to `__cxa_allocate_exception'
/usr/bin/ld: /usr/include/c++/13/optional:111:(.text._ZSt27__throw_bad_optional_accessv[_ZSt27__throw_bad_optional_accessv]+0x41): undefined reference to `__cxa_throw'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_credential.cc.o):(.data.rel.ro._ZTISt19bad_optional_access[_ZTISt19bad_optional_access]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_credential.cc.o):(.data.rel.ro._ZTISt19bad_optional_access[_ZTISt19bad_optional_access]+0x10): undefined reference to `typeinfo for std::exception'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o): in function `bssl::(anonymous namespace)::ECKeyShare::~ECKeyShare()':
/path/to/my/workdir/boringssl-src/ssl/ssl_key_share.cc:42:(.text+0x3057): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o): in function `bssl::(anonymous namespace)::X25519KeyShare::~X25519KeyShare()':
/path/to/my/workdir/boringssl-src/ssl/ssl_key_share.cc:139:(.text+0x313d): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o): in function `bssl::(anonymous namespace)::X25519Kyber768KeyShare::~X25519Kyber768KeyShare()':
/path/to/my/workdir/boringssl-src/ssl/ssl_key_share.cc:196:(.text+0x3223): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o): in function `bssl::(anonymous namespace)::X25519MLKEM768KeyShare::~X25519MLKEM768KeyShare()':
/path/to/my/workdir/boringssl-src/ssl/ssl_key_share.cc:285:(.text+0x3309): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o): in function `bssl::(anonymous namespace)::MLKEM1024KeyShare::~MLKEM1024KeyShare()':
/path/to/my/workdir/boringssl-src/ssl/ssl_key_share.cc:378:(.text+0x33ef): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o):/path/to/my/workdir/boringssl-src/ssl/internal.h:906: more undefined references to `operator delete(void*, unsigned long)' follow
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o):(.data.rel.ro+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o):(.data.rel.ro+0x18): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o):(.data.rel.ro+0x30): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o):(.data.rel.ro+0x48): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o):(.data.rel.ro+0x60): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_key_share.cc.o):(.data.rel.ro._ZTIN4bssl11SSLKeyShareE[_ZTIN4bssl11SSLKeyShareE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_lib.cc.o): in function `bssl::ALPSConfig* std::__do_uninit_copy<std::move_iterator<bssl::ALPSConfig*>, bssl::ALPSConfig*>(std::move_iterator<bssl::ALPSConfig*>, std::move_iterator<bssl::ALPSConfig*>, bssl::ALPSConfig*)':
/usr/include/c++/13/bits/stl_uninitialized.h:123:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl10ALPSConfigEES3_ET0_T_S6_S5_[_ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl10ALPSConfigEES3_ET0_T_S6_S5_]+0x7f): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: /usr/include/c++/13/bits/stl_uninitialized.h:126:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl10ALPSConfigEES3_ET0_T_S6_S5_[_ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl10ALPSConfigEES3_ET0_T_S6_S5_]+0x97): undefined reference to `__cxa_rethrow'
/usr/bin/ld: /usr/include/c++/13/bits/stl_uninitialized.h:123:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl10ALPSConfigEES3_ET0_T_S6_S5_[_ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl10ALPSConfigEES3_ET0_T_S6_S5_]+0xa3): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_lib.cc.o): in function `bssl::CertCompressionAlg* std::__do_uninit_copy<std::move_iterator<bssl::CertCompressionAlg*>, bssl::CertCompressionAlg*>(std::move_iterator<bssl::CertCompressionAlg*>, std::move_iterator<bssl::CertCompressionAlg*>, bssl::CertCompressionAlg*)':
/usr/include/c++/13/bits/stl_uninitialized.h:123:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl18CertCompressionAlgEES3_ET0_T_S6_S5_[_ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl18CertCompressionAlgEES3_ET0_T_S6_S5_]+0x7f): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: /usr/include/c++/13/bits/stl_uninitialized.h:126:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl18CertCompressionAlgEES3_ET0_T_S6_S5_[_ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl18CertCompressionAlgEES3_ET0_T_S6_S5_]+0x97): undefined reference to `__cxa_rethrow'
/usr/bin/ld: /usr/include/c++/13/bits/stl_uninitialized.h:123:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl18CertCompressionAlgEES3_ET0_T_S6_S5_[_ZSt16__do_uninit_copyISt13move_iteratorIPN4bssl18CertCompressionAlgEES3_ET0_T_S6_S5_]+0xa3): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o): in function `bssl::(anonymous namespace)::NullRecordNumberEncrypter::~NullRecordNumberEncrypter()':
/path/to/my/workdir/boringssl-src/ssl/tls13_enc.cc:299:(.text+0x44f7): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o): in function `bssl::(anonymous namespace)::AES128RecordNumberEncrypter::~AES128RecordNumberEncrypter()':
/path/to/my/workdir/boringssl-src/ssl/tls13_enc.cc:256:(.text+0x45dd): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o): in function `bssl::(anonymous namespace)::AES256RecordNumberEncrypter::~AES256RecordNumberEncrypter()':
/path/to/my/workdir/boringssl-src/ssl/tls13_enc.cc:261:(.text+0x46c3): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o): in function `bssl::(anonymous namespace)::ChaChaRecordNumberEncrypter::~ChaChaRecordNumberEncrypter()':
/path/to/my/workdir/boringssl-src/ssl/tls13_enc.cc:266:(.text+0x47a9): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o): in function `bssl::RecordNumberEncrypter::~RecordNumberEncrypter()':
/path/to/my/workdir/boringssl-src/ssl/internal.h:726:(.text._ZN4bssl21RecordNumberEncrypterD0Ev[_ZN4bssl21RecordNumberEncrypterD5Ev]+0x29): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o):(.data.rel.ro+0x38): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o):(.data.rel.ro+0x50): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o):(.data.rel.ro+0x68): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o):(.data.rel.ro+0x80): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o):(.data.rel.ro+0x98): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(tls13_enc.cc.o):(.data.rel.ro._ZTIN4bssl21RecordNumberEncrypterE[_ZTIN4bssl21RecordNumberEncrypterE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(encrypted_client_hello.cc.o): in function `std::unique_ptr<bssl::ECHServerConfig, bssl::internal::Deleter>* std::__do_uninit_copy<std::move_iterator<std::unique_ptr<bssl::ECHServerConfig, bssl::internal::Deleter>*>, std::unique_ptr<bssl::ECHServerConfig, bssl::internal::Deleter>*>(std::move_iterator<std::unique_ptr<bssl::ECHServerConfig, bssl::internal::Deleter>*>, std::move_iterator<std::unique_ptr<bssl::ECHServerConfig, bssl::internal::Deleter>*>, std::unique_ptr<bssl::ECHServerConfig, bssl::internal::Deleter>*)':
/usr/include/c++/13/bits/stl_uninitialized.h:123:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrIN4bssl15ECHServerConfigENS2_8internal7DeleterEEES7_ET0_T_SA_S9_[_ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrIN4bssl15ECHServerConfigENS2_8internal7DeleterEEES7_ET0_T_SA_S9_]+0x7f): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: /usr/include/c++/13/bits/stl_uninitialized.h:126:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrIN4bssl15ECHServerConfigENS2_8internal7DeleterEEES7_ET0_T_SA_S9_[_ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrIN4bssl15ECHServerConfigENS2_8internal7DeleterEEES7_ET0_T_SA_S9_]+0x97): undefined reference to `__cxa_rethrow'
/usr/bin/ld: /usr/include/c++/13/bits/stl_uninitialized.h:123:(.text._ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrIN4bssl15ECHServerConfigENS2_8internal7DeleterEEES7_ET0_T_SA_S9_[_ZSt16__do_uninit_copyISt13move_iteratorIPSt10unique_ptrIN4bssl15ECHServerConfigENS2_8internal7DeleterEEES7_ET0_T_SA_S9_]+0xa3): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(s3_both.cc.o): in function `bssl::(anonymous namespace)::AesHwCipherScorer::~AesHwCipherScorer()':
/path/to/my/workdir/boringssl-src/ssl/s3_both.cc:569:(.text+0x264f): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(s3_both.cc.o): in function `bssl::(anonymous namespace)::CNsaCipherScorer::~CNsaCipherScorer()':
/path/to/my/workdir/boringssl-src/ssl/s3_both.cc:586:(.text+0x26ad): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(s3_both.cc.o): in function `std::__sv_check(unsigned long, unsigned long, char const*)':
/usr/include/c++/13/string_view:73:(.text._ZSt10__sv_checkmmPKc[_ZSt10__sv_checkmmPKc]+0x41): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(s3_both.cc.o):(.data.rel.ro+0x28): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(s3_both.cc.o):(.data.rel.ro+0x40): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(s3_both.cc.o):(.data.rel.ro+0x58): undefined reference to `vtable for __cxxabiv1::__class_type_info'
collect2: error: ld returned 1 exit status
[208/316] Linking C executable bin/lws-minimal-ss-hello_world-policy
FAILED: bin/lws-minimal-ss-hello_world-policy
: && /usr/bin/cc -Wno-deprecated-declarations -Wno-deprecated -Wall -Wextra -Wno-unused-parameter -Wconversion -Wsign-compare -Wstrict-aliasing -fvisibility=hidden -Wundef -Wuninitialized -Wtype-limits -Wignored-qualifiers -Werror -pthread -g minimal-examples/client/hello_world-policy/CMakeFiles/lws-minimal-ss-hello_world-policy.dir/main.c.o minimal-examples/client/hello_world-policy/CMakeFiles/lws-minimal-ss-hello_world-policy.dir/hello_world-ss.c.o -o bin/lws-minimal-ss-hello_world-policy -lpthread -lm -ldl lib/libwebsockets.a -lpthread -lm -ldl /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a /path/to/my/workdir/boringssl-install-Debug/lib/libcrypto.a -lpthread && :
...
The log as well as a few online sources seem to suggest that linking with -lstdc++ is missing, which is probably expected given that gcc (not g++) is being used.
I suppose that most, if not all, of that C++ code it is coming from BoringSSL.
Regarding the use of a C compiler instead of a C++ compiler, I think that it might be related to a combination of the following:
- The use of
enable_language(CXX)in the rootCMakeLists.txtis dependent onLWS_WITH_SECURE_STREAMS_CPPbeingON - The use of e.g.
project(lws-minimal-ss-hello_world C)insted ofproject(lws-minimal-ss-hello_world)orproject(lws-minimal-ss-hello_world C CXX)etc. in theCMakeLists.txtof the examples that don't compile.
Interestingly, if we set LWS_WITH_SECURE_STREAMS_CPP=ON then everything compiles without any problem.
Compilation seems to fail only if LWS_WITH_SECURE_STREAMS_CPP=OFF.
Could you please have a look into fixing this issue?
For reference:
-
My setup is the following:
- libwebsockets @
main(0835bdf3cf29f6afea24d3c9faac7b3828bc895f) - BoringSSL @
0.20250818.0 - GCC 13.3.0
- Ubuntu 24.04 x64
- CMake 3.28.3
- Ninja 1.11.1
- PowerShell 7.5.3 for Linux
- libwebsockets @
-
I use the following PowerShell script on Ubuntu 24.04 to build everything (notably, it shows the exact list of CMake variables that I set for libwebsockets and BoringSSL):
# build_lws_with_bssl_ubuntu.ps1 param ( [Parameter(Mandatory = $true)] [string] $WorkDir, [string] $BuildType = "Debug", [string] $GoExe = "/path/to/go-1.25.1/bin/go", [string] $OpensslExe = "openssl", [string] $CMakeExe = "cmake", [string] $GitExe = "git", [string] $LwsRev = "main", [string] $BsslRev = "0.20250818.0", [switch] $BuildTests, [switch] $ReuseWorkDir ) $ErrorActionPreference = "Stop" if ($PSVersionTable.PSVersion -lt [version]"7.5") { throw "This script requires PowerShell >= v7.5. Remove this test if you want to try on PowerShell 5" } if ((Test-Path "$WorkDir") -and (-not $ReuseWorkDir)) { throw "WorkDir [$WorkDir] already exists. Either add [-ReuseWorkDir], remove the existing WorkDir, remove this check or specify a new WorkDir" } $CMakeBuildTests = if ($BuildTests) {"ON"} else {"OFF"} # Work Directory ############################################################################### if (-not (Test-Path "$WorkDir")) { New-Item -ItemType Directory -Path "$WorkDir" } $WorkDir = $WorkDir | Resolve-Path Write-Host "WorkDir: $WorkDir" # BoringSSL #################################################################################### $bsslSrcDir = (Join-Path "$WorkDir" "boringssl-src") -replace "\\","/" & "$GitExe" clone --depth 1 "--revision=$BsslRev" "https://boringssl.googlesource.com/boringssl" "$bsslSrcDir" $bsslBuildDir = (Join-Path "$WorkDir" "boringssl-build-$BuildType") -replace "\\","/" $bsslInstallDir = (Join-Path "$WorkDir" "boringssl-install-$BuildType") -replace "\\","/" & "$CMakeExe" ` "-GNinja" ` "-S$bsslSrcDir" ` "-B$bsslBuildDir" ` "-DCMAKE_INSTALL_PREFIX=$bsslInstallDir" ` "-DCMAKE_BUILD_TYPE=$BuildType" ` "-DGO_EXECUTABLE=$GoExe" ` "-DBUILD_TESTING=$CMakeBuildTests" ` "-DBUILD_SHARED_LIBS=OFF" ` "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" & "$CMakeExe" --build "$bsslBuildDir" --config "$BuildType" --target "install" --parallel # LWS ########################################################################################## $lwsSrcDir = (Join-Path "$WorkDir" "libwebsockets-src") -replace "\\","/" & "$GitExe" clone --depth 1 "--revision=$LwsRev" "https://github.com/warmcat/libwebsockets.git" "$lwsSrcDir" $lwsBuildDir = (Join-Path "$WorkDir" "libwebsockets-build-$BuildType") -replace "\\","/" $lwsInstallDir = (Join-Path "$WorkDir" "libwebsockets-install-$BuildType") -replace "\\","/" & "$CMakeExe" ` "-GNinja" ` "-S$lwsSrcDir" ` "-B$lwsBuildDir" ` "-DCMAKE_INSTALL_PREFIX=$lwsInstallDir" ` "-DCMAKE_BUILD_TYPE=$BuildType" ` "-DOPENSSL_EXECUTABLE=$OpensslExe" ` "-DLWS_WITH_SSL=ON" ` "-DLWS_WITH_BORINGSSL=ON" ` "-DOPENSSL_ROOT_DIR=$bsslInstallDir" ` "-DOPENSSL_INCLUDE_DIRS=$bsslInstallDir/include" ` "-DOPENSSL_LIBRARIES=$bsslInstallDir/lib/libssl.a;$bsslInstallDir/lib/libcrypto.a" ` "-DLWS_WITH_MINIMAL_EXAMPLES=$CMakeBuildTests" ` "-DBUILD_TESTING=$CMakeBuildTests" ` "-DLWS_WITHOUT_CLIENT=OFF" ` "-DLWS_WITHOUT_SERVER=OFF" ` "-DLWS_WITH_HTTP2=ON" ` "-DLWS_IPV6=ON" ` "-DLWS_ROLE_WS=ON" ` "-DLWS_ROLE_MQTT=OFF" ` "-DLWS_WITH_SECURE_STREAMS=ON" ` "-DLWS_WITH_SECURE_STREAMS_CPP=OFF" ` "-DLWS_WITH_SHARED=OFF" ` "-DLWS_WITH_STATIC=ON" ` "-DLWS_STATIC_PIC=ON" ` "-DCMAKE_POSITION_INDEPENDENT_CODE=ON" & "$CMakeExe" --build "$lwsBuildDir" --config "$BuildType" --target "install" --parallel -
To reproduce the issue, you should make sure to have the prerequisite tools (see the
params of the script) then run./build_lws_with_bssl_ubuntu.ps1 someWorkDirto build without the samples or./build_lws_with_bssl_ubuntu.ps1 someWorkDir -BuildTeststo build the samples as well. -
When building without the samples (i.e.
./build_lws_with_bssl_ubuntu.ps1 someWorkDir), the following projects fail to compile:bin/libwebsockets-test-lejpbin/libwebsockets-test-clientbin/libwebsockets-test-serverbin/libwebsockets-test-server-extpoll
-
When building without the samples (i.e.
./build_lws_with_bssl_ubuntu.ps1 someWorkDir -BuildTests), the following projects fail to compile:bin/lws-api-test-dirbin/lws-api-test-gunzipbin/lws-api-test-jpegbin/lws-api-test-jrpcbin/lws-api-test-lejpbin/lws-api-test-lhp-dlobin/lws-api-test-lhpbin/lws-api-test-lws_cachebin/lws-api-test-lws_mapbin/lws-api-test-lws_smdbin/lws-api-test-lws_tokenizebin/lws-api-test-lwsacbin/lws-api-test-secure-streamsbin/lws-api-test-ssjpegbin/lws-api-test-upngbin/lws-minimal-http-client-attachbin/lws-minimal-http-client-captive-portalbin/lws-minimal-http-client-certinfobin/lws-minimal-http-client-custom-headersbin/lws-minimal-http-client-h2-rxflowbin/lws-minimal-http-client-hugeurlbin/lws-minimal-http-client-multibin/lws-minimal-http-client-postbin/lws-minimal-http-clientbin/lws-minimal-http-server-basicauthbin/lws-minimal-http-server-custom-headersbin/lws-minimal-http-serverbin/lws-minimal-ss-hello_world-policybin/lws-minimal-ss-hello_worldbin/lws-minimal-ss-http-postbin/lws-minimal-ss-server-hello_worldbin/lws-minimal-ss-sink-hello_worldbin/lws-minimal-ss-ws-echobin/lws-minimal-ws-proxy
Thank you in advance 🙂
Hm. It seems when you tried to build boringssl, a load of C++ junk came out of the toolchain.
That's not good, but... what has that got to do with me?
-
I can build and test main libwebsockets + boringssl (on aarch64 rocky, using boringssl from May 2025 randomly) just fine. Look at, eg, https://libwebsockets.org/sai/index.html?task=9DEFC7098BE6090E3BE4DCF920F3B62A3E7C911FF7FEC0F7B571D0C44F9FA43D
-
Nobody pays me to be the "boringssl integration helper of last resort". I don't think a spew of C++ problems you pasted is indicating any issue in (C) lws.
-
Google themselves don't care if you want to use boringssl, they say it's just for their internal use and if it breaks, too bad for you. (Google are slightly better-funded than I am... do you know for some years Libwebsockets is part of Android AOSP shipped by Google?)
Although BoringSSL is an open source project, it is not intended for general use, as OpenSSL is. We don't recommend that third parties depend upon it. Doing so is likely to be frustrating because there are no guarantees of API or ABI stability.
https://boringssl.googlesource.com/boringssl/
- Despite that lws does build against boringssl (and other openssl derivatives) and I will try to accept patches that help that.
To clarify: the build errors are not coming from BoringSSL itself but from libwebsockets' build when BoringSSL is enabled. Because BoringSSL introduces C++ symbols, linking fails if CMake hasn’t enabled C++ support and -lstdc++. With LWS_WITH_SECURE_STREAMS_CPP=ON, C++ is enabled and the build succeeds; with it OFF, the build is treated as C-only and fails.
I also tried enabling CXX manually, but that alone didn’t fix it -- suggesting that some configuration tied to LWS_WITH_SECURE_STREAMS_CPP is required for a successful build.
Since libwebsockets documents BoringSSL as a supported option, this mismatch seems to fall within the scope of the libwebsockets project rather than BoringSSL.
These are all errors coming from the boringssl bits
/usr/bin/ld: /path/to/my/workdir/boringssl-install-Debug/lib/libssl.a(ssl_asn1.cc.o):(.data.rel.local.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0): undefined reference to `__gxx_personality_v0'
Since libwebsockets documents BoringSSL as a supported option, this mismatch seems to fall within the scope of the libwebsockets project rather than BoringSSL.
lws already build and works fine with boringssl in Sai, that's as far as it goes. It may feel there's a project but there is just one guy not being paid, and he politely declines to spend his day for free on strange C++ build problems he doesn't have.