File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555env :
5656 RUST_VERSION : stable
5757 RUST_BACKTRACE : 1
58+ # Force GNU ld on Linux: recent Rust stable defaults to rust-lld on
59+ # x86_64-unknown-linux-gnu, and rust-lld cannot resolve -ljvm against the
60+ # Zulu JDK layout installed by setup-java. Keep bfd for all cargo invocations.
61+ RUSTFLAGS : " -Clink-arg=-fuse-ld=bfd"
5862
5963jobs :
6064 # Build native library once and share with all test jobs
8892 run : |
8993 cd native && cargo build --profile ci
9094 env :
91- RUSTFLAGS : " -Ctarget-cpu=x86-64-v3"
95+ RUSTFLAGS : " -Ctarget-cpu=x86-64-v3 -Clink-arg=-fuse-ld=bfd "
9296
9397 - name : Save Cargo cache
9498 uses : actions/cache/save@v5
Original file line number Diff line number Diff line change 4949env :
5050 RUST_VERSION : stable
5151 RUST_BACKTRACE : 1
52+ # Force GNU ld on Linux: recent Rust stable defaults to rust-lld on
53+ # x86_64-unknown-linux-gnu, and rust-lld cannot resolve -ljvm against the
54+ # Zulu JDK layout installed by setup-java. Keep bfd for all cargo invocations.
55+ RUSTFLAGS : " -Clink-arg=-fuse-ld=bfd"
5256
5357jobs :
5458
@@ -166,7 +170,7 @@ jobs:
166170 # (no LTO, parallel codegen)
167171 cargo build --profile ci
168172 env :
169- RUSTFLAGS : " -Ctarget-cpu=x86-64-v3"
173+ RUSTFLAGS : " -Ctarget-cpu=x86-64-v3 -Clink-arg=-fuse-ld=bfd "
170174
171175 - name : Upload native library
172176 uses : actions/upload-artifact@v7
Original file line number Diff line number Diff line change 8989 ~/.cargo/registry
9090 ~/.cargo/git
9191 native/target
92- key : ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}-${{ hashFiles('native/**/*.rs') }}
92+ key : ${{ runner.os }}-cargo-ci-v2- ${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}-${{ hashFiles('native/**/*.rs') }}
9393 restore-keys : |
94- ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}-
94+ ${{ runner.os }}-cargo-ci-v2- ${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}-
9595
9696 - name : Build native library (CI profile)
9797 run : |
@@ -117,7 +117,7 @@ jobs:
117117 ~/.cargo/registry
118118 ~/.cargo/git
119119 native/target
120- key : ${{ runner.os }}-cargo-ci-${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}-${{ hashFiles('native/**/*.rs') }}
120+ key : ${{ runner.os }}-cargo-ci-v2- ${{ hashFiles('native/**/Cargo.lock', 'native/**/Cargo.toml') }}-${{ hashFiles('native/**/*.rs') }}
121121
122122 macos-aarch64-test :
123123 needs : build-native
Original file line number Diff line number Diff line change 6161env :
6262 RUST_VERSION : stable
6363 RUST_BACKTRACE : 1
64+ # Force GNU ld on Linux: recent Rust stable defaults to rust-lld on
65+ # x86_64-unknown-linux-gnu, and rust-lld cannot resolve -ljvm against the
66+ # Zulu JDK layout installed by setup-java. Keep bfd for all cargo invocations.
67+ RUSTFLAGS : " -Clink-arg=-fuse-ld=bfd"
6468
6569jobs :
6670
9599 cd native
96100 cargo build --profile ci
97101 env :
98- RUSTFLAGS : " -Ctarget-cpu=x86-64-v3"
102+ RUSTFLAGS : " -Ctarget-cpu=x86-64-v3 -Clink-arg=-fuse-ld=bfd "
99103
100104 - name : Upload native library
101105 uses : actions/upload-artifact@v7
Original file line number Diff line number Diff line change @@ -120,6 +120,12 @@ fn get_build_flags() -> Vec<String> {
120120fn get_java_dependency ( ) -> Vec < String > {
121121 let mut result = vec ! [ ] ;
122122
123+ // Re-run when the JDK changes. The resolved jvm_lib_location below is
124+ // baked into the crate's link args, so a cache restored against a previous
125+ // JDK install (e.g. CI runners where setup-java floats Zulu patch
126+ // versions) would otherwise hand the linker -L paths that no longer exist.
127+ println ! ( "cargo:rerun-if-env-changed=JAVA_HOME" ) ;
128+
123129 // Include directories
124130 let java_home = java_locator:: locate_java_home ( )
125131 . expect ( "JAVA_HOME could not be found, trying setting the variable manually" ) ;
You can’t perform that action at this time.
0 commit comments