I am trying to get CMAKE to create a project for msvc 10 express edition for x64 architecture. I have both MSVC 2010 Express and Windows SDK 7.1 installed.
If I start CMake Normally I can create a 32 bit project, however it fails to make a 64 bit project. I have also Tried starting CMAKE from within the Windows SDK Command Prompt (cl cmd maps to x64 version) however It still fails with the following.
Found Windows SDK v7.1: C:\Program Files\Microsoft SDKs\Windows\v7.1\
Check for working C compiler using: Visual Studio 10 Win64
Check for working C compiler using: Visual Studio 10 Win64 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "c:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/amd64/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Dan/Desktop/pclt/PCL/bin/CMakeFiles/CMakeTmp
Run Build Command:C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
cmTryCompileExec1400574213.vcxproj /p:Configuration=Debug
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.296]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 1/14/2013 8:15:59 AM.
Project
"C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
on node 1 (default targets).
PrepareForBuild:
Creating directory "cmTryCompileExec1400574213.dir\Debug\".
Creating directory "C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\Debug\".
InitializeBuildStatus:
Creating "cmTryCompileExec1400574213.dir\Debug\cmTryCompileExec1400574213.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec1400574213.dir\Debug\\" /Fd"C:/Users/Dan/Desktop/pclt/PCL/bin/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec1400574213.pdb" /Gd /TC /errorReport:queue C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\testCCompiler.c /Zm1000 /GZ
C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(146,5):
error : Required file "" is missing.
[C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj]
Done Building Project
"C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
(default targets) -- FAILED.
Build FAILED.
"C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj"
(default target) (1) ->
(ClCompile target) ->
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(146,5): error : Required file "" is missing. [C:\Users\Dan\Desktop\pclt\PCL\bin\CMakeFiles\CMakeTmp\cmTryCompileExec1400574213.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.12
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)
Configuring incomplete, errors occurred!
I found that my x64 compilers were destroyed by installing SP 1. Try this update to restore them :
http://www.microsoft.com/en-us/download/details.aspx?id=4422
I had similar issues on Win7, and was getting the same error - The C compiler "cl.exe" is not able to compile a simple test program.
The solution that worked for me :
On Windows Donot run cmake on the cygwin terminal.
Run it from the command prompt, AND also ensure that you have admin rights,
In windows 7 you can start command prompt as administrator by going to
Start->All programs->Accessories-> (Right Click on Command Prompt) and Select "Run as administrator"
Then run cmake <your source>
Worked like a charm for me.
Related
I know that libc++ support for Windows is experimental but it still can be built, right? I installed latest MSVC Build Tools, installed official clang binaries and successfully built the library.
When I ask clang to use libc++ headers it still keeps searching for urct headers or some internal MSVC headers:
....... C:/Program Files (x86)/libcxx/include/c++/v1\\errno.h
........ C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\ucrt\\errno.h
or
.... C:/Program Files (x86)/libcxx/include/c++/v1\\new
..... C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\ucrt\\new.h
...... C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\include\\vcruntime_new_debug.h
....... C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\include\\vcruntime_new.h
...... C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\include\\crtdefs.h
It compiles successfully but fails to link with undefined references to almost everything (tries to link libc++.lib). But if I don't specify headers it uses MSVC headers and builds successfully with -defaultlib=libcmt. Can I build it to work independently of MSVC or at least what am I doing wrong with using libc++ headers?
I installed both VS2015 and VS2017. For a cmake project, I want to use cmake to generate a vs2015 project (platform toolset v140).
I Opened the Developer Command Prompt for VS2015 then I ran cmake there.
But from the output and also the result sln file, I see it's still using vs2017 (v141) platform toolset.
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.16.27027.1
-- The CXX compiler identification is MSVC 19.16.27027.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
Please see the screenshot here:
cmake vs2015
So, how to I force cmake to use vs2015?
This is what the -T option is for:
-T Specify toolset name if supported by generator.
Some CMake generators support a toolset name to be given to the native
build system to choose a compiler. See the CMAKE_GENERATOR_TOOLSET
variable. This is supported only on specific generators:
Visual Studio Generators for VS 2010 and above The Xcode generator for
Xcode 3.0 and above See native build system documentation for allowed
toolset names.
cmake -G "Visual Studio 15 2017" -T v140
(Note that the generator names for Visual Studio changed between CMake 3.13 and 3.14)
This will generate a Visual Studio 2017 solution, using the 2015 compiler and toolchain. So opening the solution will open VS 2017, but the code will compile with the 2015 toolchain.
If you want to use the 2015 IDE instead, you use the 2015 generator and leave out the -T parameter.
Note that you can also install the v140 toolchain as part of a VS2017 installation, so if you don't plan on using the older IDE, there is really no reason for keeping the VS2015 installation around.
cmake -G "Visual Studio 14 2015"
make sure Windows SDK version 10.0.10586.0 is istalled.
to see a list of the generators, run cmake --help
I have the following error on fresh windows 8 install with microsoft visual studio ultimate 2013 :
cl : Command line error D8050 : cannot execute 'C:\Program Files (x86)\Microsoft
Visual Studio 12.0\VC\BIN\amd64\c1xx.dll': failed to get command line into debu
g records
The weird thing is that trying to compile in an admin cmd is working....
I tried to change ownership/rights of the VS12 folder but it changes nothing.
cl /Fobin\x64\Release\file.obj /c src\file.cpp
/TP /nologo /MP /GS /W4 /wd4800 /wd4138 /wd4530 /wd4512 /wd4996 /wd4251
/wd4661 /wd4505 /WX- /Gd /Zi /Gm- /Zc:wchar_t /errorReport:prompt /Zc:forScope
/Fplibvideostitch.pch /FS /Fdvc120.pdb /fp:precise /GL /O2 /Oy- /Oi /MD /Ot
/DWIN32 /D_USE_MATH_DEFINES /D_WINDLL /DNOMINMAX /D_CONSOLE /DNDEBUG
"/IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include"
I had this issue with a cleared environment, and it was resolved (at least in part) by setting the TMP environment variable.
I ran into this error after I cleaned up my C drive (deleted temporary files of all sorts). I was able to fix it by re-setting the environment variables for Visual C++ command-line tools. This page was my reference.
I was building 64 bit.
Run cmd as admin.
c:\>cd YourVSInstallDir\VC
c:\YourVSInstallDir\VC>vcvarsall.bat amd64
I had my %TEMP% and %TMP% vars pointing to a directory that contained a $. Replacing it with an _ solved the issue for me.
Rebooting fixed it for me!
I encountered this issue after a build failed due to running out of disk space. After clearing a lot of space, any subsequent build attempts failed with the D8050 error. Failing to come up with any better solution, I decided to give the age-old "fix" to all Windows problems: rebooting the system. And it worked! My guess is that some temporary setting was stuck in the wrong state, and rebooting cleared it up.
I want to use nvcc -ptx from windows command line, but I always get this error message:
nvcc : fatal error : Microsoft Visual Studio configuration file 'vcvars64.bat' could not be found for installation at 'C:\Program Files (x86)\Microsoft Visual S
tudio 11.0\VC\bin/../..'
I'm using vs 2012 express edition. What can be the solution?
I have managed to solve the issue and make work with MS Visual Studio Express 2012, here what I did:
Installed MS Visual Studio 2012 Express
Installed cuda_5.5.20_winvista_win7_win8_general_64, the latest version as of 2014-01-16
From this directory: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin, I have copied x86_amd64 to amd64
In the new directory: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64, I have created a file vcvars64.bat
In the file vcvars64.bat, just added: CALL setenv /x64
The compilation worked great:
C:\CUDA>nvcc -o square square.cu
Creating library square.lib and object square.exp
C:\CUDA>square.exe
0.000000 1.000000 4.000000 9.000000
16.000000 25.000000 36.000000 49.000000
64.000000 81.000000 100.000000 121.000000
144.000000 169.000000 196.000000 225.000000
From NVIDIA CUDA Compiler Driver document
1.2. Supported Host Compilers
nvcc uses the following compilers for host code compilation:
On Linux platforms
The GNU compiler, gcc, and arm-linux-gnueabihf-g++ for cross compilation to the ARMv7
architecture
On Windows platforms
The Microsoft Visual Studio compiler, cl On both platforms, the compiler found on the current
execution search path will be used, unless nvcc option -compiler-bindir is specified (see File and Path Specifications).
Your visual studio install is asking for .NET v3.5 framework:
http://www.microsoft.com/en-us/download/details.aspx?id=21
Got this info from this: Where can I find Microsoft.Build.Utilities.v3.5
When in your project go to Configuration Properties > CUDA C/C++ > Device and change Code Generation to the following: compute_11,sm_11
My compile environment is windows xp and vc 6.0.
Now I have a c source file(msgRout.c), def file(msgRout.def), link file(msgRout.link), then I use commands below to get a 32 bit dll:
1.cl /I ../include -c -W3 -Gs- -Z7 -Od -nologo -LD -D_X86_=1 -DWIN32 -D_WIN32 -D_MT -D_DLL msgRout.c
2.lib -out:msgRout.lib -def:msgRout.def -machine:i386
3.link /LIBPATH:../../Lib -nod -nologo -debug:full -dll #msgRout.link -out:msgRout.dll
But the dll I got cannot be loaded on X64 application. it required a 64 bit dll.
So here is my question:
Can I get a 64 bit dll with vc 6.0?
Using only above 3 commands alike, how can I get 64 bit dll?
Many GREAT THANKS!!!
Allan
Visual C++ 6.0 does not include 64-bit compiler/libraries. You will need either a more recent version of Visual C++ or a Windows Platform SDK that has the 64-bit support. The earliest one is the Windows Server 2003 Platform SDK.
Once you have that installed, cl /? and link /? will have info on how to build 64-bit apps.
Update: If you have VS2005, you can build 64-bit binaries with the x86-amd64 cross-compiler (a 32-bit cl.exe that produces 64-bit code) or with the x64 compiler (a 64-bit cl.exe). To do that, you need to:
Make sure you've installed the 64-bit tools support during VS installation.
Open a command line and set it for x86-amd64 builds using C:\Program Files\Microsoft Visual Studio 8\VC\Vcvarsall.bat x86_amd64 or
(on 64-bit Windows) Open an x64 command line and set it for 64-bit builds using C:\Program Files\Microsoft Visual Studio 8\VC\Vcvarsall.bat amd64.
Once you do that, you should be able to use the same command line as above (with tcouple small changes - for cl you'll have to define /D:X64=1 or /D_AMD64_ and for link you'll have to change the /machine:x86 to /machine:x64) to produce 64-bit version of your program.
Here are some links with more information:
Installing Visual Studio 64-bit Components
HowTo: Enable a 64-Bit Visual C++ Toolset at the Command Line
Use Visual Studio to build 64-bit application
64-bit Applications
Seven Steps of Migrating a Program to a 64-bit System
You cannot. Microsoft does not have time machines.