<div>I was trying to cross compile from snow leopard to iphone simulator.</div><div>struggled a few days with  &quot;file was built for i386 which is not the architecture being linked (x86_64)&quot;.</div><div>and found <a href="http://www.itk.org/Bug/view.php?id=9466">http://www.itk.org/Bug/view.php?id=9466</a> bug history.</div>
<div><br></div><div>looks like the same bug popped up in 2.8.2 version.</div><div>The error was gone with 2.6.4</div><div><br></div><meta charset="utf-8"><div>Below is the full bug.</div><div><br></div><div>-- The C compiler identification is GNU</div>
<div>-- The CXX compiler identification is GNU</div><div>-- Check for working C compiler: /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2</div><div>-- Check for working C compiler: /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -- broken</div>
<div>CMake Error at /Applications/CMake 2.8-2.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):</div><div>  The C compiler</div><div>  &quot;/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2&quot;</div>
<div>  is not able to compile a simple test program.</div><div><br></div><div>  It fails with the following output:</div><div><br></div><div>   Change Dir: /Users/eugenekim/Documents/BrainGame/CMakeFiles/CMakeTmp</div><div>
<br></div><div>  </div><div><br></div><div>  Run Build Command:/usr/bin/make &quot;cmTryCompileExec/fast&quot;</div><div><br></div><div>  /usr/bin/make -f CMakeFiles/cmTryCompileExec.dir/build.make</div><div>  CMakeFiles/cmTryCompileExec.dir/build</div>
<div><br></div><div>  &quot;/Applications/CMake 2.8-2.app/Contents/bin/cmake&quot; -E cmake_progress_report</div><div>  /Users/eugenekim/Documents/BrainGame/CMakeFiles/CMakeTmp/CMakeFiles 1</div><div><br></div><div>  Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj</div>
<div><br></div><div>  /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2</div><div>  -I/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/include</div><div>  -I/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/opt/iphone-simulator-4.0/include</div>
<div>  -I/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/local/iphone-simulator-4.0/include</div><div>  -pipe -no-cpp-precomp</div><div>  --sysroot=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk</div>
<div>  -miphoneos-version-min=4.0 -o</div><div>  CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj -c</div><div>  /Users/eugenekim/Documents/BrainGame/CMakeFiles/CMakeTmp/testCCompiler.c</div><div><br></div><div>  Linking C executable cmTryCompileExec</div>
<div><br></div><div>  &quot;/Applications/CMake 2.8-2.app/Contents/bin/cmake&quot; -E cmake_link_script</div><div>  CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1</div><div><br></div><div>  /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2</div>
<div>  CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.obj -o cmTryCompileExec</div><div>  -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/lib</div><div>  -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/opt/iphone-simulator-4.0/lib</div>
<div>  -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/local/iphone-simulator-4.0/lib</div><div><br></div><div><br></div><div>  ld: warning: in</div><div>  /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/lib/libSystem.dylib,</div>
<div>  file was built for i386 which is not the architecture being linked (x86_64)</div><div><br></div><div>  Undefined symbols:</div><div><br></div><div>    &quot;_exit&quot;, referenced from:</div><div>        start in crt1.10.6.o</div>
<div><br></div><div>  ld: symbol(s) not found</div><div><br></div><div>  collect2: ld returned 1 exit status</div><div><br></div><div>  make[1]: *** [cmTryCompileExec] Error 1</div><div><br></div><div>  make: *** [cmTryCompileExec/fast] Error 2</div>
<div><br></div><div>  </div><div><br></div><div>  </div><div><br></div><div>  CMake will not be able to correctly generate this project.</div><div>Call Stack (most recent call first):</div><div>  CMakeLists.txt:6 (project)</div>
<div><br></div><div><br></div><div>-- Configuring incomplete, errors occurred!</div><div><br></div><div><br></div><div>toolchain file </div><div><br></div><div><div><br></div><div><br></div><div><br></div><div># Michael Aaron Safyan (<a href="mailto:michaelsafyan@gmail.com">michaelsafyan@gmail.com</a>). Copyright (C) 2009-2010. Simplified BSD License.</div>
<div>SET (CMAKE_SYSTEM_NAME Generic)</div><div>SET (CMAKE_SYSTEM_VERSION 1)</div><div>SET (CMAKE_SYSTEM_PROCESSOR i686)</div><div>SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)</div><div><br></div><div>SET (SDKVER &quot;4.0&quot;)</div>
<div>SET (DEVROOT &quot;/Developer/Platforms/iPhoneSimulator.platform/Developer&quot;)</div><div>SET (SDKROOT &quot;${DEVROOT}/SDKs/iPhoneSimulator${SDKVER}.sdk&quot;)</div><div>SET (CMAKE_OSX_SYSROOT &quot;${SDKROOT}&quot;)</div>
<div>#SET (CMAKE_OSX_ARCHITECTURES &quot;i386&quot; &quot;x86_64&quot;)</div><div>SET (CMAKE_OSX_ARCHITECTURES &quot;i386&quot;)</div><div><br></div><div><br></div><div>SET (CMAKE_C_COMPILER &quot;${DEVROOT}/usr/bin/gcc-4.2&quot;)</div>
<div>SET (CMAKE_CXX_COMPILER &quot;${DEVROOT}/usr/bin/g++-4.2&quot;)</div><div><br></div><div>SET (CMAKE_C_COMPILER &quot;${DEVROOT}/usr/bin/gcc-4.2&quot;)</div><div>SET (CMAKE_CXX_COMPILER &quot;${DEVROOT}/usr/bin/g++-4.2&quot;)</div>
<div><br></div><div>SET (CMAKE_C_FLAGS &quot;-std=c99&quot; &quot;-x objective-c&quot;)</div><div>SET (CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS} &quot;-DDEBUG=1&quot; &quot;-ggdb&quot;)</div><div>SET (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS} &quot;-DNDEBUG=1&quot;)</div>
<div>SET (CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS} &quot;-DNDEBUG=1&quot; &quot;-ggdb&quot;)</div><div><br></div><div>SET (CMAKE_CXX_FLAGS &quot;-x objective-c++&quot;)</div><div>SET (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS} &quot;-DDEBUG=1&quot; &quot;-ggdb&quot;)</div>
<div>SET (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS} &quot;-DNDEBUG=1&quot;)</div><div>SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS} &quot;-DNDEBUG=1&quot; &quot;-ggdb&quot;)</div><div><br></div><div>#ADD_DEFINITIONS(&quot;-arch i386&quot;)</div>
<div>#ADD_DEFINITIONS(&quot;-arch x86_64&quot;)</div><div>ADD_DEFINITIONS(&quot;-pipe&quot;)</div><div>ADD_DEFINITIONS(&quot;-no-cpp-precomp&quot;)</div><div>ADD_DEFINITIONS(&quot;--sysroot=${SDKROOT}&quot;)</div><div>ADD_DEFINITIONS(&quot;-miphoneos-version-min=${SDKVER}&quot;)</div>
<div><br></div><div>INCLUDE_DIRECTORIES(SYSTEM &quot;${SDKROOT}/usr/include&quot;)</div><div>INCLUDE_DIRECTORIES(SYSTEM &quot;${SDKROOT}/opt/iphone-simulator-${SDKVER}/include&quot;)</div><div>INCLUDE_DIRECTORIES(SYSTEM &quot;${SDKROOT}/usr/local/iphone-simulator-${SDKVER}/include&quot;)</div>
<div><br></div><div>LINK_DIRECTORIES(&quot;${SDKROOT}/usr/lib&quot;)</div><div>LINK_DIRECTORIES(&quot;${SDKROOT}/opt/iphone-simulator-${SDKVER}/lib&quot;)</div><div>LINK_DIRECTORIES(&quot;${SDKROOT}/usr/local/iphone-simulator-${SDKVER}/lib&quot;)</div>
<div><br></div><div>SET (CMAKE_FIND_ROOT_PATH &quot;${SDKROOT}&quot; &quot;/opt/iphone-simulator-${SDKVER}/&quot; &quot;/usr/local/iphone-simulator-${SDKVER}/&quot;)</div><div>SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)</div>
<div>SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)</div><div>SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)</div><div><br></div><div>SET (iPhone 1)</div><div>SET (iPhoneSimulator 1)</div><div>SET (iPhoneSimulator_VERSION ${SDKVER})</div>
</div><div><br></div>