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