MantisBT - CMake
View Issue Details
0008193CMakeCMakepublic2008-11-28 11:142013-10-07 10:04
kaliki 
Bill Hoffman 
normalmajoralways
closedfixed 
CMake-2-6 
CMake 2.8.11CMake 2.8.11 
0008193: Cmake goes to endless loop on mac os X when trying to generate Unix make files.
Getting message:

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= gcc
CMAKE_CXX_COMPILER= g++

And cmake starts from begining.
Try out cmake 2.6.2 and 2.6.1 100% reproducable.
Xcode projects generates without any problems.
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Cached: MAKE_ONLY[--CUTTED--] MAKE_CHECK[yes] CMAKE_BUILD_TYPE[Debug]
-- Will use CC[gcc]
-- Will use CXX[g++]
-- Configuring done
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= gcc
CMAKE_CXX_COMPILER= g++

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Cached: MAKE_ONLY[--CUTTED--] MAKE_CHECK[yes] CMAKE_BUILD_TYPE[Debug]
-- Will use CC[gcc]
-- Will use CXX[g++]
-- Configuring done
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= gcc
CMAKE_CXX_COMPILER= g++

...
No tags attached.
related to 0013756closed Brad King Infinite loop when reconfiguring with different CMAKE_C_COMPILER 
tar workdir.tar (10,240) 2013-01-31 12:58
https://public.kitware.com/Bug/file/4631/workdir.tar
Issue History
2008-11-28 11:14kalikiNew Issue
2008-11-28 11:31Bill HoffmanNote Added: 0014226
2008-12-02 12:33Bill HoffmanNote Added: 0014269
2008-12-02 12:34Bill HoffmanStatusnew => assigned
2008-12-02 12:34Bill HoffmanAssigned To => Bill Hoffman
2009-04-22 22:00Woojin OhNote Added: 0016149
2009-05-08 02:39Kihyun KimNote Added: 0016349
2009-05-08 02:43Kihyun KimNote Edited: 0016349
2009-05-08 03:50Kihyun KimNote Added: 0016350
2009-05-08 03:50Kihyun KimNote Edited: 0016350
2010-03-07 23:42Joel CroteauNote Added: 0019754
2010-03-08 09:38Bill HoffmanNote Added: 0019755
2010-03-08 11:00Joel CroteauNote Added: 0019756
2010-03-08 11:07Bill HoffmanNote Added: 0019757
2010-03-08 11:12Bill HoffmanNote Added: 0019758
2010-03-08 11:27Joel CroteauNote Added: 0019759
2010-03-08 16:32Joel CroteauNote Added: 0019764
2010-03-08 16:57Bill HoffmanNote Added: 0019765
2010-03-08 17:03Joel CroteauNote Added: 0019766
2010-03-08 17:29Bill HoffmanNote Added: 0019768
2013-01-31 12:58CrumblingStatueFile Added: workdir.tar
2013-01-31 13:10CrumblingStatueNote Added: 0032185
2013-01-31 13:32CrumblingStatueNote Edited: 0032185bug_revision_view_page.php?bugnote_id=32185#r1017
2013-01-31 13:35CrumblingStatueNote Edited: 0032185bug_revision_view_page.php?bugnote_id=32185#r1018
2013-01-31 13:36CrumblingStatueNote Edited: 0032185bug_revision_view_page.php?bugnote_id=32185#r1019
2013-02-01 07:44CrumblingStatueNote Edited: 0032185bug_revision_view_page.php?bugnote_id=32185#r1020
2013-03-15 09:02Brad KingRelationship addedrelated to 0013756
2013-03-15 09:03Brad KingNote Added: 0032639
2013-03-15 09:03Brad KingStatusassigned => resolved
2013-03-15 09:03Brad KingResolutionopen => fixed
2013-03-15 09:03Brad KingFixed in Version => CMake 2.8.11
2013-03-15 09:03Brad KingTarget Version => CMake 2.8.11
2013-10-07 10:04Robert MaynardNote Added: 0034009
2013-10-07 10:04Robert MaynardStatusresolved => closed

Notes
(0014226)
Bill Hoffman   
2008-11-28 11:31   
Can you give the exact command line that causes this, also provide the values for environment variables CC, CXX.
(0014269)
Bill Hoffman   
2008-12-02 12:33   
I am still unable to reproduce this?
(0016149)
Woojin Oh   
2009-04-22 22:00   
If you change any compiler environment variables after PROJECT() line,
you will get those messages.

PROJECT() : check compiler environment
(0016349)
Kihyun Kim   
2009-05-08 02:39   
(edited on: 2009-05-08 02:43)
I got this problem on Solaris 9 too.
This is CMakeLists.txt file what I tested. and It doesn't work.

  # CMake script for version 2.6
  cmake_minimum_required(VERSION 2.6)
  project("FOOBAR" C)

But, after adding wrong line like - did not given PROPERTY - It works!!

  set_property(GLOBAL CMAKE_C_COMPILER /usr/bin/gcc)


bash-2.05$ ~/cmake-2.6.1-SunOS-sparc/bin/cmake .
-- Check for working C compiler: gcc
-- Check for working C compiler: gcc -- works
-- Check size of void*
-- Check size of void* - done
CMake Error at CMakeLists.txt:5 (set_property):
  set_property not given a PROPERTY <name> argument.


-- Configuring done
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= gcc

-- Generating done
-- Build files have been written to: /data/lab/test

and but... I cannot make a program

very confused.. ;-(

ps. It works for 2.4.X

(0016350)
Kihyun Kim   
2009-05-08 03:50   
I tried more.

open CMakeFiles/CMakeCCompiler.cmake and CMakeFiles/CMakeCXXCompiler.cmake file

and found

  SET(CMAKE_C_COMPILER_ENV_VAR "CC")
  SET(CMAKE_CXX_COMPILER_ENV_VAR "CXX")

So I found that it works good when shell env variable CC and CXX are set.

(0019754)
Joel Croteau   
2010-03-07 23:42   
Any progress on this bug? It still exists as of cmake 2.8.0. It happened to me while trying to compile Ogre on Mac OS 10.6, using unix makefiles, with cmake-gui. I tried specifying the compilers (CMAKE_C_COMPILER=/opt/local/bin/gcc-mp-4.5 and CMAKE_CXX_COMPILERS=/opt/local/bin/g++-mp-4.5) within cmake, and also setting the CC and CXX environment variables and telling cmake to use the defaults, and the exact same thing happened. Actually, the exact same thing seems to happen if I don't specify anything, in which case it uses the default of /opt/local/bin/g{cc,++}, it doesn't seem to want to create unix makefiles at all.
(0019755)
Bill Hoffman   
2010-03-08 09:38   
jcroteau, that sounds like something different...

If you set CC and CXX and run CMake on a clean build tree, does it work?

Changing the compiler after CMake has run just does not work very well. How did you set the compiler with cmake-gui? There is a dialog that should allow you to set them, when you run cmake-gui on an empty build tree, that works right?
(0019756)
Joel Croteau   
2010-03-08 11:00   
Happens with clean source tree. Happens with default compilers without CC and CXX set, so not sure what is causing this now, but it is the same phenomenon described above. Compiling Ogre SVN, latest version, unmodified, into separate, empty build directory. Xcode build works alright, only when making Unix Makefiles does this happen.
(0019757)
Bill Hoffman   
2010-03-08 11:07   
Exactly what happens, I don't think you are seeing the same thing, unless Ogre SVN is trying to change the compiler from the CMakeLists.txt files.


Can you do this:
1. checkout a clean SVN copy of Ogre to OgreSource
2. mkdir build
3. cd build
4. cmake -G"Unix Makefiles" ../OgreSource >& out

Then post the out file here (Truncated if it looks forever.).
(0019758)
Bill Hoffman   
2010-03-08 11:12   
I just tried on a mac with the Tests/Simple inside CMake.

1. cd CMake/Tests/Simple
2. mkdir build
3. ccmake ..
4. push c
5. push t
6. change the c++ to g++ CMAKE_CXX_COMPILER
7. push c
8. push g

It worked for me. Does it work for you?
(0019759)
Joel Croteau   
2010-03-08 11:27   
Result from attempted Ogre Build:

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Check for working C compiler: /opt/local/bin/gcc
-- Check for working C compiler: /opt/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Check for working CXX compiler: /opt/local/bin/c++
-- Check for working CXX compiler: /opt/local/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring OGRE 1.8.0unstable
-- Performing Test OGRE_GCC_HAS_SSE
-- Performing Test OGRE_GCC_HAS_SSE - Success
-- Performing Test OGRE_GCC_VISIBILITY
-- Performing Test OGRE_GCC_VISIBILITY - Success
-- Detected g++ 4.4.2

-- Enabling GCC visibility flags
-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- Search path: /Users/jcroteau/Source/Ogre/Build/Dependencies;/Users/jcroteau/Source/Ogre/Dependencies;/Users/jcroteau/Source/Ogre/Build/../Dependencies;/Users/jcroteau/Source/Ogre/../Dependencies
-- Looking for ZLIB...
-- checking for module 'zzip-zlib-config'
-- found zzip-zlib-config, version 1.2.3
-- Found ZLIB: optimized;/usr/lib/libz.dylib;debug;/usr/lib/libz.dylib
-- Looking for ZZip...
-- checking for module 'zziplib'
-- package 'zziplib' not found
-- Found ZZip: optimized;/opt/local/lib/libzzip.dylib;debug;/opt/local/lib/libzzip.dylib
-- Looking for FreeImage...
-- checking for module 'freeimage'
-- package 'freeimage' not found
-- Found FreeImage: optimized;/opt/local/lib/libfreeimage.dylib;debug;/opt/local/lib/libfreeimage.dylib
-- Looking for FREETYPE...
-- checking for module 'freetype2'
-- found freetype2, version 9.20.3
-- CMAKE_PREFIX_PATH: /Users/jcroteau/Source/Ogre/Build/Dependencies;/Users/jcroteau/Source/Ogre/Dependencies;/Users/jcroteau/Source/Ogre/Build/../Dependencies;/Users/jcroteau/Source/Ogre/../Dependencies;/usr/local
-- CMAKE_PREFIX_PATH: /Users/jcroteau/Source/Ogre/Build/Dependencies;/Users/jcroteau/Source/Ogre/Dependencies;/Users/jcroteau/Source/Ogre/Build/../Dependencies;/Users/jcroteau/Source/Ogre/../Dependencies;/usr/local
-- Found FREETYPE: optimized;/opt/local/lib/libfreetype.dylib;debug;/opt/local/lib/libfreetype.dylib
-- Looking for XOpenDisplay in /usr/X11R6/lib/libX11.dylib;/usr/X11R6/lib/libXext.dylib
-- Looking for XOpenDisplay in /usr/X11R6/lib/libX11.dylib;/usr/X11R6/lib/libXext.dylib - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/X11R6/lib/libX11.dylib
-- Looking for Cg...
-- Cg_PREFIX_PATH changed.
-- checking for module 'Cg'
-- package 'Cg' not found
-- Found Cg: -framework Cg
-- Looking for POCO...
-- checking for module 'POCO'
-- package 'POCO' not found
-- Found POCO: optimized;/opt/local/lib/libPocoFoundation.dylib;debug;/opt/local/lib/libPocoFoundationd.dylib
-- Looking for POCO_Util...
-- Found POCO_Util: optimized;/opt/local/lib/libPocoUtil.dylib;debug;/opt/local/lib/libPocoUtild.dylib
-- Looking for POCO_Net...
-- Found POCO_Net: optimized;/opt/local/lib/libPocoNet.dylib;debug;/opt/local/lib/libPocoNetd.dylib
-- Looking for POCO_NetSSL...
-- Could not locate POCO_NetSSL
-- Looking for POCO_XML...
-- Found POCO_XML: optimized;/opt/local/lib/libPocoXML.dylib;debug;/opt/local/lib/libPocoXMLd.dylib
-- Looking for TBB...
-- Found TBB: optimized;/Users/jcroteau/Source/Ogre/Dependencies/lib/libtbb.dylib;debug;/Users/jcroteau/Source/Ogre/Dependencies/lib/libtbb_debug.dylib
-- Looking for TBB_MALLOC...
-- Found TBB_MALLOC: optimized;/Users/jcroteau/Source/Ogre/Dependencies/lib/libtbbmalloc.dylib;debug;/Users/jcroteau/Source/Ogre/Dependencies/lib/libtbbmalloc_debug.dylib
-- Looking for TBB_MALLOC_PROXY...
-- Could not locate TBB_MALLOC_PROXY
-- Looking for OIS...
-- OIS_PREFIX_PATH changed.
-- checking for module 'OIS'
-- package 'OIS' not found
-- Found OIS: optimized;/Users/jcroteau/Source/Ogre/Dependencies/lib/release/libOIS.a;debug;/Users/jcroteau/Source/Ogre/Dependencies/lib/debug/libOIS.a
-- Found Doxygen: /Applications/Doxygen.app/Contents/Resources/doxygen
-- Looking for CppUnit...
-- checking for module 'cppunit'
-- found cppunit, version 1.12.1
-- Found CppUnit: optimized;/opt/local/lib/libcppunit.dylib;debug;/opt/local/lib/libcppunit.dylib
-- Looking for Carbon...
-- checking for module 'Carbon'
-- package 'Carbon' not found
-- Found Carbon: -framework Carbon
-- Looking for Cocoa...
-- checking for module 'Cocoa'
-- package 'Cocoa' not found
-- Found Cocoa: -framework Cocoa
-- Looking for IOKit...
-- checking for module 'IOKit'
-- package 'IOKit' not found
-- Found IOKit: -framework IOKit
--
-----------------------------------------------------------------------------
-- The following external packages were located on your system.
-- This installation will have the extra features provided by these packages.
+ zlib
+ zziplib
+ freeimage
+ freetype
+ X11
+ Xt
+ Xaw
+ OpenGL
+ OpenGL ES 1.x
+ OpenGL ES 2.x
+ cg
+ boost
+ boost-thread
+ boost-date_time
+ POCO
+ tbb
+ OIS
+ Doxygen
+ CppUnit
+ Carbon
+ Cocoa
+ IOKit
Congratulations! All external packages have been found.
-----------------------------------------------------------------------------

--
----------------------------------------------------------------------------
  FEATURE SUMMARY
----------------------------------------------------------------------------

Building components:
  + Paging
  + Property
  + Terrain
  + RTShader System
  + RTShader System Core Shaders
  + RTShader System Extensions Shaders
Building plugins:
  + BSP scene manager
  + Cg program manager
  + Octree scene manager
  + Portal connected zone scene manager
  + Particle FX
Building rendersystems:
  + OpenGL
Building executables:
  + Samples
  + Tools
Building core features:
  + DDS image codec
  + FreeImage codec
  + ZIP archives

Build type: dynamic
Threading support: background (boost)
Use double precision: disabled
Allocator type: nedmalloc (pooling)
STL containers use allocator: enabled
Strings use allocator: disabled
Memory tracker (debug): disabled
Memory tracker (release): disabled
Use new script compilers: enabled
Use Boost: enabled

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

-- Configuring done
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= /opt/local/bin/gcc
CMAKE_CXX_COMPILER= /opt/local/bin/c++

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Check for working C compiler: /opt/local/bin/gcc
-- Check for working C compiler: /opt/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Check for working CXX compiler: /opt/local/bin/c++
-- Check for working CXX compiler: /opt/local/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring OGRE 1.8.0unstable
-- Performing Test OGRE_GCC_HAS_SSE
-- Performing Test OGRE_GCC_HAS_SSE - Success
-- Performing Test OGRE_GCC_VISIBILITY
-- Performing Test OGRE_GCC_VISIBILITY - Success
-- Detected g++ 4.4.2

-- Enabling GCC visibility flags
-- Check if the system is big endian

and on and on....

Not sure if this is a CMake issue, or something with the Ogre CMakeLists. I didn't see anything to change the compiler there, but I will look at it more closely.

Tried your test with Simple, and pressing c the second time produced the error:
 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_CXX_COMPILER= /opt/local/bin/g++

Pressing g after this still successfully created a makefile.
(0019764)
Joel Croteau   
2010-03-08 16:32   
It appears this is partly a CMake problem, partly an Ogre problem. Relevant discussion is here http://www.ogre3d.org/forums/viewtopic.php?f=2&t=53897&start=0. [^] I don't know why the inclusion of those couple lines, even when not executed should cause this issue though.
(0019765)
Bill Hoffman   
2010-03-08 16:57   
It is an Ogre problem, you can not set the compiler from within a CMakelists.txt file. It will cause trouble almost every time...
(0019766)
Joel Croteau   
2010-03-08 17:03   
Ok, thanks for the help. I've submitted a patch to them that should fix it.
(0019768)
Bill Hoffman   
2010-03-08 17:29   
I will leave the bug open, as cmake should not go into a loop like that ever... But, the Ogre folks might want to rethink how they were forcing compilers in CMake.
(0032185)
CrumblingStatue   
2013-01-31 13:10   
(edited on: 2013-02-01 07:44)
I have this same issue on Arch Linux x86_64, CMake 2.8.10.2

The working directory consists of a single source file and a single CMakeLists.txt. See workdir.tar

Steps to reproduce:
mkdir build
cd build
cmake -DCMAKE_CXX_COMPILER=g++ ..
cmake -DCMAKE_CXX_COMPILER=g++ .. # Infinite loop on second invocation

This is a problem if you want to use the command you used on your previous CMake invocation (and change some options), but forget to remove the -DCMAKE_CXX_COMPILER definition. (In my case, Qt Creator's "run cmake" dialog presents the previous options used)

For example:
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release ..
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug .. # Change to Debug build
*infinite loop*

From my understanding, CMake could just ignore CMAKE_CXX_COMPILER flag if the value stays the same. (And even if it doesn't stay the same, it should print an error message like "Can't use different compilers in the same build directory, Create a new build directory!", instead of going into an infinite loop)

(0032639)
Brad King   
2013-03-15 09:03   
Re 0008193:0032185: The infinite loop you report is issue 0013756 and is fixed in 2.8.11.
(0034009)
Robert Maynard   
2013-10-07 10:04   
Closing resolved issues that have not been updated in more than 4 months.