Skip to content

Cannot use clang-cl with LTO because MSVC's lib.exe crashes #644

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
nico-abram opened this issue Dec 18, 2021 · 1 comment
Closed

Cannot use clang-cl with LTO because MSVC's lib.exe crashes #644

nico-abram opened this issue Dec 18, 2021 · 1 comment

Comments

@nico-abram
Copy link
Contributor

I'm trying to compile a windows project using the msvc toolchain and cross language LTO. To do this, I'm trying to use clang-cl instead of the MSVC cl.exe to compile the C/C++ code. I'm running into a problem where cc-rs tries to use lib.exe to archive the generated object files, but MSVC's lib.exe does not understand the clang object files with LLVM bitcode for LTO, so it crashes. I'm opening this issue for discussion, ideally I would like a solution like an env var that lets me override the archiver, or identifying clang-cl with LTO and trying to find LLVM-lib (I don't know if rust ships with one, but if not maybe there could be an env var with a path to an installer LLVM/bin).

I also tried to temporarily make a copy of LLVM-lib called lib.exe and put it before lib.exe in my path but it didn't work because cc-rs is finding the specific VS path to lib.exe from the registry.

@nico-abram
Copy link
Contributor Author

I think I just wanted the "AR" env var. My apologies for the useless issue.

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