Skip to content

Commit

Permalink
Print rustc-link-search for the in-tree static openblas before everyt…
Browse files Browse the repository at this point in the history
…hing else

Fixes #60.

The gnu linker searches libraries in the order of -L options and stops
the search when the first matching library is found. This means if
libopenblas.a is either in deriv.make_conf.c_extra_libs.search_path or
in deliv.make_conf.f_extra_libs.search_path, the in-tree libopenblas.a
won't be used.

This patch fixes the issue by printing the rustc-link-search instruction
for the in-tree openblas before everything else.
  • Loading branch information
maoe committed Mar 24, 2021
1 parent 87c6477 commit 1a23b74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion openblas-src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ fn build() {
let source = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("source");
let deliv = cfg.build(&source, &output).unwrap();

println!("cargo:rustc-link-search={}", output.display());
for search_path in &deliv.make_conf.c_extra_libs.search_paths {
println!("cargo:rustc-link-search={}", search_path.display());
}
Expand All @@ -161,7 +162,6 @@ fn build() {
for lib in &deliv.make_conf.f_extra_libs.libs {
println!("cargo:rustc-link-lib={}", lib);
}
println!("cargo:rustc-link-search={}", output.display());
}

/// openblas-src 0.9.0 compatible `make` runner
Expand Down

0 comments on commit 1a23b74

Please # to comment.