Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken build on Alpine #4264

Merged
merged 7 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .azure/obtemplates/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ jobs:
target: ubuntu_2004_x86_64
${{ else }}:
target: ubuntu_2204_x86_64
xdp: true
inputs:
pwsh: true
filePath: scripts/build.ps1
arguments: -Tls ${{ parameters.tls }} -Config ${{ parameters.config }} -Platform ${{ parameters.platform }} -Arch x64 -CI -UseSystemOpenSSLCrypto -OneBranch -OfficialRelease
arguments: -Tls ${{ parameters.tls }} -Config ${{ parameters.config }} -Platform ${{ parameters.platform }} -EnableLinuxXDP ${{ xdp }} -Arch x64 -CI -UseSystemOpenSSLCrypto -OneBranch -OfficialRelease
- task: PowerShell@2
displayName: arm64
${{ if eq(parameters.tls, 'openssl') }}:
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ elseif (APPLE)
set(CX_PLATFORM "darwin")
elseif (UNIX)
set(CX_PLATFORM "linux")
file(STRINGS "/etc/lsb-release" LSB_RELEASE_CONTENT)
string(REGEX MATCH "DISTRIB_RELEASE=([0-9]+\\.[0-9]+)" _ ${LSB_RELEASE_CONTENT})
set(UBUNTU_VERSION ${CMAKE_MATCH_1})
endif()
message(STATUS "QUIC Platform: ${CX_PLATFORM}")

Expand All @@ -93,6 +90,7 @@ option(QUIC_STATIC_LINK_PARTIAL_CRT "Statically links the compiler-specific port
option(QUIC_UWP_BUILD "Build for UWP" OFF)
option(QUIC_GAMECORE_BUILD "Build for GameCore" OFF)
option(QUIC_PGO "Enables profile guided optimizations" OFF)
option(QUIC_LINUX_XDP_ENABLED "Enables XDP support" OFF)
option(QUIC_SOURCE_LINK "Enables source linking on MSVC" ON)
option(QUIC_EMBED_GIT_HASH "Embed git commit hash in the binary" ON)
option(QUIC_PDBALTPATH "Enable PDBALTPATH setting on MSVC" ON)
Expand Down
15 changes: 15 additions & 0 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ This script provides helpers for building msquic.
.PARAMETER PGO
Builds msquic with profile guided optimization support (Windows-only).

.PARAMETER EnableLinuxXDP
Enables XDP support (Linux-only).

.PARAMETER Generator
Specifies a specific cmake generator (Only supported on unix)

Expand Down Expand Up @@ -166,6 +169,9 @@ param (
[Parameter(Mandatory = $false)]
[switch]$PGO = $false,

[Parameter(Mandatory = $false)]
[switch]$EnableLinuxXDP = $false,

[Parameter(Mandatory = $false)]
[string]$Generator = "",

Expand Down Expand Up @@ -265,6 +271,12 @@ if ($Arch -eq "arm64ec") {
}
}

if ($IsLinux -And $Arch -ne "x64") {
if ($EnableLinuxXDP) {
Write-Error "Linux XDP is supported only on x64 platforms"
}
}

if ($Platform -eq "ios" -and !$Static) {
$Static = $true
Write-Host "iOS can only be built as static"
Expand Down Expand Up @@ -457,6 +469,9 @@ function CMake-Generate {
if ($PGO) {
$Arguments += " -DQUIC_PGO=on"
}
if ($EnableLinuxXDP) {
$Arguments += " -DQUIC_LINUX_XDP_ENABLED=on"
}
if ($Platform -eq "uwp") {
$Arguments += " -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DQUIC_UWP_BUILD=on"
}
Expand Down
3 changes: 1 addition & 2 deletions scripts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ fn main() {
config
.define("QUIC_ENABLE_LOGGING", logging_enabled)
.define("QUIC_TLS", "openssl")
.define("QUIC_OUTPUT_DIR", "../lib")
.define("QUIC_CARGO_BUILD", "on");
.define("QUIC_OUTPUT_DIR", "../lib");

match target.as_str() {
"x86_64-apple-darwin" => config
Expand Down
17 changes: 5 additions & 12 deletions src/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,13 @@ if("${CX_PLATFORM}" STREQUAL "windows")
set(SOURCES ${SOURCES} datapath_raw.c datapath_raw_win.c datapath_raw_socket.c datapath_raw_socket_win.c datapath_raw_xdp_win.c)
endif()
else()
set(LINUX_XDP_ENABLED FALSE)
set(SOURCES ${SOURCES} inline.c platform_posix.c storage_posix.c cgroup.c datapath_unix.c)
if(CX_PLATFORM STREQUAL "linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(SOURCES ${SOURCES} datapath_linux.c datapath_epoll.c)
if ((${UBUNTU_VERSION} STREQUAL "20.04") OR
(${CMAKE_TARGET_ARCHITECTURE} STREQUAL "arm64") OR
(${CMAKE_TARGET_ARCHITECTURE} STREQUAL "arm") OR
(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm") OR
(ANDROID) OR
(QUIC_CARGO_BUILD))
set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw_dummy.c)
else()
set(LINUX_XDP_ENABLED TRUE)
if (QUIC_LINUX_XDP_ENABLED)
set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw.c datapath_raw_linux.c datapath_raw_socket.c datapath_raw_socket_linux.c datapath_raw_xdp_linux.c)
else()
set(SOURCES ${SOURCES} datapath_xplat.c datapath_raw_dummy.c)
endif()
else()
set(SOURCES ${SOURCES} datapath_kqueue.c)
Expand Down Expand Up @@ -68,7 +61,7 @@ if("${CX_PLATFORM}" STREQUAL "windows")
PUBLIC
wbemuuid)
target_link_libraries(platform PUBLIC winmm)
elseif(LINUX_XDP_ENABLED)
elseif(QUIC_LINUX_XDP_ENABLED)
find_library(NL_LIB nl-3)
find_library(NL_ROUTE_LIB nl-route-3)
find_library(XDP_LIB libxdp.so)
Expand Down Expand Up @@ -118,7 +111,7 @@ if ("${CX_PLATFORM}" STREQUAL "windows")
PRIVATE
${EXTRA_PLATFORM_INCLUDE_DIRECTORIES}
${PROJECT_SOURCE_DIR}/submodules/xdp-for-windows/published/external)
elseif(LINUX_XDP_ENABLED)
elseif(QUIC_LINUX_XDP_ENABLED)
include_directories(/usr/include/libnl3)
target_include_directories(platform PRIVATE ${EXTRA_PLATFORM_INCLUDE_DIRECTORIES})
endif()
Expand Down
Loading