Skip to content

Commit ec8fadc

Browse files
committed
try cross tool
1 parent adecf1f commit ec8fadc

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

.github/workflows/binary-builds.yml

+30-16
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ jobs:
3434
include:
3535
- target: aarch64-unknown-linux-gnu
3636
os: ubuntu-latest
37-
## I GIVE UP! For this target, OpenSSL needs to be cross compiled
38-
## which is driven by openssl-sys crate's custom build script...
39-
## Linux users with aarch64 (aka ARM64) using musl C lib can go fish (or build from source).
40-
# - target: aarch64-unknown-linux-musl
41-
# os: ubuntu-latest
37+
# I GIVE UP! For this target, OpenSSL needs to be cross compiled
38+
# which is driven by openssl-sys crate's custom build script...
39+
# Linux users with aarch64 (aka ARM64) using musl C lib can go fish (or build from source).
40+
- target: aarch64-unknown-linux-musl
41+
os: ubuntu-latest
4242
- target: x86_64-unknown-linux-gnu
4343
os: ubuntu-latest
4444
- target: x86_64-unknown-linux-musl
@@ -99,19 +99,33 @@ jobs:
9999
target: ${{ matrix.target }}
100100

101101
# problems with cross-compiling linux with musl
102-
- run: echo "RUSTFLAGS=-D warnings -C target-feature=+crt-static -C link-self-contained=yes" >> "${GITHUB_ENV}"
103-
if: contains(matrix.target, '-linux-musl')
104-
- run: |
105-
echo "CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
106-
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
107-
if: matrix.target == 'aarch64-unknown-linux-musl'
108-
109-
- name: Build
110-
env:
111-
# problems with cross-compiling aarch64 linux with gnu
112-
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc
102+
# - run: echo "RUSTFLAGS=-D warnings -C target-feature=+crt-static -C link-self-contained=yes" >> "${GITHUB_ENV}"
103+
# if: contains(matrix.target, '-linux-musl')
104+
# - run: |
105+
# echo "CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
106+
# echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
107+
# if: matrix.target == 'aarch64-unknown-linux-musl'
108+
109+
- name: Install cross (cargo cross compiler)
110+
if: matrix.os == 'ubuntu-latest' && (endsWith(matrix.target, 'musl') || startsWith(matrix.target, 'aarch64'))
111+
uses: taiki-e/install-action@v2
112+
with:
113+
tool: cross
114+
115+
- name: Build (native)
116+
# env:
117+
# # problems with cross-compiling aarch64 linux with gnu
118+
# CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc
119+
if: ${{!(matrix.os == 'ubuntu-latest' && (endsWith(matrix.target, 'musl') || startsWith(matrix.target, 'aarch64')))}}
113120
run: cargo build --manifest-path cpp-linter-lib/Cargo.toml --release --bin cpp-linter --target ${{ matrix.target }} ${{ steps.is-openssl-vendored.outputs.enabled }}
114121

122+
- name: Build (cross)
123+
# env:
124+
# # problems with cross-compiling aarch64 linux with gnu
125+
# CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: /usr/bin/aarch64-linux-gnu-gcc
126+
if: matrix.os == 'ubuntu-latest' && (endsWith(matrix.target, 'musl') || startsWith(matrix.target, 'aarch64'))
127+
run: cross build --manifest-path cpp-linter-lib/Cargo.toml --release --bin cpp-linter --target ${{ matrix.target }} ${{ steps.is-openssl-vendored.outputs.enabled }}
128+
115129
- name: Prepare artifacts
116130
run: mv target/${{ matrix.target }}/release/cpp-linter${{ runner.os == 'Windows' && '.exe' || '' }} ./cpp-linter-${{ matrix.target }}${{ runner.os == 'Windows' && '.exe' || '' }}
117131
- name: Upload artifacts

.github/workflows/run-dev-tests.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ jobs:
3333
- run: rustup component add llvm-tools-preview
3434

3535
# https://docs.rs/openssl/latest/openssl/#automatic
36-
- name: Install OpenSSL (Linux)
37-
if: runner.os == 'Linux'
38-
run: sudo apt-get install -y pkg-config libssl-dev
39-
- name: Install OpenSSL (MacOS)
40-
if: runner.os == 'macOS'
41-
run: brew install openssl@3
36+
# - name: Install OpenSSL (Linux)
37+
# if: runner.os == 'Linux'
38+
# run: sudo apt-get install -y pkg-config libssl-dev
39+
# - name: Install OpenSSL (MacOS)
40+
# if: runner.os == 'macOS'
41+
# run: brew install openssl@3
4242
# - name: Install OpenSSL (Windows)
4343
# if: runner.os == 'Windows'
4444
# run: vcpkg install openssl

0 commit comments

Comments
 (0)