MantisBT - CMake
View Issue Details
0002871CMakeCMakepublic2006-02-10 10:582006-03-09 16:40
Sean McBride 
Bill Hoffman 
urgentmajoralways
closedfixed 
 
 
0002871: cmake can't build itself as a universal binary on Mac OS X
cmake is almost able to build itself as a universal binary! But not quite...

http://www.cmake.org/Testing/Sites/RogueResearchPPC/MacOSX10.4.3-gcc4.0.1-universal/20060210-0518-Experimental/BuildWarning.html [^]
http://www.cmake.org/Testing/Sites/RogueResearchPPC/MacOSX10.4.3-gcc4.0.1-universal/20060210-0518-Experimental/BuildError.html [^]

The problem is this:

Building CXX object Source/CMakeFiles/ccmake.dir/CursesDialog/cmCursesPathWidget.o
Building CXX object Source/CMakeFiles/ccmake.dir/CursesDialog/cmCursesStringWidget.o
Building CXX object Source/CMakeFiles/ccmake.dir/CursesDialog/cmCursesWidget.o
Building CXX object Source/CMakeFiles/ccmake.dir/CursesDialog/ccmake.o
Linking CXX executable ../bin/ccmake
/usr/bin/ld: for architecture i386
/usr/bin/ld: warning /usr/local/lib/libcurses.dylib cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)

For some reason its using libcurses.dylib from /usr/local/lib/ instead of /Developer/SDKs/MacOSX10.4u.sdk/usr/lib. The former is PPC only, the latter is the Universal Apple-supplied one.

CMake correctly links everything against libs in the 10.4u SDK, but not this one lib. I don't know why.

You can see here:
http://www.cmake.org/Testing/Sites/RogueResearchPPC/MacOSX10.4.3-gcc4.0.1-universal/20060210-0518-Experimental/Notes.html [^]

That the flags I give are correct:

"CFLAGS=-Wall -Wextra -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
"CXXFLAGS=-Wall -Wextra -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"

If I remove the "-arch i386" part everything builds, though I suspect it is still using the wrong curses lib, though for ppc only it would of course link.

I am using cmake version 2.3-20060207 in my nightly builds.

See also 2492.
No tags attached.
Issue History

Notes
(0003726)
Eric Wing   
2006-02-10 19:04   
You might need to set additional LDFLAGS to make this work. Try:
LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"

As I requested in one of my other bugs, once we figure out the correct flags, CMake really needs a simple option that can be set so the users don't have to know all this and will automatically invoke the correct flags on their behalf. This is too much to know and remember.

(0003739)
Sean McBride   
2006-02-14 11:03   
Eric, thanks for the idea, but I tried and then I get big errors:

/usr/bin/gcc -Wall -Wextra -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk "CMakeFiles/cmTryCompileExec.dir/testCCompiler.o" -o cmTryCompileExec
/usr/bin/ld: -syslibroot: multiply specified
collect2: ld returned 1 exit status

Which is in fact familiar, see:
<http://lists.apple.com/archives/unix-porting/2005/Oct/msg00003.html> [^]

So I think the problem is elsewhere...
(0003831)
Sean McBride   
2006-03-03 12:46   
Anyone at kitware have any ideas on this? I'd like to get cmake building itself, so that my dashboard can run the tests...
(0003838)
Bill Hoffman   
2006-03-06 15:26   
I have fixed this in CVS.

Setting CFLAGS and CXXFLAGS as follows now works:
"CFLAGS=-Wall -Wextra -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
"CXXFLAGS=-Wall -Wextra -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"

Currently, it has only been tested for the makefiles and not the Xcode generator.
(0003859)
Sean McBride   
2006-03-09 16:40   
Confirmed, thanks! Now cmake can build itself as universal and all its self tests pass. sweet.