@@ -3583,13 +3583,18 @@ impl<'test> TestCx<'test> {
3583
3583
debug ! ( ?support_lib_deps_deps) ;
3584
3584
3585
3585
// FIXME(jieyouxu): explain what the hecc we are doing here.
3586
- let orig_dylib_env_paths =
3586
+
3587
+ // This is the base dynamic library search paths that was made available to compiletest.
3588
+ let base_dylib_search_paths =
3587
3589
Vec :: from_iter ( env:: split_paths ( & env:: var ( dylib_env_var ( ) ) . unwrap ( ) ) ) ;
3588
3590
3589
- let mut host_dylib_env_paths = Vec :: new ( ) ;
3590
- host_dylib_env_paths. push ( self . config . compile_lib_path . clone ( ) ) ;
3591
- host_dylib_env_paths. extend ( orig_dylib_env_paths. iter ( ) . cloned ( ) ) ;
3592
- let host_dylib_env_paths = env:: join_paths ( host_dylib_env_paths) . unwrap ( ) ;
3591
+ // We add in `self.config.compile_lib_path` which are the libraries needed to run the
3592
+ // host compiler.
3593
+ let host_dylib_search_paths = {
3594
+ let mut paths = vec ! [ self . config. compile_lib_path. clone( ) ] ;
3595
+ paths. extend ( base_dylib_search_paths. iter ( ) . cloned ( ) ) ;
3596
+ paths
3597
+ } ;
3593
3598
3594
3599
// Finally, we need to run the recipe binary to build and run the actual tests.
3595
3600
// FIXME(jieyouxu): use `std::env::consts::EXE_EXTENSION`.
@@ -3617,7 +3622,7 @@ impl<'test> TestCx<'test> {
3617
3622
. env ( "RUST_BUILD_STAGE" , & self . config . stage_id )
3618
3623
. env ( "RUSTC" , & self . config . rustc_path )
3619
3624
. env ( "LD_LIB_PATH_ENVVAR" , dylib_env_var ( ) )
3620
- . env ( dylib_env_var ( ) , & host_dylib_env_paths )
3625
+ . env ( dylib_env_var ( ) , & env :: join_paths ( host_dylib_search_paths ) . unwrap ( ) )
3621
3626
. env ( "HOST_RPATH_DIR" , & self . config . compile_lib_path )
3622
3627
. env ( "TARGET_RPATH_DIR" , & self . config . run_lib_path )
3623
3628
. env ( "LLVM_COMPONENTS" , & self . config . llvm_components ) ;
@@ -3648,16 +3653,19 @@ impl<'test> TestCx<'test> {
3648
3653
stage_std_path. push ( "lib" ) ;
3649
3654
3650
3655
// FIXME(jieyouxu): explain what the hecc we are doing here.
3651
- let mut dylib_env_paths = orig_dylib_env_paths. clone ( ) ;
3652
- dylib_env_paths. push ( support_lib_path. parent ( ) . unwrap ( ) . to_path_buf ( ) ) ;
3653
- dylib_env_paths. push ( stage_std_path. join ( "rustlib" ) . join ( & self . config . host ) . join ( "lib" ) ) ;
3654
- let dylib_env_paths = env:: join_paths ( dylib_env_paths) . unwrap ( ) ;
3656
+ let recipe_dylib_search_paths = {
3657
+ let mut paths = base_dylib_search_paths. clone ( ) ;
3658
+ paths. push ( support_lib_path. parent ( ) . unwrap ( ) . to_path_buf ( ) ) ;
3659
+ paths. push ( stage_std_path. join ( "rustlib" ) . join ( & self . config . host ) . join ( "lib" ) ) ;
3660
+ paths
3661
+ } ;
3655
3662
3656
3663
// FIXME(jieyouxu): explain what the hecc we are doing here.
3657
- let mut target_rpath_env_path = Vec :: new ( ) ;
3658
- target_rpath_env_path. push ( & rmake_out_dir) ;
3659
- target_rpath_env_path. extend ( & orig_dylib_env_paths) ;
3660
- let target_rpath_env_path = env:: join_paths ( target_rpath_env_path) . unwrap ( ) ;
3664
+ let target_rpaths = {
3665
+ let mut paths = vec ! [ rmake_out_dir. clone( ) ] ;
3666
+ paths. extend ( base_dylib_search_paths. iter ( ) . cloned ( ) ) ;
3667
+ paths
3668
+ } ;
3661
3669
3662
3670
// FIXME(jieyouxu): explain what the hecc we are doing here.
3663
3671
// FIXME(jieyouxu): audit these env vars. some of them only makes sense for make, not rustc!
@@ -3666,8 +3674,8 @@ impl<'test> TestCx<'test> {
3666
3674
. stdout ( Stdio :: piped ( ) )
3667
3675
. stderr ( Stdio :: piped ( ) )
3668
3676
. env ( "LD_LIB_PATH_ENVVAR" , dylib_env_var ( ) )
3669
- . env ( "TARGET_RPATH_ENV" , & target_rpath_env_path )
3670
- . env ( dylib_env_var ( ) , & dylib_env_paths )
3677
+ . env ( "TARGET_RPATH_ENV" , & env :: join_paths ( target_rpaths ) . unwrap ( ) )
3678
+ . env ( dylib_env_var ( ) , & env :: join_paths ( recipe_dylib_search_paths ) . unwrap ( ) )
3671
3679
. env ( "TARGET" , & self . config . target )
3672
3680
. env ( "PYTHON" , & self . config . python )
3673
3681
. env ( "SOURCE_ROOT" , & source_root)
0 commit comments