[vtkusers] error: cmake + free optimizing compiler from .net framework SDK --- x86 conflicts with x64

Weiguang Guan guanw at rhpcs.mcmaster.ca
Wed Dec 6 15:37:40 EST 2006


Hi Mathieu,

I am working directly on Windows XP rather than on Cygwin layer. I think 
this might be a cmake issue, because the error message box appears after 
I hit the "Configure" button of CMake, and the same error message pops up 
when configuring an ITK build with cmake.

The error message seems coming from CMakeTestCCompiler.cmake, in which a 
simple c program (see below) is generated on the fly and compiled.

#ifdef __cplusplus
# error "The CMAKE_C_COMPILER is set to a C++ compiler"
#endif
#include <stdio.h>
#if defined(__CLASSIC_C__)
int main(argc, argv)
   int argc;
   char* argv[];
#else
int main(int argc, char* argv[])
#endif
{ printf("%s\\n", argv[0]); return argc-1;}

I manually saved it into a file and got it compiled and linked. It worked 
fine. Can anyone explain why cmake thinks "it is not able to compile a 
simple test program"?

-- 
========================================================
Weiguang Guan, Research Engineer
RHPCS, McMaster University
========================================================

On Wed, 6 Dec 2006, Mathieu Malaterre wrote:

> Weiguang Guan wrote:
>> Hi,
>> 
>> I wanted to make use of the free C/C++ command line compiler that comes 
>> with microsoft's .net framework SDK 2.0 (platform SDK is installed as 
>> well). When I was using CMake to configure VTK5.0 on a x86 machine, I chose 
>> "NMake Makefile". But the C compiler failed to compile a simple test 
>> program, complaining "fatal error LNK1112: module machine type 'X86' 
>> conflicts with target machine type 'X64'. I have no idea why it considered 
>> my computer to be x64, and it didn't help at all even if I changed 
>> /machine:x64 to /machine:/x86 in CMAKE_EXE_LINKER_FLAGS. Anybody had 
>> similar experience or had suggestion to this situation? Thanks.
>
> Weiguang,
>
> 	Here is the script I am using (bash+cygwin):
>
> export PATH='/cygdrive/c/Program Files/CMake 2.4/bin/:/cygdrive/c/Program 
> Files/Microsoft Visual C++ Toolkit 2003/bin:/cygdrive/c/Program 
> Files/Microsoft Platform SDK for Windows Server 2003 
> R2/Bin:/cygdrive/c/Program Files/Microsoft Platform SDK for Windows Server 
> 2003 R2/Bin/win64':$PATH
> export LIB="C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;C:\Program 
> Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib"
> export INCLUDE="C:\Program Files\Microsoft Visual C++ Toolkit 
> 2003\include;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 
> R2\Include"
>
>
>
> 	Please check that you have something similar. Once this script is 
> evaluated (source), run cmake in an empty directory (do not try to rerun in a 
> old binary directory).
>
> HTH
> Mathieu
>



More information about the vtkusers mailing list