Skip to content

Commit baa279b

Browse files
authored
fix(Native AOT): link to static lzma on Linux/MUSL (#4326)
1 parent 663c95a commit baa279b

File tree

6 files changed

+22
-10
lines changed

6 files changed

+22
-10
lines changed

.github/actions/environment/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ runs:
1414
# Android SDK Tools are arm64-incompatible
1515
# Android SDK Build Tools are musl-incompatible
1616
- name: Set Environment Variables for Alpine Linux
17-
if: ${{ (runner.os == 'Linux' && runner.arch == 'ARM64') || contains(matrix.container, 'alpine') }}
17+
if: ${{ (runner.os == 'Linux' && runner.arch == 'ARM64') || contains(matrix.container.image, 'alpine') }}
1818
shell: bash
1919
run: echo "NO_MOBILE=true" >> $GITHUB_ENV
2020

21+
# Allow sudoless Docker in integration tests
22+
- name: Prepare Docker on Alpine Linux
23+
if: ${{ contains(matrix.container.image, 'alpine') }}
24+
shell: bash
25+
run: sudo chmod 666 /var/run/docker.sock
26+
2127
# zstd is needed for cross OS actions/cache but missing from windows-11-arm
2228
# https://github.com/actions/partner-runner-images/issues/99
2329
- name: Install zstd on Windows ARM64

.github/alpine/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apk update
88
RUN apk add bash build-base cmake curl git icu lsb-release-minimal sudo tar wget
99

1010
# sentry-native
11-
RUN apk add curl-dev libunwind-dev libunwind-static linux-headers openssl-dev zlib-dev xz-dev
11+
RUN apk add curl-dev docker-cli libunwind-dev libunwind-static linux-headers openssl-dev zlib-dev xz-dev xz-static
1212

1313
# sentry-dotnet
1414
RUN apk add grpc-plugins openjdk11 powershell

.github/workflows/alpine.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Build Alpine Linux Docker image
33
on:
44
workflow_dispatch:
55
push:
6+
branches:
7+
- main
68
paths:
79
- '.github/alpine/*'
810

.github/workflows/build.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ on:
1111

1212
jobs:
1313
build-sentry-native:
14-
name: sentry-native (${{ matrix.container || matrix.os }})
14+
name: sentry-native (${{ matrix.container.image || matrix.os }})
1515
runs-on: ${{ matrix.os }}
16-
container: ${{ matrix.container }}
16+
container: ${{ matrix.container.image }}
1717
strategy:
1818
fail-fast: false
1919
matrix:
@@ -23,7 +23,8 @@ jobs:
2323
target: Linux-arm64
2424
- os: ubuntu-latest
2525
target: Linux-musl
26-
container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
26+
container:
27+
image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
2728
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
2829
- os: windows-latest
2930
- os: windows-11-arm
@@ -59,7 +60,7 @@ jobs:
5960

6061
build:
6162
needs: build-sentry-native
62-
name: .NET (${{ matrix.container || matrix.os }})
63+
name: .NET (${{ matrix.container.image || matrix.os }})
6364
runs-on: ${{ matrix.os }}
6465
container: ${{ matrix.container }}
6566

@@ -73,7 +74,10 @@ jobs:
7374
target: Linux-arm64
7475
- os: ubuntu-latest
7576
target: Linux-musl
76-
container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
77+
container:
78+
image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
79+
volumes:
80+
- /var/run/docker.sock:/var/run/docker.sock
7781
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
7882
- os: windows-latest
7983
- os: windows-11-arm

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
- Custom ISentryEventProcessors are now run for native iOS events ([#4318](https://github.com/getsentry/sentry-dotnet/pull/4318))
1616
- Crontab validation when capturing checkins ([#4314](https://github.com/getsentry/sentry-dotnet/pull/4314))
17+
- Native AOT: link to static `lzma` on Linux/MUSL ([#4326](https://github.com/getsentry/sentry-dotnet/pull/4326))
1718

1819
### Dependencies
1920

src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@
4747

4848
<ItemGroup Condition="'$(FrameworkSupportsNative)' == 'true' and '$(RuntimeIdentifier)' == 'linux-musl-x64'">
4949
<DirectPInvoke Include="sentry-native" />
50-
<!-- When musl is detected, static sentry-native links to static libunwind -->
51-
<LinkerArg Include="-Wl,-Bstatic -Wl,--whole-archive -lunwind -Wl,--no-whole-archive -Wl,-Bdynamic" />
52-
<NativeSystemLibrary Include="lzma" />
50+
<!-- When musl is detected, static sentry-native links to static libunwind, which depends on liblzma -->
51+
<LinkerArg Include="-Wl,-Bstatic -Wl,--whole-archive -lunwind -Wl,--no-whole-archive -llzma -Wl,-Bdynamic" />
5352
<NativeLibrary Include="$(MSBuildThisFileDirectory)..\sentry-native\linux-musl-x64\libsentry-native.a" />
5453
</ItemGroup>
5554

0 commit comments

Comments
 (0)