fix: linux builds: use gcc 10 in Linux builds (#4841)

This commit is contained in:
Jack Amadeo
2025-09-26 11:12:05 -04:00
committed by GitHub
parent 4e786db03e
commit 945c783517
3 changed files with 47 additions and 62 deletions

View File

@@ -5,7 +5,7 @@
#
# Platform Build Strategy:
# - Linux: Uses Ubuntu runner with cross-compilation
# - macOS: Uses macOS runner with cross-compilation
# - macOS: Uses macOS runner with cross-compilation
# - Windows: Uses Ubuntu runner with Docker cross-compilation (same as desktop build)
on:
workflow_call:
@@ -35,11 +35,13 @@ jobs:
target-suffix: unknown-linux-gnu
build-on: ubuntu-latest
use-cross: true
cc: gcc-10
- os: ubuntu-latest
architecture: aarch64
target-suffix: unknown-linux-gnu
build-on: ubuntu-latest
use-cross: true
cc: gcc-10
# macOS builds
- os: macos-latest
architecture: x86_64
@@ -123,17 +125,17 @@ jobs:
echo "Cross version:"
cross --version
echo "Building with explicit PROTOC path..."
cross build --release --target ${TARGET} -p goose-cli -vv
export CC="${{ matrix.cc || ''}}"
cross build --release --target ${TARGET} -p goose-cli
- name: Build CLI (Windows)
if: matrix.use-docker
run: |
echo "🚀 Building Windows CLI executable with enhanced GitHub Actions caching..."
# Create cache directories
mkdir -p ~/.cargo/registry ~/.cargo/git
# Use enhanced caching with GitHub Actions cache mounts
docker run --rm \
-v "$(pwd)":/usr/src/myapp \
@@ -146,7 +148,7 @@ jobs:
echo '=== Setting up Rust environment with caching ==='
export CARGO_HOME=/usr/local/cargo
export PATH=/usr/local/cargo/bin:\$PATH
# Check if Windows target is already installed in cache
if rustup target list --installed | grep -q x86_64-pc-windows-gnu; then
echo '✅ Windows cross-compilation target already installed'
@@ -154,11 +156,11 @@ jobs:
echo '📦 Installing Windows cross-compilation target...'
rustup target add x86_64-pc-windows-gnu
fi
echo '=== Setting up build dependencies ==='
apt-get update
apt-get install -y mingw-w64 protobuf-compiler cmake time
echo '=== Setting up cross-compilation environment ==='
export CC_x86_64_pc_windows_gnu=x86_64-w64-mingw32-gcc
export CXX_x86_64_pc_windows_gnu=x86_64-w64-mingw32-g++
@@ -166,7 +168,7 @@ jobs:
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc
export PKG_CONFIG_ALLOW_CROSS=1
export PROTOC=/usr/bin/protoc
echo '=== Optimized Cargo configuration ==='
mkdir -p .cargo
echo '[build]' > .cargo/config.toml
@@ -188,7 +190,7 @@ jobs:
echo '' >> .cargo/config.toml
echo '[registries.crates-io]' >> .cargo/config.toml
echo 'protocol = \"sparse\"' >> .cargo/config.toml
echo '=== Building with cached dependencies ==='
# Check if we have cached build artifacts
if [ -d target/x86_64-pc-windows-gnu/release/deps ] && [ \"\$(ls -A target/x86_64-pc-windows-gnu/release/deps)\" ]; then
@@ -198,34 +200,34 @@ jobs:
echo '🔨 No cached artifacts found, performing full build...'
CARGO_INCREMENTAL=0
fi
echo '🔨 Building Windows CLI executable...'
CARGO_INCREMENTAL=\$CARGO_INCREMENTAL \
CARGO_NET_RETRY=3 \
CARGO_HTTP_TIMEOUT=60 \
RUST_BACKTRACE=1 \
cargo build --release --target x86_64-pc-windows-gnu -p goose-cli --jobs 4
echo '=== Copying Windows runtime DLLs ==='
GCC_DIR=\$(ls -d /usr/lib/gcc/x86_64-w64-mingw32/*/ | head -n 1)
cp \"\$GCC_DIR/libstdc++-6.dll\" target/x86_64-pc-windows-gnu/release/
cp \"\$GCC_DIR/libgcc_s_seh-1.dll\" target/x86_64-pc-windows-gnu/release/
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll target/x86_64-pc-windows-gnu/release/
echo '✅ Build completed successfully!'
ls -la target/x86_64-pc-windows-gnu/release/
"
# Verify build succeeded
if [ ! -f "./target/x86_64-pc-windows-gnu/release/goose.exe" ]; then
echo "❌ Windows CLI binary not found."
ls -la ./target/x86_64-pc-windows-gnu/release/ || echo "Release directory doesn't exist"
exit 1
fi
echo "✅ Windows CLI binary found!"
ls -la ./target/x86_64-pc-windows-gnu/release/goose.exe
echo "✅ Windows runtime DLLs:"
ls -la ./target/x86_64-pc-windows-gnu/release/*.dll
@@ -234,7 +236,7 @@ jobs:
run: |
source ./bin/activate-hermit
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"
# Set Go cross-compilation variables based on target
case "${TARGET}" in
"x86_64-unknown-linux-gnu")
@@ -262,7 +264,7 @@ jobs:
exit 1
;;
esac
echo "Building temporal-service for ${GOOS}/${GOARCH} using build.sh script..."
cd temporal-service
# Run build.sh with cross-compilation environment
@@ -284,11 +286,11 @@ jobs:
chmod +x build.sh
# Set Windows build environment and run build script
GOOS=windows GOARCH=amd64 ./build.sh
# Move the built binary to the expected location (inside container)
mkdir -p ../target/x86_64-pc-windows-gnu/release
mv temporal-service.exe ../target/x86_64-pc-windows-gnu/release/temporal-service.exe
# Fix permissions for host access
chmod -R 755 ../target/x86_64-pc-windows-gnu
"
@@ -299,7 +301,7 @@ jobs:
run: |
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"
TEMPORAL_VERSION="1.3.0"
# Set platform-specific download parameters
case "${TARGET}" in
"x86_64-unknown-linux-gnu")
@@ -327,18 +329,18 @@ jobs:
exit 1
;;
esac
echo "Downloading temporal CLI for ${TEMPORAL_OS}/${TEMPORAL_ARCH}..."
TEMPORAL_FILE="temporal_cli_${TEMPORAL_VERSION}_${TEMPORAL_OS}_${TEMPORAL_ARCH}.tar.gz"
curl -L "https://github.com/temporalio/cli/releases/download/v${TEMPORAL_VERSION}/${TEMPORAL_FILE}" -o "${TEMPORAL_FILE}"
# Extract temporal CLI
tar -xzf "${TEMPORAL_FILE}"
chmod +x temporal${TEMPORAL_EXT}
# Move to target directory
mv temporal${TEMPORAL_EXT} "target/${TARGET}/release/temporal${TEMPORAL_EXT}"
# Clean up
rm -f "${TEMPORAL_FILE}"
echo "temporal CLI downloaded successfully for ${TARGET}"
@@ -351,13 +353,13 @@ jobs:
curl -L "https://github.com/temporalio/cli/releases/download/v${TEMPORAL_VERSION}/temporal_cli_${TEMPORAL_VERSION}_windows_amd64.zip" -o temporal-cli-windows.zip
unzip -o temporal-cli-windows.zip
chmod +x temporal.exe
# Fix permissions on target directory (created by Docker as root)
sudo chown -R $(whoami):$(whoami) target/x86_64-pc-windows-gnu/ || true
# Move to target directory
mv temporal.exe target/x86_64-pc-windows-gnu/release/temporal.exe
# Clean up
rm -f temporal-cli-windows.zip
echo "temporal CLI downloaded successfully for Windows"
@@ -367,15 +369,15 @@ jobs:
run: |
source ./bin/activate-hermit
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"
# Create a directory for the package contents
mkdir -p "target/${TARGET}/release/goose-package"
# Copy binaries
cp "target/${TARGET}/release/goose" "target/${TARGET}/release/goose-package/"
cp "target/${TARGET}/release/temporal-service" "target/${TARGET}/release/goose-package/"
cp "target/${TARGET}/release/temporal" "target/${TARGET}/release/goose-package/"
# Create the tar archive with all binaries
cd "target/${TARGET}/release"
tar -cjf "goose-${TARGET}.tar.bz2" -C goose-package .
@@ -385,18 +387,18 @@ jobs:
if: matrix.use-docker
run: |
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"
# Create a directory for the package contents
mkdir -p "target/${TARGET}/release/goose-package"
# Copy binaries
cp "target/${TARGET}/release/goose.exe" "target/${TARGET}/release/goose-package/"
cp "target/${TARGET}/release/temporal-service.exe" "target/${TARGET}/release/goose-package/"
cp "target/${TARGET}/release/temporal.exe" "target/${TARGET}/release/goose-package/"
# Copy Windows runtime DLLs
cp "target/${TARGET}/release/"*.dll "target/${TARGET}/release/goose-package/"
# Create the zip archive with all binaries and DLLs
cd "target/${TARGET}/release"
zip -r "goose-${TARGET}.zip" goose-package/

View File

@@ -117,6 +117,7 @@ jobs:
RUST_LOG: debug
RUST_BACKTRACE: 1
CROSS_VERBOSE: 1
CC: gcc-10
run: |
source ./bin/activate-hermit
export TARGET="x86_64-unknown-linux-gnu"
@@ -157,10 +158,10 @@ jobs:
source ./bin/activate-hermit
cd ui/desktop
echo "Building Linux packages (.deb and .rpm)..."
# Build both .deb and .rpm packages
npm run make -- --platform=linux --arch=x64
echo "Build completed. Checking output..."
ls -la out/
find out/ -name "*.deb" -o -name "*.rpm" | head -10

View File

@@ -1,4 +1,7 @@
# Configuration for cross-compiling using cross
[build.env]
passthrough = [ "CC" ]
[target.aarch64-unknown-linux-gnu]
xargo = false
pre-build = [
@@ -11,15 +14,8 @@ pre-build = [
pkg-config \
libssl-dev:arm64 \
libdbus-1-dev:arm64 \
libxcb1-dev:arm64
""",
"""\
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \
unzip -o protoc-31.1-linux-x86_64.zip -d /usr/local && \
chmod +x /usr/local/bin/protoc && \
ln -sf /usr/local/bin/protoc /usr/bin/protoc && \
which protoc && \
protoc --version
libxcb1-dev:arm64 \
gcc-10
"""
]
@@ -33,15 +29,8 @@ pre-build = [
pkg-config \
libssl-dev \
libdbus-1-dev \
libxcb1-dev
""",
"""\
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \
unzip -o protoc-31.1-linux-x86_64.zip -d /usr/local && \
chmod +x /usr/local/bin/protoc && \
ln -sf /usr/local/bin/protoc /usr/bin/protoc && \
which protoc && \
protoc --version
libxcb1-dev \
gcc-10
"""
]
@@ -53,12 +42,5 @@ pre-build = [
apt-get update && apt-get install -y \
curl \
unzip
""",
"""\
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip && \
unzip protoc-31.1-linux-x86_64.zip -d /usr/local && \
chmod +x /usr/local/bin/protoc && \
export PROTOC=/usr/local/bin/protoc && \
protoc --version
"""
]