Skip to content

Commit 0a8c501

Browse files
author
MhdRahman
committed
Fixed build across platforms
1 parent 6bcfe3b commit 0a8c501

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
build:
1414
name: Build ${{ matrix.target }}
1515
runs-on: ${{ matrix.os }}
16-
continue-on-error: true
1716
strategy:
1817
fail-fast: false
1918
matrix:
@@ -57,9 +56,6 @@ jobs:
5756
use_cross: true
5857
embedded_only: true
5958

60-
outputs:
61-
build-success: ${{ steps.build-result.outputs.success }}
62-
6359
steps:
6460
- uses: actions/checkout@v4
6561

@@ -119,7 +115,7 @@ jobs:
119115
if: matrix.use_cross == true
120116
run: cargo install cross --git https://github.com/cross-rs/cross
121117

122-
- name: Set up protoc for cross-compilation
118+
- name: Set up environment for cross-compilation
123119
if: matrix.use_cross == true && matrix.embedded_only != true
124120
run: |
125121
# Download and install protoc for cross-compilation
@@ -128,7 +124,11 @@ jobs:
128124
unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d protoc
129125
sudo cp protoc/bin/protoc /usr/local/bin/
130126
sudo chmod +x /usr/local/bin/protoc
127+
128+
# Set environment variables for cross-compilation
131129
echo "PROTOC=/usr/local/bin/protoc" >> $GITHUB_ENV
130+
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
131+
echo "CROSS_CONTAINER_IN_CONTAINER=true" >> $GITHUB_ENV
132132
133133
- name: Build embedded only
134134
if: matrix.embedded_only == true
@@ -138,16 +138,14 @@ jobs:
138138
if: matrix.use_cross == true && matrix.embedded_only != true
139139
env:
140140
PROTOC: /usr/local/bin/protoc
141+
PKG_CONFIG_ALLOW_CROSS: 1
142+
CROSS_CONTAINER_IN_CONTAINER: true
141143
run: cross build --release --target ${{ matrix.target }}
142144

143145
- name: Build with cargo
144146
if: matrix.use_cross != true
145147
run: cargo build --release --target ${{ matrix.target }}
146148

147-
- name: Set build result
148-
id: build-result
149-
run: echo "success=true" >> $GITHUB_OUTPUT
150-
151149
- name: Package (Unix)
152150
if: matrix.os != 'windows-latest'
153151
run: |

Cross.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[build.env]
2+
passthrough = [
3+
"PROTOC",
4+
"PKG_CONFIG_ALLOW_CROSS",
5+
"PKG_CONFIG_PATH",
6+
]
7+
8+
[target.armv7-linux-androideabi]
9+
pre-build = [
10+
"dpkg --add-architecture armhf",
11+
"apt-get update",
12+
"apt-get install -y protobuf-compiler",
13+
]
14+
15+
[target.armv7-unknown-linux-gnueabihf]
16+
pre-build = [
17+
"dpkg --add-architecture armhf",
18+
"apt-get update",
19+
"apt-get install -y protobuf-compiler",
20+
"apt-get install -y libdbus-1-dev:armhf pkg-config",
21+
]

0 commit comments

Comments
 (0)