-
Notifications
You must be signed in to change notification settings - Fork 10
ci: fix remote cross compilation #3 #4
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [build] | ||
| # Custom Docker images with proper build environment for native dependencies | ||
|
|
||
| [target.x86_64-unknown-linux-gnu] | ||
| dockerfile = "Dockerfile.cross-x86_64" | ||
|
|
||
| [target.aarch64-unknown-linux-gnu] | ||
| dockerfile = "Dockerfile.cross-aarch64" | ||
|
|
||
| [build.env] | ||
| passthrough = [ | ||
| "RUST_LOG", | ||
| "CARGO_TERM_COLOR", | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| FROM ghcr.io/cross-rs/cross:main | ||
|
|
||
| # Install ARM64 cross-compilation toolchain | ||
| RUN apt-get update && \ | ||
| apt-get install -y \ | ||
| gcc-aarch64-linux-gnu \ | ||
| g++-aarch64-linux-gnu \ | ||
| libc6-dev-arm64-cross \ | ||
| pkg-config-aarch64-linux-gnu \ | ||
| build-essential \ | ||
| clang \ | ||
| libclang-dev && \ | ||
|
Comment on lines
+5
to
+12
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Set up environment variables for ARM64 cross-compilation | ||
| # Keep host compiler for build scripts, only set target-specific variables | ||
| ENV CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc | ||
| ENV CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ | ||
| ENV AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar | ||
| ENV STRIP_aarch64_unknown_linux_gnu=aarch64-linux-gnu-strip | ||
| ENV PKG_CONFIG_aarch64_unknown_linux_gnu=aarch64-linux-gnu-pkg-config | ||
| ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc | ||
| ENV BINDGEN_EXTRA_CLANG_ARGS="-I/usr/aarch64-linux-gnu/include -I/usr/include" | ||
| ENV CFLAGS_aarch64_unknown_linux_gnu="-I/usr/aarch64-linux-gnu/include -I/usr/include" | ||
| ENV CPPFLAGS_aarch64_unknown_linux_gnu="-I/usr/aarch64-linux-gnu/include -I/usr/include" | ||
| ENV JEMALLOC_SYS_WITH_LG_PAGE=16 | ||
| ENV PKG_CONFIG_ALLOW_CROSS=1 | ||
|
Comment on lines
+17
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Combining multiple |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| FROM ghcr.io/cross-rs/cross:main | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| # Install additional build tools and headers | ||
| RUN apt-get update && \ | ||
| apt-get install -y \ | ||
| build-essential \ | ||
| pkg-config \ | ||
| libclang-dev \ | ||
| clang && \ | ||
|
Comment on lines
+5
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Set up environment variables for x86_64 cross-compilation | ||
| ENV CC_x86_64_unknown_linux_gnu=x86_64-linux-gnu-gcc | ||
| ENV CXX_x86_64_unknown_linux_gnu=x86_64-linux-gnu-g++ | ||
| ENV AR_x86_64_unknown_linux_gnu=x86_64-linux-gnu-ar | ||
| ENV STRIP_x86_64_unknown_linux_gnu=x86_64-linux-gnu-strip | ||
| ENV BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu="-I/usr/include -I/usr/include/x86_64-linux-gnu" | ||
| ENV CFLAGS_x86_64_unknown_linux_gnu="-I/usr/include -I/usr/include/x86_64-linux-gnu" | ||
| ENV CPPFLAGS_x86_64_unknown_linux_gnu="-I/usr/include -I/usr/include/x86_64-linux-gnu" | ||
|
Comment on lines
+13
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Combining multiple |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the
maintag for the base image can lead to non-reproducible builds. Pinning the base image to a specific, stable tag (e.g., a release version) ensures build consistency.