auto merge of #14832 : alexcrichton/rust/no-rpath, r=brson
This commit disables rustc's emission of rpath attributes into dynamic libraries and executables by default. The functionality is still preserved, but it must now be manually enabled via a `-C rpath` flag. This involved a few changes to the local build system: * --disable-rpath is now the default configure option * Makefiles now prefer our own LD_LIBRARY_PATH over the user's LD_LIBRARY_PATH in order to support building rust with rust already installed. * The compiletest program was taught to correctly pass through the aux dir as a component of LD_LIBRARY_PATH in more situations. The major impact of this change is that neither rustdoc nor rustc will work out-of-the-box in all situations because they are dynamically linked. It must be arranged to ensure that the libraries of a rust installation are part of the LD_LIBRARY_PATH. The default installation paths for all platforms ensure this, but if an installation is in a nonstandard location, then configuration may be necessary. Additionally, for all developers of rustc, it will no longer be possible to run $target/stageN/bin/rustc out-of-the-box. The old behavior can be regained through the `--enable-rpath` option to the configure script. This change brings linux/mac installations in line with windows installations where rpath is not possible. Closes #11747 [breaking-change]
This commit is contained in:
commit
206dd91742
|
@ -418,7 +418,7 @@ opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
|
||||||
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
|
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
|
||||||
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
|
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
|
||||||
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
|
opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
|
||||||
opt rpath 1 "build rpaths into rustc itself"
|
opt rpath 0 "build rpaths into rustc itself"
|
||||||
opt nightly 0 "build nightly packages"
|
opt nightly 0 "build nightly packages"
|
||||||
opt verify-install 1 "verify installed binaries work"
|
opt verify-install 1 "verify installed binaries work"
|
||||||
opt jemalloc 1 "build liballoc with jemalloc"
|
opt jemalloc 1 "build liballoc with jemalloc"
|
||||||
|
|
|
@ -138,8 +138,8 @@ A space-separated list of arguments to pass through to LLVM.
|
||||||
If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
|
If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
|
||||||
throughout compilation in the output directory.
|
throughout compilation in the output directory.
|
||||||
.TP
|
.TP
|
||||||
\fBno-rpath\fR
|
\fBrpath\fR
|
||||||
If specified, then the rpath value for dynamic libraries will not be set in
|
If specified, then the rpath value for dynamic libraries will be set in
|
||||||
either dynamic library or executable outputs.
|
either dynamic library or executable outputs.
|
||||||
.TP
|
.TP
|
||||||
\fBno-prepopulate-passes\fR
|
\fBno-prepopulate-passes\fR
|
||||||
|
|
|
@ -122,8 +122,8 @@ endif
|
||||||
ifdef TRACE
|
ifdef TRACE
|
||||||
CFG_RUSTC_FLAGS += -Z trace
|
CFG_RUSTC_FLAGS += -Z trace
|
||||||
endif
|
endif
|
||||||
ifdef CFG_DISABLE_RPATH
|
ifdef CFG_ENABLE_RPATH
|
||||||
CFG_RUSTC_FLAGS += -C no-rpath
|
CFG_RUSTC_FLAGS += -C rpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The executables crated during this compilation process have no need to include
|
# The executables crated during this compilation process have no need to include
|
||||||
|
|
|
@ -1363,7 +1363,7 @@ fn link_args(cmd: &mut Command,
|
||||||
if sess.targ_cfg.os == abi::OsMacos {
|
if sess.targ_cfg.os == abi::OsMacos {
|
||||||
cmd.args(["-dynamiclib", "-Wl,-dylib"]);
|
cmd.args(["-dynamiclib", "-Wl,-dylib"]);
|
||||||
|
|
||||||
if !sess.opts.cg.no_rpath {
|
if sess.opts.cg.rpath {
|
||||||
let mut v = Vec::from_slice("-Wl,-install_name,@rpath/".as_bytes());
|
let mut v = Vec::from_slice("-Wl,-install_name,@rpath/".as_bytes());
|
||||||
v.push_all(out_filename.filename().unwrap());
|
v.push_all(out_filename.filename().unwrap());
|
||||||
cmd.arg(v.as_slice());
|
cmd.arg(v.as_slice());
|
||||||
|
@ -1382,7 +1382,7 @@ fn link_args(cmd: &mut Command,
|
||||||
// FIXME (#2397): At some point we want to rpath our guesses as to
|
// FIXME (#2397): At some point we want to rpath our guesses as to
|
||||||
// where extern libraries might live, based on the
|
// where extern libraries might live, based on the
|
||||||
// addl_lib_search_paths
|
// addl_lib_search_paths
|
||||||
if !sess.opts.cg.no_rpath {
|
if sess.opts.cg.rpath {
|
||||||
cmd.args(rpath::get_rpath_flags(sess, out_filename).as_slice());
|
cmd.args(rpath::get_rpath_flags(sess, out_filename).as_slice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,8 +306,8 @@ cgoptions!(
|
||||||
"a list of arguments to pass to llvm (space separated)"),
|
"a list of arguments to pass to llvm (space separated)"),
|
||||||
save_temps: bool = (false, parse_bool,
|
save_temps: bool = (false, parse_bool,
|
||||||
"save all temporary output files during compilation"),
|
"save all temporary output files during compilation"),
|
||||||
no_rpath: bool = (false, parse_bool,
|
rpath: bool = (false, parse_bool,
|
||||||
"disables setting the rpath in libs/exes"),
|
"set rpath values in libs/exes"),
|
||||||
no_prepopulate_passes: bool = (false, parse_bool,
|
no_prepopulate_passes: bool = (false, parse_bool,
|
||||||
"don't pre-populate the pass manager with a list of passes"),
|
"don't pre-populate the pass manager with a list of passes"),
|
||||||
no_vectorize_loops: bool = (false, parse_bool,
|
no_vectorize_loops: bool = (false, parse_bool,
|
||||||
|
|
Loading…
Reference in New Issue