-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying to configure cross compilation in docker
- Loading branch information
1 parent
a89b855
commit e6ec80c
Showing
5 changed files
with
120 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
release: | ||
name: Release - ${{ matrix.platform.os-name }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- os-name: FreeBSD-x86_64 | ||
runs-on: ubuntu-20.04 | ||
target: x86_64-unknown-freebsd | ||
skip_tests: true | ||
|
||
- os-name: Linux-x86_64 | ||
runs-on: ubuntu-20.04 | ||
target: x86_64-unknown-linux-musl | ||
|
||
- os-name: Linux-aarch64 | ||
runs-on: ubuntu-20.04 | ||
target: aarch64-unknown-linux-musl | ||
|
||
- os-name: Linux-riscv64 | ||
runs-on: ubuntu-20.04 | ||
target: riscv64gc-unknown-linux-gnu | ||
|
||
- os-name: Windows-x86_64 | ||
runs-on: windows-latest | ||
target: x86_64-pc-windows-msvc | ||
|
||
- os-name: macOS-x86_64 | ||
runs-on: macOS-latest | ||
target: x86_64-apple-darwin | ||
|
||
# more targets here ... | ||
|
||
runs-on: ${{ matrix.platform.runs-on }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Build binary | ||
uses: houseabsolute/actions-rust-cross@v0 | ||
with: | ||
command: ${{ matrix.platform.command }} | ||
target: ${{ matrix.platform.target }} | ||
args: "--locked --release" | ||
strip: true | ||
- name: Publish artifacts and release | ||
uses: houseabsolute/actions-rust-release@v0 | ||
with: | ||
executable-name: ubi | ||
target: ${{ matrix.platform.target }} | ||
# on: | ||
# pull_request: | ||
# types: [opened, reopened, synchronize] | ||
|
||
# jobs: | ||
# release: | ||
# name: Release - ${{ matrix.platform.os-name }} | ||
# strategy: | ||
# matrix: | ||
# platform: | ||
# - os-name: FreeBSD-x86_64 | ||
# runs-on: ubuntu-20.04 | ||
# target: x86_64-unknown-freebsd | ||
# skip_tests: true | ||
|
||
# - os-name: Linux-x86_64 | ||
# runs-on: ubuntu-20.04 | ||
# target: x86_64-unknown-linux-musl | ||
|
||
# - os-name: Linux-aarch64 | ||
# runs-on: ubuntu-20.04 | ||
# target: aarch64-unknown-linux-musl | ||
|
||
# - os-name: Linux-riscv64 | ||
# runs-on: ubuntu-20.04 | ||
# target: riscv64gc-unknown-linux-gnu | ||
|
||
# - os-name: Windows-x86_64 | ||
# runs-on: windows-latest | ||
# target: x86_64-pc-windows-msvc | ||
|
||
# - os-name: macOS-x86_64 | ||
# runs-on: macOS-latest | ||
# target: x86_64-apple-darwin | ||
|
||
# # more targets here ... | ||
|
||
# runs-on: ${{ matrix.platform.runs-on }} | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v4 | ||
# - name: Build binary | ||
# uses: houseabsolute/actions-rust-cross@v0 | ||
# with: | ||
# command: ${{ matrix.platform.command }} | ||
# target: ${{ matrix.platform.target }} | ||
# args: "--locked --release" | ||
# strip: true | ||
# - name: Publish artifacts and release | ||
# uses: houseabsolute/actions-rust-release@v0 | ||
# with: | ||
# executable-name: ubi | ||
# target: ${{ matrix.platform.target }} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
FROM rust:1.81 | ||
|
||
# Install necessary tools and dependencies | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
clang \ | ||
cmake \ | ||
curl \ | ||
file \ | ||
git \ | ||
libssl-dev \ | ||
pkg-config \ | ||
python3 \ | ||
qemu-user-static \ | ||
wget \ | ||
xz-utils \ | ||
zlib1g-dev \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Docker (for cross) | ||
RUN curl -fsSL https://get.docker.com | sh | ||
|
||
# Install Cross | ||
RUN cargo install cross --git https://github.com/cross-rs/cross | ||
|
||
# Add macOS cross-compilation toolchain using osxcross | ||
# RUN git clone https://github.com/tpoechtrager/osxcross.git /osxcross \ | ||
# && cd ../osxcross \ | ||
# && wget -q https://github.com/tpoechtrager/osxcross/releases/download/v1.1/MacOSX10.11.sdk.tar.xz -O tarballs/MacOSX10.11.sdk.tar.xz \ | ||
# && UNATTENDED=1 ./build.sh | ||
|
||
# ENV PATH="/osxcross/target/bin:$PATH" | ||
# ENV CROSS_CONTAINER_IN_CONTAINER=true | ||
# ENV MACOSX_DEPLOYMENT_TARGET=11.0 | ||
|
||
# # Add Windows cross-compilation toolchain | ||
# RUN rustup target add x86_64-pc-windows-gnu aarch64-pc-windows-gnu | ||
|
||
# # Add Linux cross-compilation toolchains | ||
# RUN rustup target add x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu | ||
|
||
# Set up entrypoint for container | ||
WORKDIR /project | ||
|
||
ENTRYPOINT ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
# navigate to directory | ||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | ||
cd $SCRIPTPATH | ||
|
||
cd .. | ||
|
||
dockerd | ||
sudo systemctl start docker | ||
cross build --target aarch64-unknown-linux-gnu | ||
|
||
|
||
docker run --rm -it \ | ||
-v "$(pwd):/project" \ # Mount the current directory to /project | ||
-v /var/run/docker.sock:/var/run/docker.sock \ # Share host Docker socket | ||
-w /project \ # Set the working directory inside the container | ||
rust-cross-compiler |