Skip to content

Can not use cc in projects located at a path with a space in it on Windows (using msvc) #348

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

Closed
tinco opened this issue Sep 9, 2018 · 6 comments

Comments

@tinco
Copy link

tinco commented Sep 9, 2018

I found this bug whilst trying to compile rustlang/rust on Windows. It crashes because something goes wrong with the prefix for the include directories. In cc-rs it crashes with a slightly different error:

NMAKE : fatal error U1071: cycle in dependency tree for target 'C:\source\a'

This is easily reproduced like so:

cd ..
md -Path "a a"
mv cc-rs "a a"
cd "a a/cc-rs/cc-test"
cargo build

I tried to make a test for this, but I failed, apparently it's not a bug in the way the .include() method works as including paths with a space in it works fine. It must have to do something with the way the project prefix is made or used.

@tinco
Copy link
Author

tinco commented Sep 9, 2018

Related rustlang issue is here: rust-lang/rust#52319

@alexcrichton
Copy link
Member

Thanks for the report! That issue does seems whitespace related yeah but I can't quite tell myself unfortunately what the bug is or how it'd be fixed :(

The issue could also just be with rust-lang/rust and various submodules it builds there, but I'm not so sure.

@alexcrichton
Copy link
Member

I think the issue you're seeing is definitely a bug in cc-rs's own tests, but I don't think it's the same bug that you were seeing in rustc. The issue here is with NMake and spaces-in-paths, which is pretty different from using cc::Build to invoke C/C++ compilers

@tinco
Copy link
Author

tinco commented Sep 10, 2018

I was hoping there's somewhere in cc-rs there's some code that constructs the prefix string, and it does so in a whitespace-bugged way that causes the bug in both nmake and cl.exe. I fixed the other bug, so maybe I'll find some time to look at cc-rs this week if you've got other things to do :)

@alexcrichton
Copy link
Member

Ah unfortunately not that I know of :(

I was under the impression we correctly handled this everywhere...

@alexcrichton
Copy link
Member

I'm going to close this since I think it's just an internal bug in this crate's test suite, and I think we're probably just going to say "that doesn't work", but a PR to fix it is always welcome!

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

2 participants