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

Build Script Overrides involving library names with periods in them fail #2786

Closed
qdot opened this issue Jun 17, 2016 · 0 comments
Closed

Build Script Overrides involving library names with periods in them fail #2786

qdot opened this issue Jun 17, 2016 · 0 comments

Comments

@qdot
Copy link

qdot commented Jun 17, 2016

In a project that is trying to use the libusb-sys (https://github.com/dcuddeback/libusb-sys) crate on windows, I was trying to override the usb library requirement since windows doesn't have pkg_config. In libusb-sys, the library is specified as:

links="usb-1.0"

I added the following block to my ~/.cargo/config, escaping as recommended by TOML for table names with periods in them:

[target.x86_64-pc-windows-gnu.'usb-1.0']
rustc-link-search = ["c:\\Users\\qdot\\code\\libusb-1.0"]
rustc-link-lib = ["usb-1.0"]

On trying to build, I got the following error and backtrace

C:\Users\qdot\code\libusb-sys>cargo build --verbose
thread '<main>' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore\option.rs:325
stack backtrace:
   0:           0x9410aa - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
   1:           0x9405e7 - std::panicking::default_hook::hc2c969e7453d080c
   2:           0x90539b - std::panicking::rust_panic_with_hook::hfe203e3083c2b544
   3:           0x9423f5 - std::panicking::begin_panic::h4889569716505182
   4:           0x906ed5 - std::panicking::begin_panic_fmt::h484cd47786497f03
   5:           0x94205c - rust_begin_unwind
   6:           0x956185 - core::panicking::panic_fmt::h257ceb0aa351d801
   7:           0x956c90 - core::panicking::panic::h4bb1497076d04ab9
   8:           0x50f6f1 - cargo::ops::cargo_compile::scrape_target_config::h3ac6edc0324e7a3b
   9:           0x4f82f4 - cargo::ops::cargo_compile::compile_pkg::h48656ffa9b1541f3
  10:           0x4f58c6 - cargo::ops::cargo_compile::compile::h1b43b20047c53d10
  11:           0x419070 - cargo::call_main_without_stdin::hec0ecdd41bac3cd3
  12:           0x40845a - cargo::execute::hab7accd6bf9b5c64
  13:           0x404a79 - cargo::call_main_without_stdin::hf099bd36acb849a3
  14:           0x401a4c - cargo::main::h2b219a79f378c1ef
  15:           0x93fcdc - std::panicking::try::call::hc5e1f5b484ec7f0e
  16:           0x950838 - _rust_maybe_catch_panic
  17:           0x93fad4 - std::rt::lang_start::h61f4934e780b4dfc
  18:           0x4013b4 - _tmainCRTStartup
  19:           0x4014e7 - mainCRTStartup
  20:     0x7fffb14c0403 - mz_zip_writer_add_to_central_dir.constprop.18 

It looks like this may be due to how cargo breaks apart TOML table names then reassembles them to find build override commands, around https://github.com/rust-lang/cargo/blob/5a26b65/src/cargo/ops/cargo_compile.rs#L491-L492

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Jun 17, 2016
If a `links` value has a `.` in the name Cargo would previously panic, but this
alters the code to be more principled about lookup in tables to ensure that we
don't misinterpret the names.

Closes rust-lang#2786
bors added a commit that referenced this issue Jun 17, 2016
Don't re-look-up tables to avoid dots problem

If a `links` value has a `.` in the name Cargo would previously panic, but this
alters the code to be more principled about lookup in tables to ensure that we
don't misinterpret the names.

Closes #2786
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