Skip to content

Commit

Permalink
Auto merge of #11968 - bzEq:aix-libpath, r=weihanglo
Browse files Browse the repository at this point in the history
fix: AIX searches dynamic libraries in `LIBPATH`.

### What does this PR try to resolve?

On IBM AIX machines people have encountered issues in `compiletest` and rustc's bootstrap builder. They haven't encountered any in cargo. This PR is made for avoiding potential failures in the future in cargo.

It's documented in <https://www.ibm.com/support/pages/libpath-environment-variables-aix-platforms>:

> The `LIBPATH` environment variable tells AIX applications where to find shared libraries when located in a different directories than those specified in the header section of the executable.

See also the counterpart in <rust-lang/rust#109526>

### How to verify and test this in Cargo's CI?

This is indeed an issue. At IBM people are maintaining a buildbot since GitHub Action doesn't support AIX yet.
  • Loading branch information
bors committed May 25, 2023
2 parents 2b3356c + c5ed776 commit d90ff55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/cargo-util/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub fn dylib_path_envvar() -> &'static str {
// penalty starting in 10.13. Cargo's testsuite ran more than twice as
// slow with it on CI.
"DYLD_FALLBACK_LIBRARY_PATH"
} else if cfg!(target_os = "aix") {
"LIBPATH"
} else {
"LD_LIBRARY_PATH"
}
Expand Down
1 change: 1 addition & 0 deletions src/doc/src/reference/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ on the platform:
* Windows: `PATH`
* macOS: `DYLD_FALLBACK_LIBRARY_PATH`
* Unix: `LD_LIBRARY_PATH`
* AIX: `LIBPATH`

The value is extended from the existing value when Cargo starts. macOS has
special consideration where if `DYLD_FALLBACK_LIBRARY_PATH` is not already
Expand Down

0 comments on commit d90ff55

Please sign in to comment.