Pregunta

There has to be something I'm missing here. I've set up vcvars64.bat with the environment fine, and compilation and linking almost all of my libraries works great, except for libcmt.lib. (The /MT version of MSVCRT.lib.) This is included with the 32-bit VC 2010, but I'm using cl.exe and link.exe from the amd64 folder that was installed with the Platform SDK 7.1, so I have no idea why it's picking this up.

Here's my command line:

link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\dev\Python31\libs /LIBPATH:C:\dev\Python31\PCbuild\amd64 ws2_32.lib advapi32.lib kernel32.lib /EXPORT:PyInit_winrandom build\temp.win-amd64-3.3\Release\src/winrand.obj /OUT:build\lib.win-amd64-3.3\Crypto\Random\OSRNG\winrandom.pyd /IMPLIB:build\temp.win-amd64-3.3\Release\src\winrandom.lib /MANIFESTFILE:build\temp.win-amd64-3.3\Release\src\winrandom.pyd.manifest /VERBOSE

What I've tried: /nodefaultlib:libcmt causes the linker to not even look at that library. libcmt.lib /nodefaultlib:libcmt in either order just reactivates the same behavior, it still looks in the old wrong path only, as seen in the verbose output:

Searching [SDK]\lib\x64\ws2_32.lib:
Searching [SDK]\lib\x64\advapi32.lib:
Searching [SDK]\lib\x64\kernel32.lib:
Searching [VS]\VC\LIB\libcmt.lib:

My path doesn't have any lib folder on it, and %lib% is "[SDK]\lib\x64;[VS]\VC\LIB" (full paths ommitted).

I don't know why this one lib is being searched on the wrong path first, does anyone know?

¿Fue útil?

Solución

Your LIB environment variable value is wrong, it should be [VC]\lib\amd64 to get the directory that contains the x64 version of the CRT libs.

It's unclear how you got that wrong. You should be using vcvarsall.bat, passing "x64" to select the proper build environment. It in turn calls the proper .bat file, vc\bin\amd64\vcvars64.bat if you passed "x64". Do not use vcvars64.bat directly.

Favor the pre-cooked shortcut that was created when you installed VS. You'll find it in Start + Programs, be sure to pick the one that says "Visual Studio x64 Win64 Command Prompt". It calls vsvarsall.bat

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top