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

Use musl support in cli_pkg #2172

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
31 changes: 5 additions & 26 deletions .github/workflows/build-linux-musl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ jobs:
platform: linux/386
- arch: arm64
platform: linux/arm64
# There is a bug in qemu's mremap causing pthread_getattr_np in musl to stuck in a loop on arm.
# Unless qemu fixes the bug or we get a real linux-arm runner, we cannot build aot-snapshot
# for arm on CI. So, we create a kernel snapshot for arm build in amd64 container instead.
# https://gitlab.com/qemu-project/qemu/-/issues/1729
- arch: arm
platform: linux/arm/v7
platform: linux/amd64 # linux/arm/v7

steps:
- uses: actions/checkout@v4
Expand All @@ -41,11 +45,6 @@ jobs:
dart run grinder protobuf
EOF

# https://gitlab.com/qemu-project/qemu/-/issues/1729
#
# There is a bug in qemu's mremap causing pthread_getattr_np in musl to stuck in a loop on arm.
# Unless qemu fixes the bug or we get a real linux-arm runner, we cannot build aot-snapshot
# for arm on CI. So, we create a kernel snapshot for arm build in amd64 container instead.
- name: Build
run: |
docker run --rm -i \
Expand All @@ -60,26 +59,6 @@ jobs:
find build -name '*.tar.gz' -print0 | xargs -0 -n 1 -- sh -xc 'mv "$1" "$(echo "$1" | sed -e "s/linux/linux-musl/")"' --
EOF

# The kernel snapshot created for arm in the previous step is bundling a glibc based dart runtime
# due to how cli_pkg downloads the sdk for building non-native platforms. Therefore we need to
# replace it with musl-libc based dart runtime to create a working linux-musl-arm package.
- name: Fix Dart Runtime
if: matrix.arch == 'arm'
run: |
docker run --rm -i \
--platform ${{ matrix.platform }} \
--volume $PWD:$PWD \
--workdir $PWD \
ghcr.io/dart-musl/dart <<'EOF'
set -e
apk add --no-cache tar
cd build
DART_RUNTIME=$(tar -tzf *.tar.gz --wildcards "*/src/dart")
tar -xzf *.tar.gz
cp $DART_SDK/bin/dart $DART_RUNTIME
tar -czf *.tar.gz "$(dirname "$(dirname "$DART_RUNTIME")")"
EOF

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
args: ^2.0.0
async: ^2.5.0
charcode: ^1.2.0
cli_pkg: ^2.7.1
cli_pkg: ^2.8.0
cli_repl: ^0.2.1
collection: ^1.16.0
http: "^1.1.0"
Expand Down
Loading