-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
I'm trying to build a static version of libwebsockets 4.4.1 using
- A static build of BoringSSL 0.20250818.0 as the TLS lib
- MSVC 2022 x64 on Windows 11 64bit as the compiler
- CMake as the meta build system
A minimal reproducible example in the form of a PowerShell script that executes the whole build process, from downloading the sources to launching the actual build commands can be found at the end of this post.
Despite successfully building the BoringSSL library and filling in the proper CMake cache variables, I get the following compilation errors when building libwebsockets:
...\workdir7\boringssl-install\include\openssl\x509.h(1335,1): error C2059: syntax error: '<parameter-list>' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-fds.c')
...\workdir7\boringssl-install\include\openssl\x509.h(1335,1): error C2143: syntax error: missing ')' before '(' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-fds.c')
...\workdir7\boringssl-install\include\openssl\x509.h(1335,1): error C2059: syntax error: ')' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-fds.c')
...\workdir7\boringssl-install\include\openssl\x509.h(1335,1): error C2143: syntax error: missing ')' before 'constant' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-fds.c')
...\workdir7\boringssl-install\include\openssl\x509.h(1335,1): error C2091: function returns function [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-fds.c')
...\workdir7\boringssl-install\include\openssl\x509.h(1335,1): error C2143: syntax error: missing '{' before 'constant' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-fds.c')
...\workdir7\boringssl-install\include\openssl\x509.h(1335,1): error C2059: syntax error: 'constant' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-fds.c')
...\workdir7\boringssl-install\include\openssl\x509.h(1335,1): error C1003: error count exceeds 100; stopping compilation [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-fds.c')
...\workdir7\boringssl-install\include\openssl\base.h(293,29): error C2059: syntax error: '<parameter-list>' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-file.c')
...\workdir7\boringssl-install\include\openssl\pkcs7.h(123,14): error C2059: syntax error: '<parameter-list>' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-file.c')
...\workdir7\boringssl-install\include\openssl\x509.h(138,16): error C2059: syntax error: '<parameter-list>' [...\workdir7\libwebsockets-build\lib\websockets.vcxproj]
(compiling source file '../../libwebsockets-src/lib/plat/windows/windows-file.c')
Could you please advise on how to solve these issues?
Thank you for developing this cool minimal-dependency libwebsockets lib and, in advance, for having a look at this issue 🙂
PS: As mentioned above, the following PowerShell script contains the whole build process, from downloading the sources to launching the actual build commands if you'd like to reproduce the issue on your end (please make sure to have nasm, go, cmake 3.x and git on your machine).
# .\build_lws_with_bssl.ps1
# Prerequisite Tools Can Be Passed In As Command-Line Arguments ####################################
param (
[Parameter(Mandatory = $true)]
[string] $WorkDir, # Work directory, will be created then used for downloading and building the sources
[Parameter(Mandatory = $true)]
[string] $NasmExe, # The nasm.exe binary name if it's in your PATH. Otherwise, fill in the full path to the nasm.exe binary
[Parameter(Mandatory = $true)]
[string] $GoExe, # The go.exe binary name if it's in your PATH. Otherwise, fill in the full path to the go.exe binary
[Parameter(Mandatory = $true)]
[string] $CMakeExe, # The cmake.exe binary name if it's in your PATH. Otherwise, fill in the full path to the cmake.exe binary
[Parameter(Mandatory = $true)]
[string] $GitExe # The git.exe binary name if it's in your PATH. Otherwise, fill in the full path to the git.exe binary
)
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") {
throw "WorkDir [$WorkDir] already exists. Either remove it, remove this check or specify a new WorkDir"
}
#$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
#$WorkDir = Join-Path "$scriptDir" "WorkDir"
New-Item -ItemType Directory -Path "$WorkDir"
$WorkDir = $WorkDir | Resolve-Path
Write-Host "WorkDir: $WorkDir"
# BoringSSL ########################################################################################
$bsslSrcDir = (Join-Path "$WorkDir" "boringssl-src") -replace "\\","/"
$bsslBuildDir = (Join-Path "$WorkDir" "boringssl-build") -replace "\\","/"
$bsslInstallDir = (Join-Path "$WorkDir" "boringssl-install") -replace "\\","/"
& "$GitExe" clone --depth 1 --branch "0.20250818.0" "https://boringssl.googlesource.com/boringssl" "$bsslSrcDir"
& "$CMakeExe" -G"Visual Studio 17 2022" -Ax64 `
"-S$bsslSrcDir" `
"-B$bsslBuildDir" `
"-DCMAKE_INSTALL_PREFIX=$bsslInstallDir" `
"-DCMAKE_BUILD_TYPE=Release" `
"-DCMAKE_ASM_NASM_COMPILER=$NasmExe" `
"-DGO_EXECUTABLE=$GoExe" `
"-DBUILD_TESTING=OFF"
& "$CMakeExe" --build "$bsslBuildDir" --config Release --target install
# LWS ##############################################################################################
$lwsSrcDir = (Join-Path "$WorkDir" "libwebsockets-src") -replace "\\","/"
$lwsBuildDir = (Join-Path "$WorkDir" "libwebsockets-build") -replace "\\","/"
$lwsInstallDir = (Join-Path "$WorkDir" "libwebsockets-install") -replace "\\","/"
& "$GitExe" clone --depth 1 --branch "v4.4.1" "https://github.com/warmcat/libwebsockets.git" "$lwsSrcDir"
& "$CMakeExe" -G"Visual Studio 17 2022" -Ax64 `
"-S$lwsSrcDir" `
"-B$lwsBuildDir" `
"-DCMAKE_INSTALL_PREFIX=$lwsInstallDir" `
"-DCMAKE_BUILD_TYPE=Release" `
"-DLWS_WITH_BORINGSSL=ON" `
"-DOPENSSL_ROOT_DIR=$bsslInstallDir" `
"-DOPENSSL_INCLUDE_DIRS=$bsslInstallDir/include" `
"-DOPENSSL_LIBRARIES=$bsslInstallDir/lib/ssl.lib;$bsslInstallDir/lib/crypto.lib" `
"-DLWS_WITH_MINIMAL_EXAMPLES=OFF" `
"-DBUILD_TESTING=OFF" `
"-DLWS_STATIC_PIC=ON" `
"-DLWS_WITHOUT_CLIENT=OFF" `
"-DLWS_WITHOUT_SERVER=OFF" `
"-DLWS_WITH_HTTP2=ON" `
"-DLWS_WITH_SECURE_STREAMS=ON" `
"-DLWS_WITH_SECURE_STREAMS_CPP=OFF" `
"-DLWS_WITH_STATIC=ON"
& "$CMakeExe" --build "$lwsBuildDir" --config Release --target install