Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

rustc not search LIB path (or LIBPATH) on windows for static library #43118

Closed
BusyJay opened this issue Jul 8, 2017 · 4 comments
Closed

rustc not search LIB path (or LIBPATH) on windows for static library #43118

BusyJay opened this issue Jul 8, 2017 · 4 comments

Comments

@BusyJay
Copy link

BusyJay commented Jul 8, 2017

It works fine when linking dynamic library. But when linking static library it will complains:

could not find native static library xxx, perhaps an -L flag is missing?

Although I have configured LIB and LIBPATH to the correct path.

@retep998
Copy link
Member

retep998 commented Jul 8, 2017

This is a design flaw in how kind=static works, via rustc bundling the library instead of asking the linker to link it. An unstable alternative is kind=static-nobundle which will link to the static library the normal way (tracking issue). Alternatively, just use kind=dylib for static libraries because on Windows the only difference between it and kind=static-nobundle is whether dllimport is applied to the symbols and for functions the linker is pretty lenient with that. Just never use kind=static.

@Mark-Simulacrum
Copy link
Member

Closing as per the previous comment. I believe this is technically not a bug.

@retep998
Copy link
Member

I really wish it was considered a bug, so that the behavior of kind=static could change.

@Mark-Simulacrum
Copy link
Member

Yeah, I agree that the current situation isn't optimal. However, I think any change here would need an RFC anyway...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants