[CMake] Cannot compile simple example using cmake and xcode (linker problem)

Pim Schellart P.Schellart at student.science.ru.nl
Tue Jun 23 14:42:46 EDT 2009


Hello Everyone,

I tried removing and reinstalling Xcode using (sudo
/Developer/Library/uninstall-devtools --mode=all) which also removes
and reinstalls gcc.
This does not solve the problem.
In fact cmake -G Xcode now fails with the following:

CMake Error at /Applications/CMake
2.6-4.app/Contents/share/cmake-2.6/Modules/CMakeTestCCompiler.cmake:32
(MESSAGE):
  The C compiler "/usr/bin/cc" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/pim/Temp/bla/CMakeFiles/CMakeTmp



  Run Build Command:/Applications/CMake\ 2.6-4.app/Contents/bin/cmakexbuild
  -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTryCompileExec
  -configuration Debug

  2009-06-23 20:34:13.644 xcodebuild[499:4617] Warning: Couldn't discover the
  'cc' compiler's built-in search paths and preprocessor definitions for
  language dialect 'c'.  This may lead to indexing issues.

  Compiler: /Developer/Library/Xcode/Plug-ins/GCC
  4.0.xcplugin/Contents/Resources/cc

  Reason: sh: /Developer/Library/Xcode/Plug-ins/GCC
  4.0.xcplugin/Contents/Resources/cc: No such file or directory



  ** BUILD FAILED **



  The following build commands failed:

  cmTryCompileExec:

  	CompileC
  CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/Objects-normal/i386/testCCompiler.o
  /Users/pim/Temp/bla/CMakeFiles/CMakeTmp/testCCompiler.c normal i386 c
  com.apple.compilers.gcc.4_0

  (1 failure)



  === BUILDING NATIVE TARGET cmTryCompileExec OF PROJECT CMAKE_TRY_COMPILE
  WITH CONFIGURATION Debug ===



  Checking Dependencies...



  PhaseScriptExecution
  /Users/pim/Temp/bla/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/Script-482F90482F90482F90000000.sh


      cd /Users/pim/Temp/bla/CMakeFiles/CMakeTmp
      /bin/sh -c
/Users/pim/Temp/bla/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/Script-482F90482F90482F90000000.sh

  make: `CMakeFiles/cmake.check_cache' is up to date.



  CompileC
  CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/Objects-normal/i386/testCCompiler.o
  /Users/pim/Temp/bla/CMakeFiles/CMakeTmp/testCCompiler.c normal i386 c
  com.apple.compilers.gcc.4_0

      cd /Users/pim/Temp/bla/CMakeFiles/CMakeTmp
      "/Developer/Library/Xcode/Plug-ins/GCC
4.0.xcplugin/Contents/Resources/cc" -x c -arch i386 -fmessage-length=0
-pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0
-mdynamic-no-pic -DCMAKE_INTDIR="Debug" -gdwarf-2 -Wmost
-Wno-four-char-constants -Wno-unknown-pragmas
-F/Users/pim/Temp/bla/CMakeFiles/CMakeTmp/Debug
-I/Users/pim/Temp/bla/CMakeFiles/CMakeTmp/Debug/include
-I/Users/pim/Temp/bla/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/DerivedSources/i386
-I/Users/pim/Temp/bla/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/DerivedSources
-c /Users/pim/Temp/bla/CMakeFiles/CMakeTmp/testCCompiler.c -o
/Users/pim/Temp/bla/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/Objects-normal/i386/testCCompiler.o

  error: can't exec '/Developer/Library/Xcode/Plug-ins/GCC
  4.0.xcplugin/Contents/Resources/cc' (No such file or directory)



  PhaseScriptExecution
  /Users/pim/Temp/bla/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/Script-483670483670483670000000.sh


      cd /Users/pim/Temp/bla/CMakeFiles/CMakeTmp
      /bin/sh -c
/Users/pim/Temp/bla/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Debug/cmTryCompileExec.build/Script-483670483670483670000000.sh

  echo "Depend check for xcode"

  Depend check for xcode

  cd /Users/pim/Temp/bla/CMakeFiles/CMakeTmp && make -C
  /Users/pim/Temp/bla/CMakeFiles/CMakeTmp -f
  /Users/pim/Temp/bla/CMakeFiles/CMakeTmp/CMakeScripts/XCODE_DEPEND_HELPER.make
  all.Debug

  /bin/rm -f /Users/pim/Temp/bla/CMakeFiles/CMakeTmp/Debug/cmTryCompileExec





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)

I tried creating a symbolic link from Developer/Library/Xcode/Plug-ins/GCC
  4.0.xcplugin/Contents/Resources/cc to /usr/bin/cc (which itself is a
link to gcc-4.0) and then the project generation works but the
previously reported error reoccurs.

Kind regards,

Pim Schellart

2009/6/22 Tyler Roscoe <tyler at cryptio.net>:
> On Mon, Jun 22, 2009 at 12:08:22PM +0200, Pim Schellart wrote:
>> I tried to compile the example using standard make (with cmake
>> generated Makefiles) and it works.
>> But if I generate an Xcode project using cmake -G Xcode, open this
>> project and click build I get build failed with the following errors:
>
> I don't know anything about Xcode, but it sure looks like you have a
> weird/broken Xcode environment (possibly a bogus gcc installation?). Can
> you build a simple test project with Xcode that doesn't use CMake and
> verify that that works?
>
> tyler
>


More information about the CMake mailing list