Forum

Welcome Guest 

Show/Hide Header

Welcome Guest, posting in this forum requires registration.





Pages: [1]
Author Topic: More detailed instructions for CMake and Visual Studio
pjdoolan1
Newbie
Posts: 5
Permalink
Post More detailed instructions for CMake and Visual Studio
on: October 16, 2013, 15:13
Quote

Hi Stefano,

I am trying to build the program on Windows 64-bit, but am running into some problems. I am a complete novice with all this, but I have installed CMake and Visual Studio 2010 Express. I have tried to follow the WIKI instructions, but get a little lost around the CMake part. Please see the attached screenshot, where I have tried to define the source code and binaries (I tried to follow the image in the Linux build section above). Upon pressing configure I get an error message, shown briefly in the screenshot but the full extent of which is:

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/cl.exe" is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Users/pdoolan.MEDPHYS/Desktop/NiftyRec-1.6.9/build/CMakeFiles/CMakeTmp

Run Build Command:C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
cmTryCompileExec4002676725.vcxproj /p:Configuration=Debug
/p:VisualStudioVersion=10.0

Microsoft (R) Build Engine version 4.0.30319.17929

[Microsoft .NET Framework, version 4.0.30319.17929]

Copyright (C) Microsoft Corporation. All rights reserved.

Build started 16/10/2013 11:03:13.

Project
"C:\Users\pdoolan.MEDPHYS\Desktop\NiftyRec-1.6.9\build\CMakeFiles\CMakeTmp\cmTryCompileExec4002676725.vcxproj"
on node 1 (default targets).

PrepareForBuild:

Creating directory "cmTryCompileExec4002676725.dir\Debug\".

Creating directory "C:\Users\pdoolan.MEDPHYS\Desktop\NiftyRec-1.6.9\build\CMakeFiles\CMakeTmp\Debug\".

InitializeBuildStatus:

Creating "cmTryCompileExec4002676725.dir\Debug\cmTryCompileExec4002676725.unsuccessfulbuild" because "AlwaysCreate" was specified.

ClCompile:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec4002676725.dir\Debug\\" /Fd"cmTryCompileExec4002676725.dir\Debug\vc100.pdb" /Gd /TC /analyze- /errorReport:queue testCCompiler.c

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86

Copyright (C) Microsoft Corporation. All rights reserved.

cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"cmTryCompileExec4002676725.dir\Debug\\" /Fd"cmTryCompileExec4002676725.dir\Debug\vc100.pdb" /Gd /TC /analyze- /errorReport:queue testCCompiler.c

testCCompiler.c

ManifestResourceCompile:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /nologo /fo"cmTryCompileExec4002676725.dir\Debug\cmTryCompileExec4002676725.exe.embed.manifest.res" cmTryCompileExec4002676725.dir\Debug\cmTryCompileExec4002676725_manifest.rc

Link:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\pdoolan.MEDPHYS\Desktop\NiftyRec-1.6.9\build\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec4002676725.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /ManifestFile:"cmTryCompileExec4002676725.dir\Debug\cmTryCompileExec4002676725.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:/Users/pdoolan.MEDPHYS/Desktop/NiftyRec-1.6.9/build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec4002676725.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/pdoolan.MEDPHYS/Desktop/NiftyRec-1.6.9/build/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec4002676725.lib" /MACHINE:X86 cmTryCompileExec4002676725.dir\Debug\cmTryCompileExec4002676725.exe.embed.manifest.res

cmTryCompileExec4002676725.dir\Debug\testCCompiler.obj /machine:X86 /debug

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid
or corrupt
[C:\Users\pdoolan.MEDPHYS\Desktop\NiftyRec-1.6.9\build\CMakeFiles\CMakeTmp\cmTryCompileExec4002676725.vcxproj]

Done Building Project
"C:\Users\pdoolan.MEDPHYS\Desktop\NiftyRec-1.6.9\build\CMakeFiles\CMakeTmp\cmTryCompileExec4002676725.vcxproj"
(default targets) -- FAILED.

Build FAILED.

"C:\Users\pdoolan.MEDPHYS\Desktop\NiftyRec-1.6.9\build\CMakeFiles\CMakeTmp\cmTryCompileExec4002676725.vcxproj"
(default target) (1) ->

(Link target) ->

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt [C:\Users\pdoolan.MEDPHYS\Desktop\NiftyRec-1.6.9\build\CMakeFiles\CMakeTmp\cmTryCompileExec4002676725.vcxproj]

0 Warning(s)

1 Error(s)

Time Elapsed 00:00:00.79

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:31 [/color](PROJECT)[/color]

Configuring incomplete, errors occurred!
See also "C:/Users/pdoolan.MEDPHYS/Desktop/NiftyRec-1.6.9/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/pdoolan.MEDPHYS/Desktop/NiftyRec-1.6.9/build/CMakeFiles/CMakeError.log".

----------------

You probably know this from looking above, but the NiftyRec folder is located on my desktop.

Thanks again for any help you can provide!
Paul
Image

spedemon
Administrator
Posts: 22
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: October 16, 2013, 15:35
Quote

Hi Paul,

CMake is a cross platform build system, it generates compiler specific configuration files (e.g. a VisualStudio project). But before that, it checks if the compiler that you have selected works. In your case CMake says that the compiler does not work. Pasting the massage on Google search, it appears to be an issue with access privilege to 'cl.exe' (one of the tools of Visual Studio) http://stackoverflow.com/questions/14590947/cmake-configuring-fails-cl-exe-is-not-able-to-compile-a-simple-test-program. Hopefully you will find the solution with Google.
I guess that you will find a similar error message if you open VisualStudio, create a new basic C or C++ project and click on the build button.

pjdoolan1
Newbie
Posts: 5
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: October 16, 2013, 16:13
Quote

Hi Stefano,

I found the solution on Google, with the answer on the page you pasted, so thank you for that. The next problem is shown in the screenshot, after I press the configure button (shown in the screenshot). The full error message, again, is:

-------------------------------------------------------

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:446 (execute_process):
execute_process given COMMAND argument with no value.
Call Stack (most recent call first):
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:48 (CMAKE_DETERMINE_COMPILER_ID_VENDOR)
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCCompiler.cmake:131 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:31 (PROJECT)

The C compiler identification is unknown
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:446 (execute_process):
execute_process given COMMAND argument with no value.
Call Stack (most recent call first):
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCompilerId.cmake:48 (CMAKE_DETERMINE_COMPILER_ID_VENDOR)
C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeDetermineCXXCompiler.cmake:127 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:31 (PROJECT)

The CXX compiler identification is unknown
Looking for include file pthread.h
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeCInformation.cmake:37 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
CMakeLists.txt:2 (PROJECT)

CMake Error: Internal CMake error, TryCompile configure of cmake failed
Looking for include file pthread.h - not found
Found Threads: TRUE
Found PythonInterp: C:/Python33/python.exe (found version "3.3.2")
MATLAB_INCLUDE=MATLAB_INCLUDE-NOTFOUND
MATLAB_LIBRARY=MATLAB_MEX_LIBRARY-NOTFOUND;MATLAB_MX_LIBRARY-NOTFOUND;MATLAB_ENG_LIBRARY-NOTFOUND
MATLAB_LIBRARIES=
CMake Error at CMake/matlab/LibFindMacros.cmake:74 (message):
Required library MATLAB NOT FOUND.

Install the library (dev version) and try again. If the library is already
installed, use ccmake to set the missing variables manually.
Call Stack (most recent call first):
CMake/matlab/FindMATLAB.cmake:56 (libfind_process)
Matlab/nifty_rec/CMakeLists.txt:19 (FIND_PACKAGE)

Configuring incomplete, errors occurred!
See also "C:/Users/pdoolan.MEDPHYS/Desktop/NiftyRec/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/pdoolan.MEDPHYS/Desktop/NiftyRec/build/CMakeFiles/CMakeError.log".

-------------------------------------------------------

Thank you very much for 'walking me through' this!
Paul

spedemon
Administrator
Posts: 22
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: October 16, 2013, 16:37
Quote

There is another problem with the installation of VisualStudio. It might be a permission problem again (I wander why the pemission on cl.exe was wrong).
The issue is discussed here: http://cmake.3232098.n2.nabble.com/Visual-Studio-10-compiler-identification-unknown-td7585120.html. It is suggested to to reinstall VisualStudio. Perhaps CMake should be installed after VisualStudio and not before (just a guess). Also, someone has observed that the command line version of CMake works for them when experiencing such problem.

Once VisualStudio and CMake are ready, I can actually walk you through building NiftyRec!

pjdoolan1
Newbie
Posts: 5
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: October 16, 2013, 18:16
Quote

I have reinstalled Visual Studio 2010 (C++ I am guessing), with CMake installed afterwards, but the same problem remains. Can you explain how the command line version of CMake works? I have a 'Visual Studio Command Prompt' window open, but do not know how to get cmake running from there.

pjdoolan1
Newbie
Posts: 5
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: October 17, 2013, 14:47
Quote

Stefano helped me tremendously with this. All of my problems were regarding things before the installation of NiftyRec. Eventually I decided that there were too many things to fix regarding my CMake and Visual Studio installations that it would be better building from source on Linux rather than Windows. I recommend this to anyone starting a new build, the process is much simpler.

spedemon
Administrator
Posts: 22
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: October 17, 2013, 14:55
Quote

Thanks Paul,
It is indeed somewhat easier to build the code from source under Linux and MacOS.
I am looking at setting up BuildBot to automate the building of binary installers for multiple architectures, hopefully it will happen soon.

f.nouizi
Newbie
Posts: 2
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: January 8, 2014, 23:54
Quote

Dear Stephano,
I have the same problem as Paul. My machine is 64 bits and doesn't recognize the mex functions.
I tried to compile with Cmake but without success. Do you have a pre-compiled .exe for 64 bits.
Unfortunately, I don't have any Linux nor MacOS available as Paul suggested.
Thank you for your help.
Farouk

f.nouizi
Newbie
Posts: 2
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: January 10, 2014, 00:05
Quote

Hi Stephano and Paul,
I succded getting a Linux machine with Ubuntu. After running "ccmake .." I try to configure but I have the following message:

MATLAB_INCLUDE=MATLAB_INCLUDE-NOTFOUND
MATLAB_LIBRARY=MATLAB_MEX_LIBRARY-NOTFOUND;MATLAB_MX_LIBRARY-NOTFOUND;MATLAB_E
NG_LIBRARY-NOTFOUND
MATLAB_LIBRARIES=
CMake Error at CMake/matlab/LibFindMacros.cmake:74 (message):
Required library MATLAB NOT FOUND.
Install the library (dev version) and try again. If the library is already
installed, use ccmake to set the missing variables manually.
Call Stack (most recent call first):
CMake/matlab/FindMATLAB.cmake:56 (libfind_process)
Matlab/nifty_rec/CMakeLists.txt:19 (FIND_PACKAGE)

I don't know how to install this missing library. I have to precise that I'm a beginner.
I would be very happy if you can help me advancing with this problem,
Thank you very much in advance
Farouk

rarasmaya
Newbie
Posts: 1
Permalink
Post Re: More detailed instructions for CMake and Visual Studio
on: February 12, 2017, 17:33
Quote

Hi Nouizi,

I also get the same error as yours.
I have solved the error by edit FindMATLAB.cmake file in folder CMake/matlab. Check line 7 and 11, is the registry path is correctly refer to your Matlab installation folder? And then check if mex.h and libmex.lib files are contained in those folders. In my case, my libmex.lib file is in folder '/extern/lib/win64/microsoft'.

Best regards,
Rarasmaya

Pages: [1]
Mingle Forum by cartpauj
Version: 1.0.34 ; Page loaded in: 0.096 seconds.
{lang: 'en-GB'}