From 95f8d37569dec86b2064f0d7b87ed4551031e4fb Mon Sep 17 00:00:00 2001 From: Maxime <98154358+Maxime-Cllt@users.noreply.github.com> Date: Wed, 3 Sep 2025 15:13:12 +0200 Subject: [PATCH 1/6] fix ci.yml --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdfe39e..e34e61b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: Rust CI on: push: - branches: [ "main" ] + branches: [ "fix-gha" ] pull_request: branches: [ "main" ] workflow_dispatch: @@ -21,20 +21,31 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy, rust-src + + - name: Verify Rust installation + run: | + rustc --version + cargo --version + rustup show - name: Cache cargo registry - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | - ~/.cargo/registry - ~/.cargo/git - target + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- - name: Install system dependencies run: | sudo apt-get update - sudo apt-get install -y wget unzip build-essential cmake + sudo apt-get install -y wget unzip build-essential cmake pkg-config - name: Download and install libtorch run: | @@ -50,16 +61,30 @@ jobs: ls -la /usr/local/libtorch/ ls -la /usr/local/libtorch/lib/ - - name: Build + - name: Clean cargo cache (if needed) + run: | + cargo clean + + - name: Update cargo index + run: cargo update + + - name: Check Cargo.toml + run: | + echo "Checking Cargo.toml for potential issues..." + cat Cargo.toml + + - name: Build with verbose output run: cargo build --verbose env: LIBTORCH: /usr/local/libtorch LD_LIBRARY_PATH: /usr/local/libtorch/lib LIBTORCH_BYPASS_VERSION_CHECK: 1 + RUST_BACKTRACE: 1 - name: Run tests run: cargo test --verbose env: LIBTORCH: /usr/local/libtorch LD_LIBRARY_PATH: /usr/local/libtorch/lib - LIBTORCH_BYPASS_VERSION_CHECK: 1 \ No newline at end of file + LIBTORCH_BYPASS_VERSION_CHECK: 1 + RUST_BACKTRACE: 1 \ No newline at end of file From 3aad174f53616632bd236be0699ef1880042a063 Mon Sep 17 00:00:00 2001 From: Maxime <98154358+Maxime-Cllt@users.noreply.github.com> Date: Wed, 3 Sep 2025 15:15:36 +0200 Subject: [PATCH 2/6] fix ci.yml --- .github/workflows/ci.yml | 74 ++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e34e61b..476aa95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Rust CI +name: Rust CI (Debug) on: push: @@ -10,27 +10,31 @@ on: env: CARGO_TERM_COLOR: always LIBTORCH_VERSION: 2.7.1 - LIBTORCH_CXX11_ABI: 1 jobs: build: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v4 - - name: Install Rust + - name: Install Rust with specific version uses: dtolnay/rust-toolchain@stable with: + # Try a specific known-good version if stable is problematic + toolchain: 1.75.0 components: rustfmt, clippy, rust-src - - name: Verify Rust installation + - name: Debug Rust environment run: | - rustc --version + rustc --version --verbose cargo --version rustup show + rustup component list --installed + echo "Proc macro support:" + rustc --print target-list | grep $(rustc -vV | sed -n 's/host: //p') - - name: Cache cargo registry + - name: Cache cargo uses: actions/cache@v4 with: path: | @@ -38,53 +42,57 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-v2 restore-keys: | ${{ runner.os }}-cargo- - name: Install system dependencies run: | - sudo apt-get update - sudo apt-get install -y wget unzip build-essential cmake pkg-config + brew install cmake wget - - name: Download and install libtorch + - name: Setup libtorch run: | cd /tmp - wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}%2Bcpu.zip - unzip libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}+cpu.zip + # Detect architecture and download appropriate libtorch + ARCH=$(uname -m) + if [ "$ARCH" = "arm64" ]; then + LIBTORCH_URL="https://download.pytorch.org/libtorch/cpu/libtorch-macos-arm64-${LIBTORCH_VERSION}.zip" + else + LIBTORCH_URL="https://download.pytorch.org/libtorch/cpu/libtorch-macos-x86_64-${LIBTORCH_VERSION}.zip" + fi + + echo "Downloading libtorch for $ARCH from $LIBTORCH_URL" + wget "$LIBTORCH_URL" -O libtorch.zip + unzip libtorch.zip sudo mv libtorch /usr/local/ + echo "LIBTORCH=/usr/local/libtorch" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=/usr/local/libtorch/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV + echo "DYLD_LIBRARY_PATH=/usr/local/libtorch/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV - - name: Verify libtorch installation - run: | - ls -la /usr/local/libtorch/ - ls -la /usr/local/libtorch/lib/ - - - name: Clean cargo cache (if needed) + - name: Force clean build run: | cargo clean + rm -rf ~/.cargo/registry/cache/ + cargo update - - name: Update cargo index - run: cargo update - - - name: Check Cargo.toml + - name: Try building specific problematic crate first run: | - echo "Checking Cargo.toml for potential issues..." - cat Cargo.toml + echo "Attempting to build darling_macro specifically..." + cargo build -p darling_macro --verbose || echo "darling_macro build failed, continuing..." - - name: Build with verbose output - run: cargo build --verbose + - name: Build with maximum debugging + run: | + export RUST_LOG=debug + export RUST_BACKTRACE=full + cargo build --verbose env: LIBTORCH: /usr/local/libtorch - LD_LIBRARY_PATH: /usr/local/libtorch/lib + DYLD_LIBRARY_PATH: /usr/local/libtorch/lib LIBTORCH_BYPASS_VERSION_CHECK: 1 - RUST_BACKTRACE: 1 - name: Run tests run: cargo test --verbose env: LIBTORCH: /usr/local/libtorch - LD_LIBRARY_PATH: /usr/local/libtorch/lib - LIBTORCH_BYPASS_VERSION_CHECK: 1 - RUST_BACKTRACE: 1 \ No newline at end of file + DYLD_LIBRARY_PATH: /usr/local/libtorch/lib + LIBTORCH_BYPASS_VERSION_CHECK: 1 \ No newline at end of file From 513d1dd345845e338cde021a04ab1738e3fb6208 Mon Sep 17 00:00:00 2001 From: Maxime <98154358+Maxime-Cllt@users.noreply.github.com> Date: Wed, 3 Sep 2025 15:17:02 +0200 Subject: [PATCH 3/6] fix ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 476aa95..074c685 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: - name: Install system dependencies run: | - brew install cmake wget + brew install wget - name: Setup libtorch run: | From b760467588a41bd9d2d62acb5e747fd8a2b7cd01 Mon Sep 17 00:00:00 2001 From: Maxime <98154358+Maxime-Cllt@users.noreply.github.com> Date: Wed, 3 Sep 2025 15:17:49 +0200 Subject: [PATCH 4/6] fix ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 074c685..cfe8e4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: uses: dtolnay/rust-toolchain@stable with: # Try a specific known-good version if stable is problematic - toolchain: 1.75.0 + toolchain: 1.89.0 components: rustfmt, clippy, rust-src - name: Debug Rust environment From 2f6866619ed717b17c87ad42bc825516cc365d04 Mon Sep 17 00:00:00 2001 From: Maxime <98154358+Maxime-Cllt@users.noreply.github.com> Date: Wed, 3 Sep 2025 15:28:49 +0200 Subject: [PATCH 5/6] fix cd.yml --- .github/workflows/cd.yml | 5 +++-- .github/workflows/ci.yml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3f257db..64f6e2c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -5,7 +5,7 @@ permissions: on: push: - tags: ['v*'] + tags: [ 'v*' ] workflow_dispatch: inputs: version: @@ -21,6 +21,7 @@ env: CARGO_TERM_COLOR: always LIBTORCH_VERSION: 2.7.1 LIBTORCH_CXX11_ABI: 1 + LIBTORCH_BYPASS_VERSION_CHECK: 1 jobs: build-and-release: @@ -90,7 +91,7 @@ jobs: if: matrix.os == 'macos-latest' run: | if [ ! -d "/tmp/libtorch" ]; then - brew install wget cmake + brew install wget cd /tmp wget -q ${{ matrix.libtorch_url }} -O libtorch.zip unzip -q libtorch.zip diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfe8e4c..2b4601a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: Rust CI (Debug) on: push: - branches: [ "fix-gha" ] + branches: [ "main" ] pull_request: branches: [ "main" ] workflow_dispatch: From 92acce5b884b04109ac445c91454865c8a011204 Mon Sep 17 00:00:00 2001 From: Maxime <98154358+Maxime-Cllt@users.noreply.github.com> Date: Wed, 3 Sep 2025 15:38:59 +0200 Subject: [PATCH 6/6] fix cd.yml --- .github/workflows/cd.yml | 49 ++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 64f6e2c..b29816b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -60,19 +60,49 @@ jobs: C:\libtorch key: ${{ runner.os }}-${{ matrix.target }}-cargo-libtorch-${{ hashFiles('**/Cargo.lock') }}-${{ env.LIBTORCH_VERSION }} - # Linux libtorch setup - - name: Setup libtorch (Linux) + # Linux libtorch setup with explicit linker configuration + - name: Setup libtorch (Linux) - Alternative if: matrix.os == 'ubuntu-latest' run: | - if [ ! -d "/tmp/libtorch" ]; then - sudo apt-get update && sudo apt-get install -y wget unzip build-essential cmake - cd /tmp - wget -q ${{ matrix.libtorch_url }} -O libtorch.zip - unzip -q libtorch.zip - fi - sudo cp -r /tmp/libtorch /usr/local/ || true + sudo apt-get update + sudo apt-get install -y wget unzip build-essential cmake pkg-config + + # Download and extract libtorch + cd /tmp + wget -q ${{ matrix.libtorch_url }} -O libtorch.zip + unzip -q libtorch.zip + + # Move to system location + sudo mv libtorch /usr/local/ + + # Create pkg-config file for libtorch + sudo mkdir -p /usr/local/lib/pkgconfig + sudo tee /usr/local/lib/pkgconfig/libtorch.pc > /dev/null <> $GITHUB_ENV echo "LD_LIBRARY_PATH=/usr/local/libtorch/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV + echo "LIBRARY_PATH=/usr/local/libtorch/lib:$LIBRARY_PATH" >> $GITHUB_ENV + echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV + + # Verify + pkg-config --exists libtorch && echo "pkg-config found libtorch" || echo "pkg-config missing libtorch" + ldconfig -p | grep torch # Windows libtorch setup - name: Setup libtorch (Windows) @@ -91,7 +121,6 @@ jobs: if: matrix.os == 'macos-latest' run: | if [ ! -d "/tmp/libtorch" ]; then - brew install wget cd /tmp wget -q ${{ matrix.libtorch_url }} -O libtorch.zip unzip -q libtorch.zip