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: armv7 glibc version #981

Merged
merged 1 commit into from
Feb 1, 2025
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
137 changes: 107 additions & 30 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,6 @@ jobs:
export CXXFLAGS="-std=c++20 -stdlib=libc++ -static -fPIC -fno-cxx-exceptions -fno-exceptions -I/usr/include/c++/v1" &&
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-alpine-linux-musl-gcc &&
CC=clang CXX=clang++ yarn build --target aarch64-unknown-linux-musl
- host: ubuntu-latest
target: 'armv7-unknown-linux-gnueabihf'
downloadTarget: 'armv7-unknown-linux-gnueabihf'
setup: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libatomic1-armhf-cross -y
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx build --load --platform linux/arm/v7 -t ubuntu:noble-armv7 . -f noble-armv7.Dockerfile
docker run --rm -dt --name ubuntu-noble-armv7 ubuntu:noble-armv7
sudo mkdir -p /usr/arm-linux-gnueabihf/lib/llvm-18
sudo docker cp ubuntu-noble-armv7:/usr/lib/llvm-18/lib /usr/arm-linux-gnueabihf/lib/llvm-18/lib
sudo docker cp ubuntu-noble-armv7:/usr/lib/llvm-18/include /usr/arm-linux-gnueabihf/lib/llvm-18/include
docker stop ubuntu-noble-armv7
build: yarn build --target armv7-unknown-linux-gnueabihf --use-napi-cross
- host: ubuntu-latest
target: 'aarch64-linux-android'
downloadTarget: 'aarch64-linux-android'
Expand Down Expand Up @@ -184,22 +170,6 @@ jobs:
node-version: 20
cache: 'yarn'

- name: Set up QEMU
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm/v7
- name: Set up Docker Buildx
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm/v7

- uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }}
with:
version: 0.13.0

- name: Set env
if: matrix.settings.host == 'windows-latest'
run: echo "C:\\msys64\\mingw64\\bin" >> $GITHUB_PATH
Expand Down Expand Up @@ -242,6 +212,60 @@ jobs:
name: bindings-${{ matrix.settings.target }}
path: ${{ env.APP_NAME }}.*.node

build-armv7-linux-gnueabihf:
name: Build armv7-unknown-linux-gnueabihf
runs-on: ubuntu-latest
container:
image: debian:buster

steps:
- name: Setup tools
run: |
apt-get update
apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libatomic1-armhf-cross git build-essential cmake ninja-build wget curl gnupg
echo "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-18 main" >> /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-18 main" >> /etc/apt/sources.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
apt-get update
apt-get install -y clang-18
ln -s /usr/bin/clang-18 /usr/bin/clang
ln -s /usr/bin/clang++-18 /usr/bin/clang++
- uses: actions/checkout@v4
with:
submodules: true

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install
uses: ./.github/actions/setup-rust
with:
targets: "armv7-unknown-linux-gnueabihf"

- name: Install dependencies
run: |
corepack enable
yarn install --immutable --mode=skip-build

- name: Download skia binary
run: |
git config --global --add safe.directory "$(pwd)"
git config --global --add safe.directory "$(pwd)/skia"
node ./scripts/release-skia-binary.mjs --download --target=armv7-unknown-linux-gnueabihf

- name: Build
run: |
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc
yarn build --target armv7-unknown-linux-gnueabihf

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-armv7-unknown-linux-gnueabihf
path: ${{ env.APP_NAME }}.*.node

test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
needs:
Expand Down Expand Up @@ -535,6 +559,58 @@ jobs:
name: failure-images-aarch64-unknown-linux-musl-lts
path: __test__/failure/**

test-linux-arm-gnueabihf-binding:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
needs:
- build-armv7-linux-gnueabihf
strategy:
fail-fast: false
matrix:
node: ['18', '20', '22']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Apple Emoji font
uses: robinraju/release-downloader@v1
with:
repository: 'PoomSmart/EmojiLibrary'
tag: '0.15.4'
fileName: [email protected]
token: ${{ secrets.GITHUB_TOKEN }}
out-file-path: __test__/fonts/
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: bindings-armv7-unknown-linux-gnueabihf
path: .
- name: List packages
run: ls -R .
shell: bash
- name: Install dependencies
run: |
yarn config set supportedArchitectures.cpu "arm"
yarn install --immutable --mode=skip-build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Setup and run tests
uses: addnab/docker-run-action@v3
with:
image: node:${{ matrix.node }}-bookworm-slim
options: '--platform linux/arm/v7 -v ${{ github.workspace }}:/skia -w /skia'
run: |
set -e && \
yarn test:ci && \
ls -la
- name: Test failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: failure-images-armv7-unknown-linux-gnueabihf-${{ matrix.node }}
path: __test__/failure/**

rust-test:
name: stable - macOS - cargo - test
runs-on: macos-latest
Expand Down Expand Up @@ -607,6 +683,7 @@ jobs:
- test-linux-x64-musl-binding
- test-linux-aarch64-gnu-binding
- test-linux-aarch64-musl-binding
- test-linux-arm-gnueabihf-binding
- test-macOS-windows-binding

steps:
Expand Down
55 changes: 14 additions & 41 deletions .github/workflows/skia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,15 @@ jobs:

name: stable - armv7-linux - build skia
runs-on: ubuntu-latest
container:
image: debian:buster

steps:
- name: Setup tools
run: |
apt-get update
apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libatomic1-armhf-cross git build-essential cmake ninja-build wget curl python3
ln -s /usr/bin/python3 /usr/bin/python
- uses: actions/checkout@v4
with:
submodules: true
Expand All @@ -288,54 +295,20 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- uses: actions/setup-python@v5
with:
python-version: '3.x'
architecture: 'x64'

- name: Set env
run: echo "${PWD}/depot_tools" >> $GITHUB_PATH
shell: bash

- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install ninja-build -y

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm/v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm/v7

- name: Install cross compile tools
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" | sudo tee -a /etc/apt/sources.list > /dev/null
echo "deb-src http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" | sudo tee -a /etc/apt/sources.list > /dev/null
sudo apt-get update
sudo apt-get install llvm-19 clang-19 lld-19 gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx build --load --platform linux/arm/v7 -t ubuntu:noble-armv7 . -f noble-armv7.Dockerfile
docker run --rm -dt --name ubuntu-noble-armv7 ubuntu:noble-armv7
sudo mkdir -p /usr/arm-linux-gnueabihf/lib/llvm-18
sudo docker cp ubuntu-noble-armv7:/usr/lib/llvm-18/lib /usr/arm-linux-gnueabihf/lib/llvm-18/lib
sudo docker cp ubuntu-noble-armv7:/usr/lib/llvm-18/include /usr/arm-linux-gnueabihf/lib/llvm-18/include
docker stop ubuntu-noble-armv7

- name: Compile skia
run: node ./scripts/build-skia.js --target=armv7-unknown-linux-gnueabihf

- name: Install dependencies
run: yarn install --immutable --mode=skip-build
run: |
corepack enable
yarn install --immutable --mode=skip-build

- name: Upload release
run: node ./scripts/release-skia-binary.mjs --upload --target=armv7-unknown-linux-gnueabihf
run: |
git config --global --add safe.directory "$(pwd)"
git config --global --add safe.directory "$(pwd)/skia"
node ./scripts/release-skia-binary.mjs --upload --target=armv7-unknown-linux-gnueabihf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ napi-build = "2"
[profile.release]
codegen-units = 1
lto = true
strip = "symbols"
# strip = "symbols"
11 changes: 5 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,17 @@ fn main() {
println!("cargo:rustc-link-lib=static=atomic");
}
"arm" => {
link_libcxx(&mut build);
env::set_var("CC", "clang");
env::set_var("CXX", "clang++");
env::set_var("TARGET_CC", "clang");
env::set_var("TARGET_CXX", "clang++");
build
.cpp_set_stdlib("stdc++")
.flag("-static")
.include("/usr/arm-linux-gnueabihf/include")
.include(format!(
"/usr/arm-linux-gnueabihf/lib/llvm-18/include/c++/v1"
));
println!("cargo:rustc-link-search=/usr/arm-linux-gnueabihf/lib");
println!("cargo:rustc-link-search=/usr/arm-linux-gnueabihf/lib/llvm-18/lib");
.include(format!("/usr/arm-linux-gnueabihf/include/c++/8"));
println!("cargo:rustc-link-lib=static=stdc++");
println!("cargo:rustc-link-search=/usr/lib/gcc-cross/arm-linux-gnueabihf/8");
}
_ => {}
}
Expand Down
5 changes: 0 additions & 5 deletions noble-armv7.Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@jimp/custom": "^0.22.10",
"@jimp/jpeg": "^0.22.10",
"@jimp/png": "^0.22.10",
"@napi-rs/cli": "^3.0.0-alpha.69",
"@napi-rs/cli": "^3.0.0-alpha.70",
"@octokit/rest": "^21.0.0",
"@swc-node/register": "^1.8.0",
"@swc/core": "^1.4.0",
Expand Down
6 changes: 5 additions & 1 deletion scripts/build-c++abi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ execSync(
},
)

execSync(`ninja -C build cxxabi`, {
execSync(`ninja -C build cxx cxxabi`, {
stdio: 'inherit',
cwd: `llvm-project-llvmorg-${LLVM_VERSION}`,
})

execSync(`cp llvm-project-llvmorg-${LLVM_VERSION}/build/lib/libc++abi.a .`, {
stdio: 'inherit',
})

execSync(`cp llvm-project-llvmorg-${LLVM_VERSION}/build/lib/libc++.a .`, {
stdio: 'inherit',
})
26 changes: 8 additions & 18 deletions scripts/build-skia.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ const GN_ARGS = [
`skia_enable_fontmgr_custom_embedded=false`,
`skia_enable_fontmgr_custom_empty=true`,
`skia_enable_fontmgr_android=false`,
`skunicode_tests_enabled=false`
`skunicode_tests_enabled=false`,
`skia_enable_skshaper_tests=false`
]

switch (PLATFORM_NAME) {
Expand Down Expand Up @@ -113,7 +114,7 @@ switch (PLATFORM_NAME) {
case 'linux':
case 'darwin':
ExtraCflagsCC =
'"-std=c++20",' +
'"-std=c++17",' +
'"-fno-exceptions",' +
'"-DSK_FORCE_RASTER_PIPELINE_BLITTER",' +
'"-DSK_ENABLE_SVG",' +
Expand Down Expand Up @@ -180,21 +181,10 @@ switch (TARGET_TRIPLE) {
)
break
case 'armv7-unknown-linux-gnueabihf':
CC='"arm-linux-gnueabihf-gcc"'
CXX='"arm-linux-gnueabihf-g++"'
ExtraSkiaBuildFlag += ' target_cpu="armv7a" target_os="linux"'
ExtraCflags = `"--target=arm-unknown-linux-gnueabihf", "-I/usr/arm-linux-gnueabihf/lib/llvm-18/include/c++/v1", "-march=armv7-a", "-mthumb"`
ExtraCflagsCC += `,"-stdlib=libc++", "-static", "--target=arm-unknown-linux-gnueabihf", "-I/usr/arm-linux-gnueabihf/lib/llvm-18/include/c++/v1", "-march=armv7-a", "-mthumb"`
ExtraLdFlags =
'"--target=arm-unknown-linux-gnueabihf", "-B/usr/arm-linux-gnueabihf/bin", "-L/usr/arm-linux-gnueabihf/lib", "-L/usr/arm-linux-gnueabihf/lib/llvm-18/lib"'
ExtraAsmFlags =
'"--sysroot=/usr/arm-linux-gnueabihf", "--target=arm-unknown-linux-gnueabihf", "-march=armv7-a", "-mthumb", "-mfpu=neon"'

GN_ARGS.push(
`extra_ldflags=[${ExtraLdFlags}]`,
`ar="llvm-ar-18"`,
`extra_asmflags=[${ExtraAsmFlags}]`,
`extra_cflags=[${ExtraCflags}]`,
`extra_cflags_c=[${ExtraCflags}]`,
)
ExtraCflags = `"-march=armv7-a", "-mthumb", "-mfpu=neon"`
break
case 'aarch64-apple-darwin':
ExtraSkiaBuildFlag += ' target_cpu="arm64" target_os="mac"'
Expand Down Expand Up @@ -232,13 +222,13 @@ switch (TARGET_TRIPLE) {
`extra_cflags_c=[${ExtraCflags}]`,
)
break
case '':
break
case 'riscv64gc-unknown-linux-gnu':
ExtraSkiaBuildFlag += ' target_cpu="riscv64" target_os="linux"'
CC = '"riscv64-linux-gnu-gcc"'
CXX = '"riscv64-linux-gnu-g++"'
break;
case '':
break
default:
throw new TypeError(`[${TARGET_TRIPLE}] is not a valid target`)
}
Expand Down
Loading