How to clean the obj and lib files generated by nmake - nmake

I am using nmake in VS 2012 console to compile GDAL, I want to know which command could help me to remove all files generated by nmake command last time.
c:\gdal>nmake clean
Microsoft (R) Program Maintenance Utility Version 11.00.60610.1
Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : fatal error U1073: don't know how to make 'clean'
Stop.

I got it, after having a look into makefile.vc, there is a clean target in it.
Just execute the following command:
nmake /f makefile.vc clean

Related

Setting up Kdevelop

I'm trying to setup Kdevelop and am getting a compiler error.
C:/Users/alexm/projects/SFMLGL/build> "C:/Program Files/CMake/bin/cmake.exe" "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" "-DCMAKE_BUILD_TYPE=Debug" C:/Users/alexm/projects/SFMLGL
-- The C compiler identification is unknown
CMake Error at C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCompilerId.cmake:141 (file):
file problem creating directory:
C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/3.6.1/CompilerIdCXX
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCompilerId.cmake:40 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
C:/Program Files/CMake/share/cmake-3.6/Modules/CMakeDetermineCXXCompiler.cmake:113 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:2 (project)
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:2 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/alexm/projects/SFMLGL/build/CMakeFiles/CMakeError.log".
*** Failure: Exit code 1 ***
I've been googling a lot and read that I should download "Make", so I have and it did reduce the amount of errors I have, but I still have this and I don't understand a word of it.
I think it wants me to download a C compiler? How would I go about doing this?
The default toolchain for CMake tries to use the Visual Studio C++ Compiler.
If you want to use Visual Studio (you need to have that installed) you can run your CMake command from the »VS201X x64 Native Tools Command Prompt« shortcut in the start menu.
An alternative would be to use GCC for Windows via mingw-w64 which is available in msys2. There you would have to install the compiler via pacman -S mingw-w64-x86_64-toolchain and optionally cmake too via pacman -S mingw-w64-x86_64-cmake.
You could then run your command from the mingw64 prompt of msys2.
If you want to use that in KDevelop you’d have to add your msys64/mingw64/ folder to the path, or start it from the Visual Studio command prompt mentioned above. I’m not sure if there is an easier way.
Your question raises the question^^ what you want to achieve in the end. You don’t seem to know about which compiler to use (this may be important if you have binary dependencies) or what make is (which is a bit alarming).

Force SCons to use 32-bit MSVC compiler on 64-bit Windows

I am trying use cl from Visual Studio 2010 to build the 32-bit version of Mixxx. Mixxx uses SCons to build. My computer is Windows 7 64-bit with too many versions of Visual Studio installed.
Following these instructions, I have tried all sorts of combinations and variations of setenv and vsvars but no matter what I do, I end up on the command line in this situation:
> cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
OK, so cl is pointing to "version 16, x86" - great.
> scons toolchain=msvs force32=1 winlib=%cd%\winlib\x86 sqlitedll=0 staticlibs=1 asmlib=0
[... bunch of output truncated, until we start using the compiler ...]
cl /Fores\qrc_mixxx.obj /c res\qrc_mixxx.cc /TP /Zc:wchar_t- /GL /MP /fp:fast /G
[truncated]
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
(Note - I hacked SCons to remove the /nologo) What? How does cl now mean "version 18, x64"? Did it change my environment? Let's find out:
Terminate batch job (Y/N)? y
>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
So cl still means "version 16, x86" to the terminal. But SCons always uses "latest version, x64".
(Based on my understanding of the Windows shell, this should not even be possible. I killed the script, so it didn't do any cleanup. How can the meaning of cl change like that?)
I've found a couple hints:
http://scons.1086193.n5.nabble.com/Using-32-bit-MSVC-compiler-on-64-bit-Windows-td28062.html
http://www.scons.org/wiki/MsvsMultipleVersions
Forcing scons to use older compiler?
Based on this, I've added
Environment(MSVC_VERSION = '10.0')
Environment(TARGET_ARCH = 'x86')
print 'hello world'
to the SConstruct. I don't know SCons, and the build scripts are non-trivial, so it's likely that I'm doing this wrong. Regardless, SCons still always uses "newest version, x64".
The Environment kwargs you posted work for me (Scons 2.3.4):
env = Environment(
MSVC_VERSION='12.0',
TARGET_ARCH='x86')
env.Program('src.cpp')
The value for a 64-bit program should be TARGET_ARCH='x86_64' according to http://scons.1086193.n5.nabble.com/32-and-64-bit-builds-on-MSVC-td25425.html. Other values of MSVC_VERSION also work.
I turned on logging per dirkbaechle's comment (set SCONS_MSCOMMON_DEBUG=-). This was very helpful. When I added Environment(MSVC_VERSION='10.0') to SConstruct, I could see in the output
get_default_version(): msvc_version:10.0 msvs_version:None
msvc_setup_env: using specified MSVC version '10.0'
[ ... truncated ... ]
get_default_version()
get_default_version(): msvc_version:None msvs_version:None
installed_vcs:['12.0', '10.0', '10.0Exp', '9.0']
msvc_setup_env: using default installed MSVC version '12.0'
Oops - by the time we call get_default_version for the 2nd time, it seems we are using a different environment. I don't understand the Mixxx build scripts well enough to know why, but I'm pretty sure that is the reason.
The Easy Workaround
For people like me who are too lazy to fix their build scripts, there's an easy (but ugly) way to force SCons to do what you want. You just need to intentionally break your newer versions (temporarily, of course). For example, I want to use 2010, x86. First, I rename all the "VC" directories of higher versions.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\ VC rename to _DISABLED_VC
C:\Program Files (x86)\Microsoft Visual Studio 11.0\ VC rename to _DISABLED_VC
And now SCons will use 2010 (aka "Microsoft Visual Studio 10.0"), because all higher versions are unavailable. Selecting the target architecture is similar.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\ amd64 rename to _DISABLED_amd64
do the same for ia64, x86_amd64, x86_ia64, etc.
I tried setting TARGET_ARCH using env = Environment(blabla), but it didn't help
So I searched for 'TARGET_ARCH' in Scons directory (...\PythonDir\scons-3.0.1\Scons).
In my case it was in Environment.py file that has a section with default values.
I changed None to 'x86'
# Now set defaults for TARGET_{OS|ARCH}
...
# self._dict['TARGET_ARCH'] = self._dict.get('TARGET_ARCH',None)
self._dict['TARGET_ARCH'] = self._dict.get('TARGET_ARCH','x86')
Then I removed previously compiled Environment.pyc, causing it to be regenerated
And it worked!

vlfeat nmake: fatal error U1073: don't know how to make "msvcr100.dll"

I have downloaded vlfeat source code. I am trying make file using nmake (Microsoft Visual Studio command) to use vlfeat.
The command I have given is:
nmake /f Makefile.mak ARCH=win32
It gives the following error.
NMAKE : fatal error U1073: don't know how to make '"C:\Program
Files\Microsoft Visual Studio 10.0\VC
\redist\x86\Microsoft.VC100.CRT\msvcr100.dll"' Stop.
Please help me to fix it.
Configurations
Windows 7 32 bit OS
VLFeat version: 0.9.17
Microsoft Visual Studio 2010 Express
Regards
Sridhar
I think you need to put the argument to nmake in quotes:
nmake /f Makefile.mak "ARCH=win32"
but as you have not given details of the makefile in your question its hard to help without more details.

Cmake is Unable to Configure Project for Visual Studios 10 amd64

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.

nmake u1034 separator missing

I've tried to execute make file with nmake in dos-prompt and got the following message:
makefile.in(145) : fatal error U1034: syntax error : separator missing
I took a look into the make file and the line 145 says:
ifeq (#INSTALINFO_FOUND#,yes)
I have absolutely no clue how to fix this ... Do you have any ideas?
Makefile.in indicates the build system you should use is the GNU autotools. These will pre-process your files into GNU format makefile(s). You are then expected to use GNU make with these makefiles.
nmake is a completely different beast and will not be compatible with these files.
I suggest you investigate whether your package is buildable using Microsft tools (hunt out words like nmake or Visual Studio or Windows etc., in its documentation). Your other alternative is to grab a windows port of the Autotools. Cygwin is good, but here be dragons for the unwary.

Resources