Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Compiling with Xcode 4.3 #26

Closed
mattconnolly opened this Issue January 12, 2012 · 34 comments
Matt Connolly

If you're an Apple developer and have access to the preview release of Xcode 4.3, you will find that this gem fails to compile 'fsevent/fsevent_watch.c' with the following error:

Building native extensions.  This could take a while...
ERROR:  Error installing rb-fsevent:
    ERROR: Failed to build gem native extension.

        /Users/matt/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
creating Makefile
CFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -mdynamic-no-pic -std=gnu99 -Os -pipe -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wuninitialized -Wunknown-pragmas -Wshadow -Wfour-char-constants -Wsign-compare -Wnewline-eof -Wconversion -Wshorten-64-to-32 -Wglobal-constructors -pedantic' /usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -mdynamic-no-pic -std=gnu99 -dead_strip -framework CoreServices -o '/Users/matt/.rvm/gems/ruby-1.9.3-p0/gems/rb-fsevent-0.4.3.1/bin/fsevent_watch' fsevent/fsevent_watch.c
fsevent/fsevent_watch.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.
extconf.rb:59:in `<main>': Compilation of fsevent_watch failed (see README) (RuntimeError)

I'm guessing it's due to the changes to install locations with Xcode 4.3.... (but don't have the time to look further into it at this point - sorry).

Travis Tilley
Collaborator
Travis Tilley
Collaborator

Note on unix userspace tools:

Note: 
This preview release does not include Unix development tools placed into /usr. 
To perform makefilebased and config-based builds, either install Xcode 4.2.1 or 
use xcrun to execute the tools provided within Xcode

Further down, a note that also says the unix headers aren't installed to the system:

Build failures against Current Mac OS
Xcode 4.3 developer preview 3 does not include Unix development tools and headers. 
This includes headers in /System/Library/Frameworks. If a project specifies Current 
Mac OS as its SDK and an earlier version of Xcode is not installed, the project fails 
to build.
Workaround: Either install Xcode 4.2.1 or change the project to build with the Latest 
OS X SDK

...which I guess means that I should potentially switch from "current" to "latest" as the SDK target. You'll still have problems compiling any standard unix software outside of xcode though. :-/

Travis Tilley
Collaborator

Since it's listed as a "known issue" and not an upgrade note, I'm expecting this to be something they resolve before 4.3 is finalized.

Matt Connolly

Thanks for this info - may help others who encounter the same issue.

I have both 4.2.1 and 4.3 preview installed, but it was building against 4.3.

For others who have both installed and encounter this issue, you need to "select" which Xcode to use, with the following command:

$ sudo xcode-select -switch /Developer

Then the gem installs correctly. Don't forget to change it back if you want to use 4.3 preview again after.

Matt Connolly mattconnolly closed this January 12, 2012
Aaron Stone

Better solution: install "Command Line Tools"
https://developer.apple.com/downloads/index.action?name=for%20Xcode
(May require login)

zipme

I installed the xcode 4.3 as well as the "Command Line Tools", still got the error:
creating Makefile
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -mdynamic-no-pic -std=gnu99 -Os -pipe -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wuninitialized -Wunknown-pragmas -Wshadow -Wfour-char-constants -Wsign-compare -Wnewline-eof -Wconversion -Wshorten-64-to-32 -Wglobal-constructors -pedantic' /usr/bin/clang -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -mdynamic-no-pic -std=gnu99 -dead_strip -framework CoreServices -o '/Users/genki/.rvm/gems/ruby-1.9.3-p0-perf/gems/rb-fsevent-0.4.3.1/bin/fsevent_watch' fsevent/fsevent_watch.c
fsevent/fsevent_watch.c:1:10: fatal error: 'stdio.h' file not found
#include

Aaron Stone
Travis Tilley
Collaborator

I believe you need to xcode-select -switch /usr/bin ?

Note that with xcode 4.4, which has a UI for installing the command line tools package from within xcode, everything just works. Perhaps the next 4.3 developer preview will include additional support and fixes that bring it in line with 4.4.

Letian Zhang

I'm using Xcode 4.3 and set

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/

It built successfully. Hope this helps:)

zipme

@clippit wow, it works, thanks!

Nick Peelman

@clippit that works for me as well. Thanks!

Pihrra

@clippit worked for me as well thank you !

Rich Ellis

@clippit And me, thanks!

Stewart Matheson

+1 for @clippit 's solution

Erik P. Hansen

@clippit ’s solution worked for me as well! Only wasted a few hours on this :) Thank you!

陈鲸飞

@clippit and me!

Brett Shomaker

yay @clippit - worked for me. Before finding this comment I had guessed just switching to /Applications/Xcode.app/, but the full path down to Contents/.../Developer is required.

George Pilitsoglou

thanks @clippit it also worked for me sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/

Aaron Stone

No more "me too" comments please!

Aaron Thornton

Just one more, I cant resist. Clip it, you rock.

Ahmed Al Hafoudh

*uck yeah! Thanks :) Works @clippit

Ralphos

Sending thanks to @clippit!

Stephen Ball
sdball commented May 08, 2012

No seriously, I didn't expect it to work but @clippit saved the day.

hpyhacking

Thanks to @clippit, but Homebrew need to flowing setting

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Jackson Mohsenin

@clippit you're the man.

Will Prater
wprater commented May 16, 2012

@clippit Can you explain why the alternate path? Is there a non-llvm gcc compiler in that path?

Rahul Bansal

@clippit Thanks a ton! :-)

p.s. this may annoy some but can't control my urge to thank @clippit

Oliver

thanks for this answer !!!

Simon Bailey

Word @clippit you da man!

Ram Kumar

I just want some things to "simply work" while I focus on my ruby/rails development. This is one. Definitely calls for a thanking to @clippit

Merovex

Ran into this problem... the solution above did not work. But, the software I was running seemed to want to install an earlier version...I forced it to load the more recent version and all is now right with the world.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.