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

ICE; wrapping a library search path in quotes causes Rust to panic. #23667

Closed
dradtke opened this issue Mar 24, 2015 · 4 comments
Closed

ICE; wrapping a library search path in quotes causes Rust to panic. #23667

dradtke opened this issue Mar 24, 2015 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dradtke
Copy link

dradtke commented Mar 24, 2015

If I set up a Cargo project with a simple build.rs file like this:

fn main() {
    println!("cargo:rustc-link-search=native=\".\"");
}

then I get this compiler error when trying to build:

   Compiling ice-test v0.0.1 (file:///C:/Users/dradtke/carhole/rust/ice-test)
     Running `rustc src\main.rs --crate-name ice-test --crate-type bin -g --out-dir C:\Users\dradtke\carhole\rust\ice-test\target\debug --emit=dep-info,link -L dependency=C:\Users\dradtke\carhole\rust\ice-test\target\debug -L dependency=C:\Users\dradtke\carhole\rust\ice-test\target\debug\deps -L native="."`
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: JoinPathsError { inner: JoinPathsError }', C:/bot/slave/nightly-dist-rustc-win-32/build/src/libcore\result.rs:751

stack backtrace:
   1: 0x6316dc46 - rt::unwind::register::h27ef7cd182e9296cKUI
   2: 0x630c37dc - rt::unwind::begin_unwind_inner::hefe36366e50f3af8URI
   3: 0x630c3b57 - rt::unwind::begin_unwind_fmt::h97d5284c0d9beb8cvQI
   4: 0x6316d920 - rust_begin_unwind
   5: 0x6318aaa8 - panicking::panic_fmt::h6bc794081905f967eXA
   6: 0x6cd602c6 - driver::collect_crate_metadata::h58b83019adfc1339R1a
   7: 0x6cd10f51 - driver::phase_2_configure_and_expand::hfb9ddf7f7541ae2dXsa
   8: 0x6cd01842 - driver::compile_input::hb1aac2c29f5a3486Rba
   9: 0x6cdc3c48 - run_compiler::he240a1462e2271ebv2b
  10: 0x6cdc1aad - run::h34c87f0e8759e7f3b2b
  11: 0x6cdc0e9b - run::h34c87f0e8759e7f3b2b
  12: 0x631623a4 - sys::tcp::TcpListener::bind::hc51fae06b1861148xkH
  13: 0x762e338a - BaseThreadInitThunk
  14: 0x770a9f72 - RtlInitializeExceptionChain

Could not compile `ice-test`.

Caused by:
  Process didn't exit successfully: `rustc src\main.rs --crate-name ice-test --crate-type bin -g --out-dir C:\Users\dradtke\carhole\rust\ice-test\target\debug --emit=dep-info,link -L dependency=C:\Users\dradtke\carhole\rust\ice-test\target\debug -L dependency=C:\Users\dradtke\carhole\rust\ice-test\target\debug\deps -L native="."` (exit code: 101)

Taking out the quotes around the search path fixes the issue and it compiles fine. The example above is contrived, but when I ran into this error, I added the quotes to avoid any possible issues with spaces in the file name, as I'm developing on Windows and that's a common problem.

Rust version:

rustc 1.0.0-nightly (809a554fc 2015-03-23) (built 2015-03-24)
binary: rustc
commit-hash: 809a554fca2d0ebc2ba50077016fe282a4064752
commit-date: 2015-03-23
build-date: 2015-03-24
host: i686-pc-windows-gnu
release: 1.0.0-nightly
@alexcrichton
Copy link
Member

I added the quotes to avoid any possible issues with spaces in the file name, as I'm developing on Windows and that's a common problem

Note that Cargo doesn't interpret quotes this way, the value of a rustc-link-search directive is all remaining bytes up to the \n (newline). So you don't have to worry about escapes or quotes or anything.

@dradtke
Copy link
Author

dradtke commented Mar 24, 2015

That's handy to know, but it would be a good idea to make Cargo output that suggestion or some other error rather than crash. Wrapping library paths in quotes is a common practice on Windows, given the prevalence of folder names like "Program Files" and "Documents and Settings".

@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 26, 2015
@JIghtuse
Copy link
Contributor

Cannot reproduce it. I created a new crate and added build.rs with contents like in description. Builds fine. It probably make sense to check it on Windows.

@Mark-Simulacrum
Copy link
Member

Since @JIghtuse couldn't reproduce, I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants