-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Fix Xcode 4.3 w/o CLT and CLT w/o Xcode #10510
Conversation
# Some tools (clang, etc.) are in the xctoolchain dir of Xcode | ||
ENV.append 'PATH', "#{MacOS.xctoolchain_path}/usr/bin", ":" unless ORIGINAL_PATHS.include? "#{MacOS.xctoolchain_path}/usr/bin" | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit should probably go in ENV.setup_build_whatsit
. Since that is called at the right time.
I'd say yes, this is a good enough check for now. Also you should add an Also not sure if it's there but adding to Great work on this! Very happy to see some progress. |
If you can get this working, great! |
Glad, you are positive about this. I hope we can get this stable quickly because many tiny changes are made which will make it difficult to merge if the main repro diverges too far. Updates:
I'll try to build more and more formulae with this setup and when it fails I build on my newly lion-ized MacMini where I have only the CLT package but no Xcode. So I can tell if a build fails because of my changes. |
Great, give it some more testing (sadly I cannot help, need another mac). If it seems to be working we'll merge (after I review a little more carefully) and add a Even once we have more user-testing for it we will probably leave the warning (less severe) because I bet a lot of build systems out there will be very surprised that build tools aren't in |
What is the general purpose of this? I'm sorry to ask that simple question, but my confusion is this: |
@mxcl brew doctor tells that this is "Experimental" in commit cf3893d, if that is ok for you. Suggestions welcome. Give me a bit more time to test this. @2bits Your question is valid. Let me answer it.
|
@2bits hey, you changed your question while I was answering :-) |
I often think omg i did not just post that. So now I understand more. It sounds fun, like a treasure hunt. |
Status update:
Overall it looks pretty promising I would say. |
graphviz and valgrind are oddballs you might like to test with. Great news, your success so far. |
@2bits hmm http://trac.macports.org seems down right now. Cannot test graphviz because patches are not loading. |
So I am pretty happy with the functionality right now. It works for both Xcode 4.3 without CLTs and for CLTs without Xcode 4.3. The --config and doctor can handle both cases and prints useful information about the experimental state. I hope I did'nt break anything for older Xcode and the default /Developer dir. Formulae that did not build are mostly due to hardcoded paths in the formula or build scripts and we cannot do much about this besides patching or tweaking the specific formula. Is there anybody with an older system who could test After that, I think this stuff is ready for squash and code-review by the core devs. |
updated title and description to reflect the fact that this now also handles the case of CLTs w/o Xcode. |
ok, what fails right now:
|
haha, on a fresh Lion with Xcode (no CLT) |
Those X11 includes can be merciless. Here is what I see with the CLT only.
I was interested when you found a brewed python linked to system /usr/lib/libpython. I'm going to brew one and see what |
For the python thing, I'd rather go for --framework always. I have to rework ENV.x11, too. |
@2bits Thanks for the list! I have two Macs one with Xcode but no CLTs and one with the CLTs but no Xcode. (both freshly installed with Lion). I modified ENV.x11 to include freetype2 to the cflags. Yet, I am unsure if the others (you listed) should be put there, too. Perhaps it's best to wait and see if something fails because it cannot find , e.g. "fontconfig". Then we explicitly add it. The problem with python (only non-framework build):I only have it when I build with this proposed Xcode 4.3 w/o CLT modification (this pull request here). It seems that python without the --framework somehow picks the systems lib and/or config. At least the systems distribute is found and then fails because it's not allowed to write in /Sytem... : From
Argh! That must be why the gods warned us about dupes! Update on cmake:I am stuck at the point where ./bootstrap of CMAKE fails to find ZLIB. I tend to blame cmake for not finding it because the other system libs are found (even if they are in the SDK). At least the bottle of cmake works for now (to install other cmake-dependent formula) |
CMake is shit, though @MikeMcQuaid would marry it for some reason. |
CMake needs fixed. There's discussion going on here Kitware/CMake#15 I like CMake because it's a cross-platform buildsystem that works pretty much everywhere. |
@MikeMcQuaid I don't know much about cmake :-/ |
For finding zlib, did you try |
I tried, yes @2bits but there are no options other than using built-in zlib. |
Also you can adjust the FindZLIB.cmake to add some printfs. So you can change the ZLIB_ROOT part to read:
That combined with |
A question of style: Do you prefer:
I had the extra "macosx" in there because theoretically you could have |
|
Then let me do that tomorrow. Don't pull this today :-) |
@mistydemeo I pushed a new (sqaushed) commit with the shorter I added |
Allow XCode without the Command Line Tools to work with homebrew, so it's not necessary to register an Apple Dev ID and/or go to the XCode prefs and download the CLT. Yay! Further, this commit allows to use the CLT solely (without the need for XCode). Saves quite some megs. (Some furmulae require xcodebuild) Of course XCode together with the CLT is still fine and has been tested on 10.7 and 10.6 with Xcode 4 and Xcode 3. Only on Lion or above, tell the user about the options, which are - Xcode without CLT - CLT without Xcode - both (ok, it's not directly stated, but implicit) So if no Xcode is found and we are on Lion or above, we don't fail but check for the CLTs now. For older Macs, the old message that Xcode is needed and the installer should be run is still displayed. If the CLT are not found but Xcode is, then we print out about the experimental status of this setup.
last (squashed) commit fixes some minor style issues pointed out by @adamv. Thanks. |
What will change for people with Xcode and CLT (so the classic setup) with my changes is:
For the doctor.rb: I'd like to make the Error about the "experimental status" into a warning but that seems not to be possible with the doctor.rb, currently. The question is if we are bold enough to remove these warnings? At least the Xcode-only setup should be sufficient to build everything. The CLT-only version cannot build some xcodebuild-based projects and some frameworks are missing (the headers). |
Let's leave it a few weeks and see if it causes any problems before removing the current error/warning. Seems good to me otherwise. |
So shall it be. |
Is there any other testing we want to do before pulling this? |
I think it's been tested enough and we need to just pull the lever. As long as we can revert it easily: let's do it. |
Yay! Thanks all. |
Sweet! Outstanding work and many thanks!!! |
Congratulations @samueljohn and thanks for all the hard work and patience. |
Thanks again for your awesome work, @samueljohn! |
Allow XCode without the Command Line Tools to work with homebrew, so it's not necessary to register an Apple Dev ID and/or go to the XCode prefs and download the CLT. Yay! Further, this commit allows to use the CLT solely (without the need for XCode). Saves quite some megs. (Some furmulae require xcodebuild) Of course XCode together with the CLT is still fine and has been tested on 10.7 and 10.6 with Xcode 4 and Xcode 3. Only on Lion or above, tell the user about the options, which are - Xcode without CLT - CLT without Xcode - both (ok, it's not directly stated, but implicit) So if no Xcode is found and we are on Lion or above, we don't fail but check for the CLTs now. For older Macs, the old message that Xcode is needed and the installer should be run is still displayed. If the CLT are not found but Xcode is, then we print out about the experimental status of this setup. Closes Homebrew#10510. Signed-off-by: Adam Vandenberg <[email protected]>
Allow XCode without the Command Line Tools to work with homebrew, so it's not necessary to register an Apple Dev ID and/or go to the XCode prefs and download the CLT. Yay! Further, this commit allows to use the CLT solely (without the need for XCode). Saves quite some megs. (Some furmulae require xcodebuild) Of course XCode together with the CLT is still fine and has been tested on 10.7 and 10.6 with Xcode 4 and Xcode 3. Only on Lion or above, tell the user about the options, which are - Xcode without CLT - CLT without Xcode - both (ok, it's not directly stated, but implicit) So if no Xcode is found and we are on Lion or above, we don't fail but check for the CLTs now. For older Macs, the old message that Xcode is needed and the installer should be run is still displayed. If the CLT are not found but Xcode is, then we print out about the experimental status of this setup. Closes Homebrew#10510. Signed-off-by: Adam Vandenberg <[email protected]>
Allow XCode without the Command Line Tools to work with homebrew, so it's not necessary to register an Apple Dev ID and/or go to the XCode prefs and download the CLT. Yay! Further, this commit allows to use the CLT solely (without the need for XCode). Saves quite some megs. (Some furmulae require xcodebuild) Of course XCode together with the CLT is still fine and has been tested on 10.7 and 10.6 with Xcode 4 and Xcode 3. Only on Lion or above, tell the user about the options, which are - Xcode without CLT - CLT without Xcode - both (ok, it's not directly stated, but implicit) So if no Xcode is found and we are on Lion or above, we don't fail but check for the CLTs now. For older Macs, the old message that Xcode is needed and the installer should be run is still displayed. If the CLT are not found but Xcode is, then we print out about the experimental status of this setup. Closes Homebrew#10510. Signed-off-by: Adam Vandenberg <[email protected]>
This request is now about both
Having Xcode 4.3 without the command line tools, it is currently not possible to build anything.
Sadly, downloading the CLT requires a Developer ID (free, but still).
Since everything needed is basically within /Applications/Xcode.app, it would be cool, if homebrew could just use that. And further it is now possible to _only have the CLTs installed without Xcode to save quite some megs.
I made an attempt to set the correct paths. Therefore, I moved the xcrun method to MacOS.xcrun for the indirection. Further, I coded MacOS.macosxsdk to setup all the needed CFLAGS, CPPFLAGS, LDFLAGS, and so on using xcodebuild to query the path to the sdk. This is set up in ENV.setup_build_environment.
I took extra care not to break things on machines that have not the Xcode 4.3.
Most formulae that use
./configure && make
work out of the box with this code. SimpleMakefiles
with hard-codedCFLAGS
are somewhat problematic because they don't pick up the new locations of the SDKs.Still ToDo: