Skip to content

Dockerize building sentry-native for Linux #2114

@bitsandfoxes

Description

@bitsandfoxes

Problem

Github no longer supports Ubuntu 20.04 runners, causing us to not be able to release without potentially breaking user's builds when running their game/server on older Ubuntu versions.

Context

We're currently building sentry-native as part of our CI (and package & release process).
For Linux, we've pinned the runner version to Ubuntu 20.04 which is no longer supported. We were building on the oldest available version to maintain compatibility.

- target: Linux
# Build using older Linux version to preserve sdk compatibility with old GLIBC
# See discussion in https://github.com/getsentry/sentry-unity/issues/1730 for more details
host: ubuntu-20.04

We're already fixing and installing additional Linux dependencies as part of the build pipeline.

The actual building happens from within a MSBuild target

<Target Name="BuildLinuxSDK" Condition="'$(MSBuildProjectName)' == 'Sentry.Unity'
And $([MSBuild]::IsOsPlatform('Linux'))
And !Exists('$(SentryLinuxArtifactsDestination)libsentry.so')" BeforeTargets="BeforeBuild">
<Error Condition="!Exists('$(SentryNativeRoot)')" Text="Couldn't find the Native root at $(SentryNativeRoot)."></Error>
<Message Importance="High" Text="Building artifacts of Sentry Native SDK for Linux." />
<Exec WorkingDirectory="$(SentryNativeRoot)" Command="cmake -B build -D SENTRY_BACKEND=breakpad -D SENTRY_SDK_NAME=sentry.native.unity -D CMAKE_BUILD_TYPE=RelWithDebInfo -S ." />
<Exec WorkingDirectory="$(SentryNativeRoot)" Command="cmake --build build --target sentry --parallel" />
<MakeDir Directories="$(SentryLinuxArtifactsDestination)"/>
<!-- strip all, including exported symbols except those starting with 'sentry_', except for 'sentry__' -->
<Exec WorkingDirectory="$(SentryNativeRoot)" Command="strip -s build/libsentry.so -w -K sentry_[^_]* -o $(SentryLinuxArtifactsDestination)libsentry.so" />
<Exec WorkingDirectory="$(SentryNativeRoot)" Command="cp build/libsentry.so $(SentryLinuxArtifactsDestination)libsentry.dbg.so" />
<Exec WorkingDirectory="$(SentryLinuxArtifactsDestination)" Command="objcopy --add-gnu-debuglink=libsentry.dbg.so libsentry.so" />
</Target>

Possible Solutions

Dockerize the build process for sentry-native on Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions