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