[CMake] Changing compiler

David Cole david.cole at kitware.com
Thu Apr 21 08:34:58 EDT 2011


On Thu, Apr 21, 2011 at 7:47 AM, David Doria <daviddoria at gmail.com> wrote:

> Sounds like you must have gotten errors when you built gcc...
>>
>> Pore through the log of what happened during the gcc build maybe?
>>
>> Are you building gcc from source, or using some package manager to build
>> it for you? (MacPorts, something else?)
>>
>
> FYI - there was no problem all along with the build (see paragraph below):
>
>
>> The executable 'gcc' never exists in the build directory even if the build
>> is successful. It is called 'xgcc'. 'xgcc' will finally be renamed to 'gcc'
>> as part of 'make install'. The reason for this naming convention is listed
>> in the source file gcc/Makefile.in:
>>
>> # We call this executable `xgcc' rather than `gcc'
>> # to avoid confusion if the current directory is in the path
>> # and CC is `gcc'.  It is renamed to `gcc' when it is installed.
>>
>> BR,
>> Andi
>>
>
> However, I'm still having trouble using it to build ITK. I tried two
> things:
>
> 1) I run
> ccmake ~/src/ITK
>
> Then before I configure, I change the CMAKE_C/CXX_COMPILER variables. Then
> when I configure I get:
>
>  You have changed variables that require your cache to be deleted.
>  Configure will be re-run and you may have to reset some variables.
>  The following variables have changed:
>  CMAKE_C_COMPILER= /home/doriad/bin/gcc/gcc/xgcc
>  CMAKE_CXX_COMPILER= /home/doriad/bin/gcc/gcc/g++
>
>
>  CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52
>  (MESSAGE):
>    The C compiler "/home/doriad/bin/gcc/gcc/xgcc" is not able to compile a
>
>    simple test program.
>
>    It fails with the following output:
>
>     Change Dir: /home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp
>
> 2) I run:
> ccmake ../../src/ITK -DCMAKE_CXX_COMPILER=/home/doriad/bin/gcc/gcc/g++
> -DCMAKE_C_COMPILER=/home/doriad/bin/gcc/gcc/xgcc
>
>  CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52
>  (MESSAGE):
>    The C compiler "/home/doriad/bin/gcc/gcc/xgcc" is not able to compile a
>
>    simple test program.
>
>    It fails with the following output:
>
>     Change Dir: /home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp
>
>
>
>
>    Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
>
>    /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
>    CMakeFiles/cmTryCompileExec.dir/build
>
>    gmake[1]: Entering directory
>    `/home/doriad/bin/ITK_newgcc/CMakeFiles/CMakeTmp'
>
>
> Any thoughts?
>
> Thanks,
>
> David
>


Can gcc run from its build tree? Or does it need to be installed to work?

I would try using a prefix and installing it somewhere other than its build
tree.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110421/dc545cfe/attachment.htm>


More information about the CMake mailing list