View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012621CMakeCMakepublic2011-12-12 22:442013-01-09 10:56
ReporterDavid Rogers 
Assigned ToDavid Cole 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 2.8.6 
Target VersionCMake 2.8.8Fixed in VersionCMake 2.8.8 
Summary0012621: Compatibility with Xcode 4.3
DescriptionAs of the latest 4.3 beta, Apple is choosing to no longer install Xcode in /Developer. Instead packaging it as a single application bundle to be distributed via the App Store. Defaulting to /Applications but can be moved anywhere.

As of 2.8.7rc1, CMake cannot detect the location of compilers or tools that are installed in this bundle. As a result, projects cannot be generated.
Steps To ReproduceUninstall dev tools from /Developer, Install Xcode 4.3 beta, Attempt to configure a project.
TagsCMake, macosx, Xcode
Attached Filespatch file icon xcode43.patch [^] (1,554 bytes) 2012-02-20 12:13 [Show Content]
patch file icon cmake-xcode-4.3-compat.patch [^] (3,056 bytes) 2012-02-29 07:34 [Show Content]

 Relationships
has duplicate 0013100closedDavid Cole 0013048 CMake 2.8.7 Nightly fails to link correctly in XCode 4.3 
related to 0013048closedKitware Robot CMake 2.8.7 Nightly fails to link correctly in XCode 4.3 
related to 0013066closedDavid Cole Use OSX_DEVELOPER_ROOT in Platform/Darwin.cmake 
related to 0013082closedDavid Cole Projects without a build configuration called "Debug" do not load in XCode 4.3 
related to 0013144closedDavid Cole Compatibility with Xcode 4.2 (Build 4C199) 
related to 0013463closedBrad King Bug 12621 is maybe back 

  Notes
(0027956)
David Rogers (reporter)
2011-12-13 12:24

Sorry, I screwed up. replace 4.2 with 4.3.
(0028186)
Rowan James (reporter)
2012-01-04 23:18
edited on: 2012-01-04 23:20

Confirming this issue with Xcode 4.3 DP 2

Using Xcode to run 'shell script' build stages for external library targets, I've found that I can work around this issue with the environment variables for the toolchain and SDK directories that Xcode provides, like so:

PATH="${DT_TOOLCHAIN_DIR}/usr/bin:$PATH"
CC="$SDK_DIR/usr/bin/clang -L${SDK_DIR}/usr/lib"

cmake -DCMAKE_MAKE_PROGRAM="${SYSTEM_DEVELOPER_BIN_DIR}/make" -DCMAKE_INCLUDE_PATH="${SDK_DIR}/usr/include" -DCMAKE_LIBRARY_PATH="${SDK_DIR}/usr/lib" ../src

---

In my case, the variables expand roughly as:
SDK_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
DT_TOOLCHAIN_DIR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
SYSTEM_DEVELOPER_BIN_DIR=/Applications/Xcode.app/Contents/Developer/usr/bin

(0028605)
David Rogers (reporter)
2012-02-16 10:07

Xcode 4.3 has now been released and this has not been resolved on Apple's side so it looks like it will be up to you guys.
(0028608)
Sean McBride (reporter)
2012-02-16 12:10

Damn, you're right. /Developer is gone. The Xcode.app bundle now contains other apps like Instruments and the SDKs and headers. Weird.

You really should correct this bug's title to be 4.3 not 4.2.
(0028609)
David Rogers (reporter)
2012-02-16 12:19

I would love to but I don't have permission. Could an admin update the bug title for me?
(0028610)
Sean McBride (reporter)
2012-02-16 12:39

Xcode 4.3 release notes:

https://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_3.html#//apple_ref/doc/uid/1006-SW1 [^]
(0028611)
David Rogers (reporter)
2012-02-16 13:13

Thanks for the link. With those tools installed we get this error:

  xcodebuild: error: option '-buildstyle' is no longer supported
(0028613)
Chris H (reporter)
2012-02-17 07:28

The xcodebuild -buildstyle error happens because cmake falls back to using the Xcode 1.5 specific generator code. You can work around this by copying /Applications/Xcode.app/Contents/version.plist to /Developer/Applications/Xcode.app/Contents/version.plist.

Also, the generated projects reference the SDK in /Developer, this must be manually fixed before building.
(0028638)
Francisco Requena Espí (reporter)
2012-02-19 17:43

We're having the same issue here, cause we've moved to Xcode 4.3.
Is this planned to be fixed anytime soon?

Thanks.
(0028642)
aw70 (reporter)
2012-02-20 09:01

I can only second the wish for a really, really fast-track solution to this. We updated to Xcode 4.3 because our legacy cross-platform project (don't ask - one of "those" projects) managed to repeatably and consistently crash Xcode 4.2 during development. 4.2 built useable binaries, but having to re-start Xcode at least once during each build was fairly unnerving. So we jumped to Xcode 4.3 ASAP. Bad move, as it turned out...
(0028647)
Francisco Requena Espí (reporter)
2012-02-20 12:14
edited on: 2012-02-20 12:15

I've attached a temporal fix. It worked for me. Apply to the git repository, did it on tag 2.8.7. Hope it helps.

(0028648)
David Rogers (reporter)
2012-02-20 12:41

Thanks for the patch. It works great! The only issue that could arise that I see is if someone moves Xcode out of /Applications then this will fail again.
(0028649)
Sean McBride (reporter)
2012-02-20 12:59

Hardcoding those paths seems fragile. See the xcode-select man page. Maybe we can use "xcode-select -print-path"
(0028650)
Francisco Requena Espí (reporter)
2012-02-20 13:02
edited on: 2012-02-20 13:04

It's quite fragile indeed, and I don't like it that much. It's definitely not a serious fix, but a temporal solution until someone takes care of it (and does a better job).

About xcode-select, yes, I think it's a more appropriate solution.

(0028651)
aw70 (reporter)
2012-02-20 13:14

Thanks a lot for the patch! I had to perform some manual tweaks to the generated .xcodeproj in order for the whole thing to actually build again, though. In particular, the patched cmake still had trouble figuring out the isysroot variables. So what you posted is most likely not a complete fix for the problem. Also, I had to run xcode-select so cmake would run at all (the compiler test failed before that).

But then, what I am working with here is a rather odd project that generates a shared library (actually, on OS X, a framework), plus a bunch of command line programs that use said framework. And at least it is compiling again. So I'm not complaining - many thanks for having a working fix at such short notice!
(0028652)
Sean McBride (reporter)
2012-02-20 13:17

Francisco, I know your patch is just a quick fix, I only wanted to make sure you (and everyone) knew about xcode-select...
(0028653)
Francisco Requena Espí (reporter)
2012-02-20 13:45

Yeah, thanks for that :) I forgot to talk about setting up "xcode-select".
(0028654)
Graham Perks (reporter)
2012-02-20 13:49

It doesn't look like xcode-select is giving the correct output. I installed Xcode 4.3 and 'xcode-select -print-path' says '/Developer'. I have no longer have a /Developer!

This is before and after installing Xcode's command line tools.
(0028655)
Francisco Requena Espí (reporter)
2012-02-20 13:51

If you're moving from previous versions, I think you should change it:

xcode-select -switch /Applications/Xcode.app
(0028656)
Graham Perks (reporter)
2012-02-20 13:53

To get past the xcode-select issue, run: sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
(0028658)
Graham Perks (reporter)
2012-02-20 14:39

Either way, when I generate an Xcode project I get warnings about "Missing SDK in target..." and indeed it has the wrong path. It has:
   /Applications/Xcode.app/Contents/Developer/SDKs/MacOSX10.7.sdk
Ought to be:
   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk

This is after applying the patch provided above.
(0028659)
Graham Perks (reporter)
2012-02-20 14:56

Is there already a CMAKE flag to tell it to use the generic "Latest SDK", like Xcode allows you to choose, rather than a specific SDK path?
(0028663)
Francisco Requena Espí (reporter)
2012-02-20 16:12

It's weird, my application is linking to SDK 10.7, and handles it properly. I'm using Lion. It's clean, just formatted everything, and used Xcode 4.3 directly (no upgrading from 4.2).

It's not like it will solve the problem, but could you try doing xcode-select -switch /Applications/Xcode.app? (not xcode-select -switch /Applications/Xcode.app/Contents/Developer/)

PD: Maybe "man xcode-select" helps. Also, in Xcode's Preferences > Downloads, if you have Command Line Tools installed, click it and expand the lower icon (in order to get the description). That description may be useful (talks about xcode-select and xcrun)
(0028665)
Graham Perks (reporter)
2012-02-20 17:01

I tried both xcode-select styles, both result in the Missing SDK problem. I don't have anything in my CMakeLists.txt file about choosing an SDK - is there something I should add?
(0028666)
aw70 (reporter)
2012-02-20 17:06

FWIW, I also have the issue of an invalid SDK being chosen in the Xcode project. This is what I was referring to with "I had to edit some things by hand". In my case, everything works as expected once I manually select the correct targets.
(0028667)
Francisco Requena Espí (reporter)
2012-02-20 17:12

Hmm, are you using an existing Cache or something?

I think we'll need to check how CMake currently resolves that path.
(0028669)
aw70 (reporter)
2012-02-20 17:28

In my case, I I got rid of all caches (and the Xcode project) entirely before re-creating the project with the patched CMake. And with "invalid SDK", I mean one with a malformed path. As in: /Applications/Xcode.app/Contents/Developer/SDKs/MacOSX10.7.sdk, or something similar.

In case you have a hard time replicating this defective behaviour with your own projects: the stuff I'm working on is a project I could privately share with the cmake developers, if you are interested. Contact me directly if you feel that this might help you.
(0028719)
Thomas Goddard (reporter)
2012-02-25 04:19
edited on: 2012-02-25 04:20

The patch included in 2.8.7 does not work. The reason is that the patch stats /Developer/Applications/Xcode.app first, which most people don't have if they have Lion and Xcode in a fresh install. It looks like a small oversight. It should stat /Applications/Xcode.app, then if it exists, use that of course.

(0028720)
Francisco Requena Espí (reporter)
2012-02-25 04:22

I'm on a fresh Lion install. Just downloaded Xcode 4.3 from App Store. Have you tried xcode-select?
(0028721)
Jamie Kirkpatrick (reporter)
2012-02-25 09:30

I have a patch that fixes compatibility with Xcode 4.3 on systems without older versions of Xcode installed: https://github.com/Kitware/CMake/pull/15 [^]

It assumes the user has installed the CLI tools by opening the Xcode preferences window and choosing them from there.
(0028747)
Andrew Hill (reporter)
2012-02-28 23:01

Jamie Kirkpatrick's patch works for me (after fixing up the xcode-select path as noted above)
(0028749)
Andrew Hill (reporter)
2012-02-29 06:18
edited on: 2012-02-29 06:27

Ok so I may have spoken too soon.

I had a previous work-around still partially in place (some symlinks in /Developer to point to places in the new Xcode.app). One such symlink was linking /Developer/SDKs to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/.

After removing /Developer entirely, and deleting + rebuilding my projects, they stopped working again, giving me an error about no valid destination when trying to build any target. Also noticed that CMAKE_OSX_SYSROOT was pointing at a directory that didn't exist.

Setting CMAKE_OSX_SYSROOT to this path fixed the problem:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk

It looks like Apple have moved/restructured the location of SDKs, and instead of being at:
`xcode-select -print-path`/SDKs
There are now:
`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs
`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/SDKs
`xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/SDKs

Alternatively a symlink in /Applications/Xcode.app/Contents/Developer/, pointing to 'Platforms/MacOSX.platform/Developer/SDKs' seemed to work too.

(0028750)
Andrew Hill (reporter)
2012-02-29 07:01
edited on: 2012-02-29 07:36

I've posted comments about Jamie Kirkpatrick's patch on his pull request, and will duplicate here:

----

In Modules/Platform/Darwin.cmake, the variable CMAKE_OSX_SYSROOT is set based on lines 104 to 130.
While OSX_DEVELOPER_ROOT has likely been updated from the output of xcode-select (at least, if there's no /Developer directory), they reference the old (pre-Xcode-4.3) path structure:
${OSX_DEVELOPER_ROOT}/SDKs/MacOSX${_CURRENT_OSX_VERSION}.sdk

For me, this resolves to /Applications/Xcode.app/Contents/Developer/SDKs/MacOSX10.7.sdk, which doesn't exist.
(hence me having to enter it manually for cmake)
Instead, it should be finding /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk (as per the changes made to lines 74-76).

----

Also was just thinking that the test for the xcode-select utility (lines 68-72) should probably come before trying the hard-coded "/Developer" value for OSX_DEVELOPER_ROOT (line 60). Otherwise cmake will always ignore Xcode 4.3 if you have any previous version installed alongside it.
The first test should be to see if xcode-select exists, and whether it offers a useful path, falling back on "/Developer" if it doesn't. And only then should cmake start poking around in OSX_DEVELOPER_ROOT to find the right SDKs dir.
And later on, when setting CMAKE_OSX_SYSROOT, it should probably use the OSX_DEVELOPER_ROOT value instead of ${OSX_DEVELOPER_ROOT}/SDKs.
Even though this is starting to change some default behaviour (not just a basic fix), so is perhaps a bit beyond the scope of *this issue*, it strikes me as being important for Xcode 4.3 compatibility.
(compared to CMake master branch, my line numbers will be out by 3, if greater than 74, due to additional 3 lines in the patch)

----

Have attached cmake-xcode-4.3-compat.patch which is based on Jamie's pull request and addresses the above.

(0028758)
Thomas Harning (reporter)
2012-02-29 14:17

Note: this is also relevant for xcode 4.4 (Using Mountain Lion dev preview)
(0028765)
aw70 (reporter)
2012-02-29 17:56

One additional data point for you: cmake-xcode-4.3-compat.patch seems to work flawlessly for me, for a fairly complex project that generates both a framework, and several command line apps that depend on it. OS X 10.73, and I only have Xcode 4.3 on the machine, with no old XCode being retained.
(0028766)
Timothee Besset (reporter)
2012-02-29 20:32

I am using the next branch with the cmake-xcode-4.3-compat.patch applied:
cmake version 2.8.7.20120229-gb7153-dirty

I only have Xcode 4.3 on the system, cmake generated the project files just fine, looks good.
(0028771)
Torsten Maehne (reporter)
2012-03-01 10:25
edited on: 2012-03-01 10:26

I applied cmake-xcode-4.3-compat.patch to the cmake 2.8.7 tar ball, After installing the command line tools from within Xcode 4.3 and doing:

$ xcode-select -switch /Applications/Xcode.app/Contents/Developer

CMake is able to generate again Unix Makefiles and Xcode projects for my projects without errors.

(0028802)
David Cole (manager)
2012-03-03 14:56

Since we are preferring the "/Applications" location in the C++ code to look up the version of Xcode, I think we should also prefer the 4.3+ SDK locations first, before falling back to the older SDK locations. Does that seem reasonable to everybody watching here?

Thx,
David C.
(0028803)
Garth Snyder (reporter)
2012-03-04 00:08

----
Since we are preferring the "/Applications" location in the C++ code to look up the version of Xcode, I think we should also prefer the 4.3+ SDK locations first, before falling back to the older SDK locations. Does that seem reasonable to everybody watching here?
----

That sounds reasonable to me.

Apple's release notes mention the option of leaving the old versions of the developer tools installed even under 4.3, so that's apparently at least a somewhat supported configuration. If the path precedences aren't treated consistently, I would imagine it's just an invitation to hard-to-diagnose version skew problems.

On my development system, which is 4.3-only but previously had 4.2 installed, the cmake-xcode-4.3-compat.patch and xcode-select fixes seem to work fine.
(0028806)
Ramkumar Thiyyakat (reporter)
2012-03-05 02:44

Hi All,


     I'm very new to Cmake and I don't know how to apply patch files.While running cmake -G Xcode command I'm getting

-- Check for working C compiler using: Xcode -- broken
CMake Error at /Applications/CMake 2.8-7.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "/usr/bin/gcc" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/ramkumar/MySQL/mysql-connector-c-6.0.2/CMakeFiles/CMakeTmp

  

  Run Build Command:/Applications/CMake\ 2.8-7.app/Contents/bin/cmakexbuild
  -project CMAKE_TRY_COMPILE.xcode build -target cmTryCompileExec -buildstyle
  Development

  xcodebuild: error: option '-buildstyle' is no longer supported


Please help me to solve this.I need to install mysql client library using cmake.I'm using xcode 4.3.
(0028873)
David Cole (manager)
2012-03-08 23:10

Fix pushed to 'next' branch:

  http://public.kitware.com/gitweb?p=cmake.git;a=commitdiff;h=4693cf84927850da0c10aae4308363fdc5890379 [^]
(0028916)
David Cole (manager)
2012-03-14 10:06

Plus one more patch to get CPack to play nice with PackageMaker instances accessed via symlink:

  http://public.kitware.com/gitweb?p=cmake.git;a=commitdiff;h=0f4dfa6960e51b7460b91f828932a42d5827467a [^]
(0032041)
Robert Maynard (manager)
2013-01-09 10:56

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2011-12-12 22:44 David Rogers New Issue
2011-12-13 12:24 David Rogers Note Added: 0027956
2012-01-04 23:18 Rowan James Note Added: 0028186
2012-01-04 23:20 Rowan James Note Edited: 0028186
2012-01-05 20:43 Rowan James Tag Attached: CMake
2012-01-05 20:43 Rowan James Tag Attached: macosx
2012-01-05 20:43 Rowan James Tag Attached: Xcode
2012-02-16 10:07 David Rogers Note Added: 0028605
2012-02-16 12:10 Sean McBride Note Added: 0028608
2012-02-16 12:19 David Rogers Note Added: 0028609
2012-02-16 12:39 Sean McBride Note Added: 0028610
2012-02-16 13:13 David Rogers Note Added: 0028611
2012-02-17 07:28 Chris H Note Added: 0028613
2012-02-19 17:43 Francisco Requena Espí Note Added: 0028638
2012-02-20 09:01 aw70 Note Added: 0028642
2012-02-20 12:13 Francisco Requena Espí File Added: xcode43.patch
2012-02-20 12:14 Francisco Requena Espí Note Added: 0028647
2012-02-20 12:15 Francisco Requena Espí Note Edited: 0028647
2012-02-20 12:41 David Rogers Note Added: 0028648
2012-02-20 12:59 Sean McBride Note Added: 0028649
2012-02-20 13:02 Francisco Requena Espí Note Added: 0028650
2012-02-20 13:04 Francisco Requena Espí Note Edited: 0028650
2012-02-20 13:14 aw70 Note Added: 0028651
2012-02-20 13:17 Sean McBride Note Added: 0028652
2012-02-20 13:45 Francisco Requena Espí Note Added: 0028653
2012-02-20 13:49 Graham Perks Note Added: 0028654
2012-02-20 13:51 Francisco Requena Espí Note Added: 0028655
2012-02-20 13:53 Graham Perks Note Added: 0028656
2012-02-20 14:39 Graham Perks Note Added: 0028658
2012-02-20 14:56 Graham Perks Note Added: 0028659
2012-02-20 16:12 Francisco Requena Espí Note Added: 0028663
2012-02-20 17:01 Graham Perks Note Added: 0028665
2012-02-20 17:06 aw70 Note Added: 0028666
2012-02-20 17:12 Francisco Requena Espí Note Added: 0028667
2012-02-20 17:28 aw70 Note Added: 0028669
2012-02-25 04:19 Thomas Goddard Note Added: 0028719
2012-02-25 04:20 Thomas Goddard Note Edited: 0028719
2012-02-25 04:22 Francisco Requena Espí Note Added: 0028720
2012-02-25 09:30 Jamie Kirkpatrick Note Added: 0028721
2012-02-28 23:01 Andrew Hill Note Added: 0028747
2012-02-29 06:18 Andrew Hill Note Added: 0028749
2012-02-29 06:27 Andrew Hill Note Edited: 0028749
2012-02-29 07:01 Andrew Hill Note Added: 0028750
2012-02-29 07:03 Andrew Hill Note Edited: 0028750
2012-02-29 07:34 Andrew Hill File Added: cmake-xcode-4.3-compat.patch
2012-02-29 07:36 Andrew Hill Note Edited: 0028750
2012-02-29 14:09 Brad King Summary Compatibility with Xcode 4.2 => Compatibility with Xcode 4.3
2012-02-29 14:09 Brad King Description Updated
2012-02-29 14:11 Brad King Steps to Reproduce Updated
2012-02-29 14:15 Brad King Assigned To => David Cole
2012-02-29 14:15 Brad King Status new => assigned
2012-02-29 14:17 Thomas Harning Note Added: 0028758
2012-02-29 17:56 aw70 Note Added: 0028765
2012-02-29 20:32 Timothee Besset Note Added: 0028766
2012-03-01 10:25 Torsten Maehne Note Added: 0028771
2012-03-01 10:26 Torsten Maehne Note Edited: 0028771
2012-03-02 12:16 Michael Josephson Note Added: 0028795
2012-03-03 09:49 Michael Josephson Note Deleted: 0028795
2012-03-03 14:56 David Cole Note Added: 0028802
2012-03-04 00:08 Garth Snyder Note Added: 0028803
2012-03-05 02:44 Ramkumar Thiyyakat Note Added: 0028806
2012-03-08 23:08 David Cole Target Version => CMake 2.8.8
2012-03-08 23:10 David Cole Note Added: 0028873
2012-03-08 23:10 David Cole Status assigned => resolved
2012-03-08 23:10 David Cole Fixed in Version => CMake 2.8.8
2012-03-08 23:10 David Cole Resolution open => fixed
2012-03-14 10:06 David Cole Note Added: 0028916
2012-03-19 08:37 Brad King Relationship added related to 0013048
2012-03-26 09:20 Brad King Relationship added related to 0013066
2012-04-02 08:38 Brad King Relationship added related to 0013082
2012-04-03 12:01 David Cole Relationship added has duplicate 0013100
2012-04-18 11:40 Brad King Relationship added related to 0013144
2012-08-10 13:04 Brad King Relationship added related to 0013463
2013-01-09 10:56 Robert Maynard Note Added: 0032041
2013-01-09 10:56 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team