mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-17 01:30:33 +00:00
* fix: Resolve zstd-sys Zig compilation issues - Remove specific Zig version constraint in action.yml to use default version - Clean up duplicate environment variable settings in build-rustfs.sh - Add CARGO_TARGET_*_LINKER environment variables for better cross-compilation support - Optimize build configuration for consistent cross-platform compilation Fixes compilation issues with zstd-sys when using Zig cross-compilation. Aligns with previously working configuration that uses default Zig version. * fix: Restore working build configuration from4fb4b353- Restore matrix.cross parameter to differentiate cross-compilation - Use simple cargo zigbuild instead of complex build-rustfs.sh script - Remove unnecessary zstd dependencies from action.yml - Restore console asset download step - Use correct target directory path for packaging - Align with known working configuration from commit4fb4b353This reverts to the proven working build approach that successfully performed cross-platform compilation. * fix: Align build-rustfs.sh with working version logic - Simplify build logic to match working version4fb4b353- Use exact same build commands as the working build.yml: * cargo build for native compilation * cargo zigbuild for Linux ARM64 cross-compilation * cross build for Windows ARM64 cross-compilation - Remove complex environment variable setup that caused conflicts - Add touch rustfs/build.rs to match working version - Use -p rustfs --bins flag consistent with working version This ensures build-rustfs.sh (if used) follows the proven working approach.
This commit is contained in:
6
.github/actions/setup/action.yml
vendored
6
.github/actions/setup/action.yml
vendored
@@ -58,9 +58,7 @@ runs:
|
||||
libwebkit2gtk-4.1-dev \
|
||||
libxdo-dev \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
libzstd-dev \
|
||||
zstd
|
||||
libssl-dev
|
||||
|
||||
- name: Install protoc
|
||||
uses: arduino/setup-protoc@v3
|
||||
@@ -83,8 +81,6 @@ runs:
|
||||
- name: Install Zig
|
||||
if: inputs.install-cross-tools == 'true'
|
||||
uses: mlugg/setup-zig@v2
|
||||
with:
|
||||
version: 0.13.0
|
||||
|
||||
- name: Install cargo-zigbuild
|
||||
if: inputs.install-cross-tools == 'true'
|
||||
|
||||
69
.github/workflows/build.yml
vendored
69
.github/workflows/build.yml
vendored
@@ -146,6 +146,8 @@ jobs:
|
||||
if: needs.build-check.outputs.should_build == 'true'
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
RUSTFLAGS: ${{ matrix.cross == 'false' && '-C target-cpu=native' || '' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -153,23 +155,29 @@ jobs:
|
||||
# Linux builds
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-musl
|
||||
cross: false
|
||||
platform: linux
|
||||
- os: ubuntu-latest
|
||||
target: aarch64-unknown-linux-musl
|
||||
cross: true
|
||||
platform: linux
|
||||
# macOS builds
|
||||
- os: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
cross: false
|
||||
platform: macos
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
cross: false
|
||||
platform: macos
|
||||
# # Windows builds (temporarily disabled)
|
||||
# - os: windows-latest
|
||||
# target: x86_64-pc-windows-msvc
|
||||
# cross: false
|
||||
# platform: windows
|
||||
# - os: windows-latest
|
||||
# target: aarch64-pc-windows-msvc
|
||||
# cross: true
|
||||
# platform: windows
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -185,23 +193,50 @@ jobs:
|
||||
cache-shared-key: build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
cache-save-if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
|
||||
install-cross-tools: true
|
||||
install-cross-tools: ${{ matrix.cross }}
|
||||
|
||||
- name: Build RustFS using build-rustfs.sh
|
||||
- name: Download static console assets
|
||||
run: |
|
||||
# Use unified build script for consistent builds
|
||||
./build-rustfs.sh --platform ${{ matrix.target }}
|
||||
env:
|
||||
# Set environment variables for zstd-sys to avoid target parsing issues
|
||||
ZSTD_SYS_USE_PKG_CONFIG: 1
|
||||
PKG_CONFIG_ALLOW_CROSS: 1
|
||||
# For musl targets, use system zstd if available
|
||||
CC_x86_64_unknown_linux_musl: zig cc -target x86_64-linux-musl
|
||||
CXX_x86_64_unknown_linux_musl: zig c++ -target x86_64-linux-musl
|
||||
AR_x86_64_unknown_linux_musl: zig ar
|
||||
CC_aarch64_unknown_linux_musl: zig cc -target aarch64-linux-musl
|
||||
CXX_aarch64_unknown_linux_musl: zig c++ -target aarch64-linux-musl
|
||||
AR_aarch64_unknown_linux_musl: zig ar
|
||||
mkdir -p ./rustfs/static
|
||||
if [[ "${{ matrix.platform }}" == "windows" ]]; then
|
||||
curl.exe -L "https://dl.rustfs.com/artifacts/console/rustfs-console-latest.zip" -o console.zip --retry 3 --retry-delay 5 --max-time 300
|
||||
if [[ $? -eq 0 ]]; then
|
||||
unzip -o console.zip -d ./rustfs/static
|
||||
rm console.zip
|
||||
else
|
||||
echo "Warning: Failed to download console assets, continuing without them"
|
||||
echo "// Static assets not available" > ./rustfs/static/empty.txt
|
||||
fi
|
||||
else
|
||||
chmod +w ./rustfs/static/LICENSE || true
|
||||
curl -L "https://dl.rustfs.com/artifacts/console/rustfs-console-latest.zip" \
|
||||
-o console.zip --retry 3 --retry-delay 5 --max-time 300
|
||||
if [[ $? -eq 0 ]]; then
|
||||
unzip -o console.zip -d ./rustfs/static
|
||||
rm console.zip
|
||||
else
|
||||
echo "Warning: Failed to download console assets, continuing without them"
|
||||
echo "// Static assets not available" > ./rustfs/static/empty.txt
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Build RustFS
|
||||
run: |
|
||||
# Force rebuild by touching build.rs
|
||||
touch rustfs/build.rs
|
||||
|
||||
if [[ "${{ matrix.cross }}" == "true" ]]; then
|
||||
if [[ "${{ matrix.platform }}" == "windows" ]]; then
|
||||
# Use cross for Windows ARM64
|
||||
cargo install cross --git https://github.com/cross-rs/cross
|
||||
cross build --release --target ${{ matrix.target }} -p rustfs --bins
|
||||
else
|
||||
# Use zigbuild for Linux ARM64
|
||||
cargo zigbuild --release --target ${{ matrix.target }} -p rustfs --bins
|
||||
fi
|
||||
else
|
||||
cargo build --release --target ${{ matrix.target }} -p rustfs --bins
|
||||
fi
|
||||
|
||||
- name: Create release package
|
||||
id: package
|
||||
@@ -248,8 +283,8 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
# build-rustfs.sh outputs to target/release/${platform}/rustfs
|
||||
cd target/release/${{ matrix.target }}
|
||||
# Native/cross compilation outputs to target/${target}/release/rustfs
|
||||
cd target/${{ matrix.target }}/release
|
||||
zip "../../../${PACKAGE_NAME}.zip" rustfs
|
||||
cd ../../..
|
||||
|
||||
|
||||
Reference in New Issue
Block a user