-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look for crates in LIBDIR, provided by --libdir option #16552
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -550,9 +550,19 @@ CFG_LIBDIR_RELATIVE=lib | |
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] | ||
then | ||
CFG_LIBDIR_RELATIVE=bin | ||
fi | ||
CFG_LIBDIR="${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" | ||
else | ||
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries (ignored on windows platform)" | ||
|
||
case "$CFG_LIBDIR" in | ||
"$CFG_PREFIX"/*) CAT_INC=2;; | ||
"$CFG_PREFIX"*) CAT_INC=1;; | ||
*) | ||
err "libdir must begin with the prefix. Use --prefix to set it accordingly.";; | ||
esac | ||
|
||
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries" | ||
CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-` | ||
fi | ||
|
||
if [ $HELP -eq 1 ] | ||
then | ||
|
@@ -989,6 +999,15 @@ for h in $CFG_HOST | |
do | ||
for t in $CFG_TARGET | ||
do | ||
# host lib dir stage0 | ||
make_dir $h/stage0/lib | ||
|
||
# target bin dir stage0 | ||
make_dir $h/stage0/lib/rustlib/$t/bin | ||
|
||
# target lib dir stage0 | ||
make_dir $h/stage0/lib/rustlib/$t/lib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The stage0 windows binaries depend on the relative libdir being There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove --libdir support for windows. They probably do not need this, as anyway they have problems with LD_LIBRARY_PATH. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This make_dir is not relevant for windows as it only create directories, so it can stay as is. |
||
|
||
for i in 0 1 2 3 | ||
do | ||
# host bin dir | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,7 +332,15 @@ define SREQ | |
# Destinations of artifacts for the host compiler | ||
HROOT$(1)_H_$(3) = $(3)/stage$(1) | ||
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin | ||
ifeq ($$(CFG_WINDOWSY_$(3)),1) | ||
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE) | ||
else | ||
ifeq ($(1),0) | ||
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib | ||
else | ||
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE) | ||
endif | ||
endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be simplified by using:
|
||
|
||
# Destinations of artifacts for target architectures | ||
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -301,9 +301,16 @@ fi | |
flag uninstall "only uninstall from the installation prefix" | ||
opt verify 1 "verify that the installed binaries run correctly" | ||
valopt prefix "/usr/local" "set installation prefix" | ||
# NB This isn't quite the same definition as in `configure`. | ||
# just using 'lib' instead of CFG_LIBDIR_RELATIVE | ||
# NB This is exactly the same definition as in `configure`. | ||
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries" | ||
case "$CFG_LIBDIR" in | ||
"$CFG_PREFIX"/*) CAT_INC=2;; | ||
"$CFG_PREFIX"*) CAT_INC=1;; | ||
*) | ||
err "libdir must begin with the prefix. Use --prefix to set it accordingly.";; | ||
esac | ||
CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that rust will work by default if you pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With these my changes it works. It was the aim of this changeset. ) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Of course you need to add your new libdir to LD_LIBRARY_PATH, but if one provides --libdir, he usually does this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem arises when rust is configured with one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should not be done this way. libdir from configure should be used during installation. Otherwise it will be for sure broken. install.sh parameters are passed by make, not by user. and make takes it from configuration. I see no reason for user try to somehow use different libdirs in configuration and installation. And in my changes libdir is relative, so copying of the whole tree with compiler will work, if you would wondering about it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here when I say libdir I mean relative path, not the absolute. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is not the only way to install rust, you are expected to use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the current implementation this will not work at all. It means even if user uses the same libdir during configure and install, rust will not work with it different from 'lib'. So this feature is already broken. And I think it is not sane to change such things during install, not during configure, so we probably should somehow fix it, so user can not change libdir during installation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the feature is currently broken, and my point is that this commit looks like it's trying to solve it (by closing #11671). This specific commit does not close that issue as this is precisely what it's talking about. Regardless of whether you feel it's sane or not, it's what the issue is talking about, so this commit cannot close it out. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, but I see in original issue (#11671), that rust was configured with --libdir. And installed with the same --libdir. Or am I wrong? Where is it written that --libdir has been changed between configure and install? May be I has not seen it, so if you can, please, point me to the place where it is stated. |
||
|
||
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" | ||
|
||
if [ $HELP -eq 1 ] | ||
|
@@ -428,9 +435,9 @@ while read p; do | |
# Decide the destination of the file | ||
FILE_INSTALL_PATH="${CFG_PREFIX}/$p" | ||
|
||
if echo "$p" | grep "^lib/" > /dev/null | ||
if echo "$p" | grep "^${CFG_LIBDIR_RELATIVE}/" > /dev/null | ||
then | ||
pp=`echo $p | sed 's/^lib\///'` | ||
pp=`echo $p | sed "s%^${CFG_LIBDIR_RELATIVE}/%%"` | ||
FILE_INSTALL_PATH="${CFG_LIBDIR}/$pp" | ||
fi | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,11 +255,16 @@ fn find_libdir(sysroot: &Path) -> String { | |
// to lib64/lib32. This would be more foolproof by basing the sysroot off | ||
// of the directory where librustc is located, rather than where the rustc | ||
// binary is. | ||
|
||
if sysroot.join(primary_libdir_name()).join(rustlibdir()).exists() { | ||
return primary_libdir_name(); | ||
} else { | ||
return secondary_libdir_name(); | ||
//If --libdir is set during configuration to the value other than | ||
// "lib" (i.e. non-default), this value is used (see issue #16552). | ||
|
||
match option_env!("CFG_LIBDIR_RELATIVE") { | ||
Some(libdir) if libdir != "lib" => return libdir.to_string(), | ||
_ => if sysroot.join(primary_libdir_name()).join(rustlibdir()).exists() { | ||
return primary_libdir_name(); | ||
} else { | ||
return secondary_libdir_name(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may not be quite right because this environment variable is always set during a normal There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ack sorry about that! I was skimming too quickly :(. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. np. ) What I really would ask you to do -- test it on windows if you have no other complains. As I am really not sure whether I did not break something on this system. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just always ensure CFG_LIBDIR_RELATIVE is set an use it? This allows us to move the defaults out of rustc and keep them all in configure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reasoning is the same as this comment I believe (I'll reply in a just a bit). |
||
} | ||
|
||
#[cfg(target_word_size = "64")] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not ignore options based on the detected OSTYPE. What's keeping us from calculating the relative directory for windows builds the same way it's calculated for other builds, and just supply a different default CFG_LIBDIR_RELATIVE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this comment for some more info, but the gist is that our windows installation process wants dlls in the same dirs as the bins. In general I suspect that windows users rarely want this level of configuration anyway, so it's probably not too bad.