Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Compiling with BoringSSL on Ubuntu fails with undefined reference to `__gxx_personality_v0' (minimal reproducible example included) #3465

@maddouri

Description

@maddouri

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 root CMakeLists.txt is dependent on LWS_WITH_SECURE_STREAMS_CPP being ON
  • The use of e.g. project(lws-minimal-ss-hello_world C) insted of project(lws-minimal-ss-hello_world) or project(lws-minimal-ss-hello_world C CXX) etc. in the CMakeLists.txt of 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:

  1. 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
  2. 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
  3. 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 someWorkDir to build without the samples or ./build_lws_with_bssl_ubuntu.ps1 someWorkDir -BuildTests to build the samples as well.

  4. When building without the samples (i.e. ./build_lws_with_bssl_ubuntu.ps1 someWorkDir), the following projects fail to compile:

    • bin/libwebsockets-test-lejp
    • bin/libwebsockets-test-client
    • bin/libwebsockets-test-server
    • bin/libwebsockets-test-server-extpoll
  5. 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-dir
    • bin/lws-api-test-gunzip
    • bin/lws-api-test-jpeg
    • bin/lws-api-test-jrpc
    • bin/lws-api-test-lejp
    • bin/lws-api-test-lhp-dlo
    • bin/lws-api-test-lhp
    • bin/lws-api-test-lws_cache
    • bin/lws-api-test-lws_map
    • bin/lws-api-test-lws_smd
    • bin/lws-api-test-lws_tokenize
    • bin/lws-api-test-lwsac
    • bin/lws-api-test-secure-streams
    • bin/lws-api-test-ssjpeg
    • bin/lws-api-test-upng
    • bin/lws-minimal-http-client-attach
    • bin/lws-minimal-http-client-captive-portal
    • bin/lws-minimal-http-client-certinfo
    • bin/lws-minimal-http-client-custom-headers
    • bin/lws-minimal-http-client-h2-rxflow
    • bin/lws-minimal-http-client-hugeurl
    • bin/lws-minimal-http-client-multi
    • bin/lws-minimal-http-client-post
    • bin/lws-minimal-http-client
    • bin/lws-minimal-http-server-basicauth
    • bin/lws-minimal-http-server-custom-headers
    • bin/lws-minimal-http-server
    • bin/lws-minimal-ss-hello_world-policy
    • bin/lws-minimal-ss-hello_world
    • bin/lws-minimal-ss-http-post
    • bin/lws-minimal-ss-server-hello_world
    • bin/lws-minimal-ss-sink-hello_world
    • bin/lws-minimal-ss-ws-echo
    • bin/lws-minimal-ws-proxy

Thank you in advance 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions