Compiling with Xcode 4.3 #26

mattconnolly opened this Issue Jan 12, 2012 · 34 comments


None yet

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/ -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/ -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-' 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).


Note on unix userspace tools:

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 

...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. :-/


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.


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.


Better solution: install "Command Line Tools"
(May require login)


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-' fsevent/fsevent_watch.c
fsevent/fsevent_watch.c:1:10: fatal error: 'stdio.h' file not found


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.


I'm using Xcode 4.3 and set

sudo xcode-select -switch /Applications/

It built successfully. Hope this helps:)


@clippit wow, it works, thanks!


@clippit that works for me as well. Thanks!


@clippit worked for me as well thank you !


@clippit And me, thanks!


+1 for @clippit 's solution


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


@clippit and me!


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


thanks @clippit it also worked for me sudo xcode-select -switch /Applications/


No more "me too" comments please!


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


*uck yeah! Thanks :) Works @clippit


Sending thanks to @clippit!


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


Thanks to @clippit, but Homebrew need to flowing setting

sudo xcode-select -switch /Applications/

@clippit you're the man.


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


@clippit Thanks a ton! :-)

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


thanks for this answer !!!


Word @clippit you da man!


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


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