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

Clippy built from sources couldn't find codegen directory #3565

Closed
o01eg opened this issue Dec 19, 2018 · 2 comments
Closed

Clippy built from sources couldn't find codegen directory #3565

o01eg opened this issue Dec 19, 2018 · 2 comments

Comments

@o01eg
Copy link
Contributor

o01eg commented Dec 19, 2018

While looking for other #2874 solutions found another bug. Compiled with rustc clippy correctly finds codegen folder while built from sources doesn't:

$ RUST_LOG=debug rustc src/driver.rs
...
 INFO 2018-12-19T20:37:40Z: rustc_driver: codegen backend candidate: /usr/lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/codegen-backends
 INFO 2018-12-19T20:37:40Z: rustc_driver: probing /usr/lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/codegen-backends for a codegen backend
...
$ RUST_LOG=debug clippy-driver src/driver.rs
...
 INFO 2018-12-19T20:37:04Z: rustc_driver: codegen backend candidate: /usr/lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/codegen-backends
 INFO 2018-12-19T20:37:04Z: rustc_driver: probing /usr/lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/codegen-backends for a codegen backend
...
$ RUST_LOG=debug ./target/release/clippy-driver src/driver.rs
...
 INFO 2018-12-19T20:36:27Z: rustc_driver: codegen backend candidate: /tmp/rust-clippy/target/lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/codegen-backends
 INFO 2018-12-19T20:36:27Z: rustc_driver: codegen backend candidate: /usr/lib64/lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/codegen-backends
...

rustc config.toml:

[llvm]
optimize = true
release-debuginfo = false
assertions = false
targets = "X86;Mips;NVPTX;BPF;AArch64"
[build]
build = "x86_64-unknown-linux-gnu"
host = ["x86_64-unknown-linux-gnu"]
target = ["x86_64-unknown-linux-gnu"]
docs = false
submodules = false
python = "python2.7"
locked-deps = true
vendor = false
verbose = 2
sanitizers = false
extended = true
tools = ["clippy",]
[install]
prefix = "/usr"
libdir = "lib64/rust-9999"
docdir = "share/doc/rust-9999"
mandir = "share/rust-9999/man"
[rust]
optimize = true
debuginfo = false
debug-assertions = true # false
jemalloc = true
default-linker = "x86_64-pc-linux-gnu-gcc"
rpath = false
ignore-git = false
lld = false
llvm-tools = true
[target.x86_64-unknown-linux-gnu]
cc = "x86_64-pc-linux-gnu-gcc"
cxx = "x86_64-pc-linux-gnu-g++"
linker = "x86_64-pc-linux-gnu-gcc"
ar = "x86_64-pc-linux-gnu-ar"

OS: Gentoo Linux AMD64
Clippy from sources rev: 691e5e7
Rustc rev: rust-lang/rust@e7b4bc3

@o01eg
Copy link
Contributor Author

o01eg commented Dec 20, 2018

When I launch system installed rustc or clippy-driver in the librustc_driver's get_codegen_sysroot happened next:

  1. filesearch::get_or_default_sysroot gets current binary /usr/bin/clippy-driver-9999 and gets sysroot /usr from it.
  2. then it concatenates sysroot with relative libdir from filesearch::relative_target_lib_path lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/lib and replace last element with codegen-backends
    Correct codegen /usr/lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/codegen-backends folder found.

When I launch ./target/release/clippy-driver from /tmp/rust-clippy in won't work:

  1. filesearch::get_or_default_sysroot gets current binary /tmp/rust-clippy/target/release/clippy-driver and gets sysroot /tmp/rust-clippy/target from it.
  2. then it concatenates sysroot with relative libdir from filesearch::relative_target_lib_path lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/lib and replace last element with codegen-backends
    /tmp/rust-clippy/target/lib64/rust-9999/rustlib/x86_64-unknown-linux-gnu/codegen-backends isn't correct folder.
    But also it tries /usr/lib64 sysroot which also incorrect.

@o01eg
Copy link
Contributor Author

o01eg commented Dec 20, 2018

Looks like it's a rustc issue: rust-lang/rust#57014

@o01eg o01eg closed this as completed Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant