Description
opening here for visibility
original issue here rust-lang/rust-installer#93
if someone passes libdir = "lib/rust-1.x.x"
via config.toml
install.sh misplaces codegen-backends directory, because /lib
path is treated as a special case.
this code here at fault:
https://github.com/rust-lang/rust-installer/blob/5afc0089f282570f2c39b4345d2706bf97e3d84b/install-template.sh#L573-L578
imagine this scenario
part of config.toml
[install]
libdir = "lib/rust-1.34.2"
DESTDIR=/var/tmp/portage/dev-lang/rust-1.34.2/image ./x.py install
install.sh gets "--libdir=/var/tmp/portage/dev-lang/rust-1.34.2/image/usr/lib/rust-1.34.2"
as one of args.
minimal reproducer
#!/bin/sh
CFG_LIBDIR=/var/tmp/portage/dev-lang/rust-1.34.2/image/usr/lib/rust-1.34.2
files=(
lib/rustlib/i686-unknown-linux-gnu/lib/libLLVM-8-rust-1.34.2-stable.so
lib/rust-1.34.2/rustlib/i686-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
lib/libsyntax_pos-3b2f33a4aab1c362.so
)
for _file in ${files[@]}; do
if echo "$_file" | grep "^lib/" > /dev/null; then
_f="$(echo "$_file" | sed 's/^lib\///')"
_file_install_path="$CFG_LIBDIR/$_f"
fi
echo $_file_install_path
done
sh test.sh
/var/tmp/portage/dev-lang/rust-1.34.2/image/usr/lib/rust-1.34.2/rustlib/i686-unknown-linux-gnu/lib/libLLVM-8-rust-1.34.2-stable.so
/var/tmp/portage/dev-lang/rust-1.34.2/image/usr/lib/rust-1.34.2/rust-1.34.2/rustlib/i686-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
/var/tmp/portage/dev-lang/rust-1.34.2/image/usr/lib/rust-1.34.2/libsyntax_pos-3b2f33a4aab1c362.so
so the resulting codegen-backends
gets installed into /usr/lib/rust-1.34.2/rust-1.34.2
it can't be observed on x86_64 hosts because installer replaces lib/
, not for lib64/
this breaks rustc as it can't find librustc_codegen_llvm-llvm.so
until it's moved to proper location.