View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003618CMakeCMakepublic2006-08-15 18:032007-10-12 10:59
ReporterSean McBride 
Assigned ToBill Hoffman 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0003618: Pass -arch even if CMAKE_OSX_ARCHITECTURES has only one item
DescriptionCMake allows Universal Binaries to be built with this:

CMAKE_OSX_ARCHITECTURES:STRING=ppc;i386

For a while now, ppc64 has been another option. And starting with Xcode 2.4, x86_64 is yet another.

I'd like to see CMAKE_OSX_ARCHITECTURES accept all four: ppc, ppc64, i386, and x86_64.

It should be pretty easy to add I would think. All 4 are passed to gcc the same way, with "-arch".

Thanks.
TagsNo tags attached.
Attached Filestxt file icon 3618patch.txt [^] (868 bytes) 2007-08-31 15:35 [Show Content]

 Relationships

  Notes
(0004652)
Bill Hoffman (manager)
2006-08-15 20:21

The ppc and i386 are not hard-coded. You should be able to just set CMAKE_OSX_ARCHITECTURES and it should work.
(0004816)
Sean McBride (reporter)
2006-08-30 16:43

It does not seem to work.

If you look at this build:
http://www.cmake.org/Testing/Sites/RogueResearchPPCDev/MacOSX10.4.7-gcc4.0.1/20060830-1713-Experimental/Notes.html [^]

you'll see I specified "CMAKE_OSX_ARCHITECTURES:STRING=ppc64" and yet everything built (it should not have, as cmake uses CoreFoundation which does not exist in ppc64 on 10.4).

Then look this this build:
http://www.cmake.org/Testing/Sites/RogueResearchPPCDev/MacOSX10.4.7-gcc4.0.1/20060830-1823-Experimental/Notes.html [^]

Where I specified "-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc64" in the CFLAGS and CXXFLAGS.

And it failed to build, as expected.

This is on a G5 running Xcode 2.4 on OS 10.4.7 using "cmake version 2.4-patch 3".
(0005403)
Bill Hoffman (manager)
2006-10-16 10:34

OK, I tracked this down a bit... If CMAKE_OSX_ARCHITECTURES has only one arch in it, it is ignored. So if you set the CMAKE_OSX_ARCHITECTURES to ppc;ppc64 then it would do something. If you set it to just ppc64 then it will just be ignored. The idea being that this was for use for universal binaray creation and not just cross compiling. If there is only one entry it is assumed to be a local build.

I guess I could have it check to see if it matches the local machine? What do you think?
(0005455)
Sean McBride (reporter)
2006-10-18 13:05

Bill, thanks for tracking this down! Well, as you probably know, the G5 is 64 bit, and so natively can run both 'ppc' and 'ppc64'. So it's not really cross compilation per say, but rather specifiying the exact type of compilation desired. I would very much like to see all of the following work from any machine:

CMAKE_OSX_ARCHITECTURES:STRING=ppc
CMAKE_OSX_ARCHITECTURES:STRING=ppc64
CMAKE_OSX_ARCHITECTURES:STRING=ppc;ppc64
CMAKE_OSX_ARCHITECTURES:STRING=ppc;ppc64;i386
etc.

Also, keep in mind that the Universal Binary concept does not merely refer to 32bit ppc and 32bit 386. Eventually, I hope to be able to build vtk as a 4-way universal binary containing ppc, pcc64, i386, and x86_64.

I think changing CMake to do this should not be a big deal, as all CMake does (as I understand it) it change the -arch flag it passes to gcc (or icc I suppose).

So, to answer your question, I would not even check against the local machine, just use CMAKE_OSX_ARCHITECTURES to set the -arch flag. For example, I may want to build an x86_64-only build from my ppc.

What do you think?

Thanks.
(0005467)
Bill Hoffman (manager)
2006-10-18 23:59

Any of the ones you listed with more than one arch should work in cmake today. I am not sure what the affect always having -arch would be. Would it hurt?
(0005473)
Sean McBride (reporter)
2006-10-19 11:14

No, it would not hurt. I have confirmed this by looking at the actual arguments Xcode.app passes to gcc. -arch is always there, even in non-fat builds.
(0006229)
Sean McBride (reporter)
2007-01-22 11:44

Just to elaborate a little bit... I would like to set up a dashboard to test a 64bit build of cmake. If I specify CMAKE_OSX_ARCHITECTURES:STRING=ppc;ppc64 then all the dashboard tests will run in 32bit mode, because it is preferred over 64bit. That's why I'd like to be able to specify CMAKE_OSX_ARCHITECTURES:STRING=ppc64 (just the one) so that everything is built as 64 bit only, and I can then be sure that all tests are running in 64 bit. This isn't cross compilation. ppc64 is just as native for the G5 as ppc32.
(0007624)
Sean McBride (reporter)
2007-05-10 18:13

I have updated the summary/title of this bug to better describe the real problem.

Also, I believe this can be fixed by changing _one character_ in the CMake source. :)

cmLocalGenerator::AddLanguageFlags() has the line:

      if(archs.size() > 1)

Just change it to

      if(archs.size() > 0)

And I think the problem is fixed.

Again, the reason I want -arch passed all the time is because -arch is not only for making Universal Binaries. I may want to build 64-bit only (-arch ppc64) or G4+ only (-arch ppc7400).

This is not cross compilation. ppc, ppc7400, and ppc64 are all native on the G5.
(0008796)
Sean McBride (reporter)
2007-08-31 15:36

New patch attached. I tested, and it works for me.
(0009432)
Bill Hoffman (manager)
2007-10-12 10:59

$ cvs commit -m "BUG: fix for bug 0003618 , allow one arch in OSX_ARCHS to work" cmLocalGenerator.cxx
Checking for path: /cvsroot/CMake/CMake/Source
Unrestricted user: hoffman
/cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v <-- cmLocalGenerator.cxx
new revision: 1.237; previous revision: 1.236

 Issue History
Date Modified Username Field Change
2007-08-31 15:35 Sean McBride File Added: 3618patch.txt
2007-08-31 15:36 Sean McBride Note Added: 0008796
2007-10-12 10:59 Bill Hoffman Status new => closed
2007-10-12 10:59 Bill Hoffman Note Added: 0009432
2007-10-12 10:59 Bill Hoffman Resolution reopened => fixed


Copyright © 2000 - 2018 MantisBT Team