-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Module Type 'X86' conflicts with machine type 'X64' #43468
Comments
|
This is not a Rust bug per se. Maybe the situation can be detected by cargo to produce a better error message. Having some sort of FAQ for common pitfalls like this in the installation section of the website might be a good idea as well. |
Some VS Code C++ tutorials encourage starting "code" from the developer command prompt. I faced the LNK1112 issue, and it turned out I had accidentally started VS Code using the 32-bit developer command prompt (alas still the default). Starting VS Code from a 64-bit prompt, or simply from the Windows Start Menu, removed the issue. |
I had the same issue when running the rust compiler on Developer Command Prompt for VS 2019:
It also left a number of temporary files on disk: Running |
In regular Windows PowerShell without path tweaks for Visual Studio, Unfortunately, the launchers named Developer PowerShell and Developer Command Prompt for VS 2019 set up the command path for x86 tools. Perhaps it would be better for cargo to ignore the PATH-located executable on Windows if the registry-resolved tools directory appropriate for the target platform contains the executable file. |
I am a "installed Rust today to try it out" user but also .Net veteran, which is why this same issue tripped me up today I guess... Is it possible to add a note about this Developer Command Prompt path issue to the https://www.rust-lang.org/tools/install Notes - Configuring the PATH environment variable - section? |
Recent commits to cc have helped to address rust-lang#83043 and rust-lang#43468
Update cc Recent commits have improved `cc`'s finding of MSVC tools on Windows. In particular it should help to address these issues: rust-lang#83043 and rust-lang#43468
Update cc Recent commits have improved `cc`'s finding of MSVC tools on Windows. In particular it should help to address these issues: rust-lang#83043 and rust-lang#43468
Update cc Recent commits have improved `cc`'s finding of MSVC tools on Windows. In particular it should help to address these issues: rust-lang#83043 and rust-lang#43468
I had the same problem doing a cbindgen install today. I'm just past the "hello world" stage, and preparing to use RUST to build libraries/DLLs that I would call from C/C++ code. |
Hopefully this should be fixed in the next version of Rust (1.54). Usually Rust can automatically find the right libraries to use but the problem here is that the developer powershell, by default, puts the x86 libraries and linker in environment variables where as Rust is compiling for x64. So Rust needs some way to know they're wrong and that it should go looking for the right ones. Which is what it should do in the future. In the meantime, as you say, you can use the generic powershell. Rust will then go find the right libraries. Or if you're adventurous you can try typing this magic in the developer powershell:
|
Yeah I dug in and discovered that the link I had read about using the Visual Studio command shell explicitly called for the X64 variant.
I have so many versions of VS2019 installed, and so many command line options, murphys law dictates I would have selected the x86 variant. Once I saw the x86 vs x64 in the link errors it “pinged” something in my head.
After that I was able to get where I was going.
I also spent a bit more time learning about cargo manifest files, today which was helpful.
Thank you!
From: ChrisDenton ***@***.***>
Sent: Tuesday, June 29, 2021 1:38 PM
To: rust-lang/rust ***@***.***>
Cc: Ross Youngblood ***@***.***>; Comment ***@***.***>
Subject: Re: [rust-lang/rust] Module Type 'X86' conflicts with machine type 'X64' (#43468)
CAUTION - EXTERNAL EMAIL: Do not open attachments or links unless you recognize the sender and the content is safe.
Hopefully this should be fixed in the next version of Rust (1.54).
Usually Rust can automatically find the right libraries to use but the problem here is that the developer powershell, by default, puts the x86 libraries and linker in environment variables where as Rust is compiling for x64. So Rust needs some way to know they're wrong and that it should go looking for the right ones. Which is what it should do in the future.
In the meantime, as you say, you can use the generic powershell. Rust will the find the right libraries. Or if you're adventurous you can try typing this magic in the developer powershell:
Enter-VsDevShell 5f39cdd0 -DevCmdArguments "-arch=amd64 -no_logo"
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub [github.com]<https://urldefense.com/v3/__https:/github.com/rust-lang/rust/issues/43468*issuecomment-870899410__;Iw!!GenOTVeOfQ!FmFVzau9mYn1qLjHr70cnEs1jBFs8Tg-RdGpXez1zsPDlj95vaxXd-EqmA8-J3WaiCaI8w$>, or unsubscribe [github.com]<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AO2FYYCNMWUEONE6VCBY7NTTVIVJFANCNFSM4DUIH5NA__;!!GenOTVeOfQ!FmFVzau9mYn1qLjHr70cnEs1jBFs8Tg-RdGpXez1zsPDlj95vaxXd-EqmA8-J3VSlYHIkg$>.
…________________________________
Please note that this message may contain confidential information. If you have received this message by mistake, please inform the sender of the mistake, then delete the message from your system without making, distributing or retaining any copies of it. Although we believe that the message and any attachments are free from viruses and other errors that might affect the computer or IT system where it is received and read, the recipient opens the message at his or her own risk. We assume no responsibility for any loss or damage arising from the receipt or use of this message. When we process personal data relating to physical persons, such processing will meet the requirements of applicable data protection legislation and will be in accordance with our Privacy Policy.<https://www.teradyne.com/privacy-statement>
|
Using a custom Windows container that contains Visual Studio 2015 Enterprise Update 3 full installation, Windows 10 SDK full installation on a X64 base OS.
Compiling a simple HelloWorld.rs program with no dependencies etc.
I get the following error.
Is there a specific flag I have to pass in? I did run the vsvars32.bat batch file to set the appropriate environment variables for VC.
The text was updated successfully, but these errors were encountered: