Skip to content
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

install.sh miplaces codegen-backends directory with libdir = "/lib/something" #62496

Closed
gyakovlev opened this issue Jul 8, 2019 · 0 comments · Fixed by #62497
Closed

install.sh miplaces codegen-backends directory with libdir = "/lib/something" #62496

gyakovlev opened this issue Jul 8, 2019 · 0 comments · Fixed by #62497
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@gyakovlev
Copy link

gyakovlev commented Jul 8, 2019

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.

bors added a commit that referenced this issue Jul 9, 2019
Fix double resolving custom libdir

Fixes #62496

Related issue is https://bugs.gentoo.org/672816
@jonas-schievink jonas-schievink added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-bug Category: This is a bug. labels Aug 6, 2019
@bors bors closed this as completed in 4593f40 Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants