@@ -211,6 +211,12 @@ fn set_rpath(lib_path: &Path) {
211211 println ! ( "cargo:rustc-link-arg=-Wl,-rpath,@loader_path/../lib" ) ;
212212 }
213213
214+ #[ cfg( target_os = "aix" ) ]
215+ {
216+ // Add default system library paths to avoid breaking standard lookup
217+ println ! ( "cargo:rustc-link-arg=-Wl,-blibpath:{}:/usr/lib:/lib" , path_str) ;
218+ }
219+
214220 #[ cfg( target_os = "windows" ) ]
215221 {
216222 // Windows doesn't use RPATH, but we can inform the user
@@ -227,10 +233,6 @@ pub fn build() {
227233 // Link search path to build folder
228234 println ! ( "cargo:rustc-link-search=native={val}" ) ;
229235
230- // Set RPATH for CMake builds too
231- #[ cfg( not( target_os = "windows" ) ) ]
232- set_rpath ( & PathBuf :: from ( & val) ) ;
233-
234236 // Link against correct version of metacall
235237 match env:: var ( "CMAKE_BUILD_TYPE" ) {
236238 Ok ( val) => {
@@ -254,7 +256,6 @@ pub fn build() {
254256 println ! ( "cargo:rustc-link-lib=dylib={}" , lib_path. library) ;
255257
256258 // Set RPATH so the binary can find libraries at runtime
257- #[ cfg( not( target_os = "windows" ) ) ]
258259 set_rpath ( & lib_path. path ) ;
259260
260261 // Set the runtime environment variable for finding the library during tests
0 commit comments