0

I have a xcode project that was created for osx snow leopard. All it was required to be built was to run

xcodebuild

from the command prompt. I am now trying to build the same project on OS X 10.7 and the following error happens when I run the same command

/Users/repo/trunk/main.c:31:10: fatal error: 'stdlib.h' file not found

What exactly is going on? I tried to follow the instructions from this question but stdlib.h is still missing.

How can I fix this problem?

Community
  • 1
  • 1
Jernej
  • 342
  • 5
  • 18

2 Answers2

0

Likely you are getting bit by the repackaging of everything inside /Applications/Xcode.app starting with Xcode 4.3. In Unix-like installations stdlib.h usually lives in /usr/include and your project likely expects it to be there as it was pre-Xcode 4.3. You can fix this by installing the command line tools, which includes the tools and the associated headers and libraries in their standard location.

The easiest way to install the command line tools is from inside Xcode. In the Xcode Preferences select the "Downloads" pane and then the "Components" tab. Push the "Install" button next to "Command Line Tools".

torrey.lyons
  • 5,519
  • 1
  • 23
  • 30
  • Thank you for your suggestion. I've installed the command line tools but the problem persists. – Jernej Jul 17 '12 at 12:41
0

You need to run xcode-select to tell xcodebuild and xcrun which Xcode you want to use.

See this manpage.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Hm.. The only folder on my system related to Xcode seems to be /Developer/Applications/Xcode.app/. So I have run xcode-select with this path as a parameter and now it cannot even find xcodebuild executable ( can't exec '/Developer/Applications/Xcode.app/usr/bin/xcodebuild' (No such file or directory) – Jernej Jul 17 '12 at 12:42
  • Sure. Here it is bash-3.2$ xcode-select -print-path /Developer/Applications/Xcode.app – Jernej Jul 17 '12 at 12:55
  • I'm not sure what is going on; obviously your `xcodebuild` will now be in`/Developer/Applications/Xcode.app/Contents/Developer/usr/bin` (or something like that), but it is trying to run it from the path you posted above, which will not exist inside a .app bundle. How did you install Xcode? And perhaps consider updating to 4.3.3? – trojanfoe Jul 17 '12 at 13:36
  • The folder `/Developer/Applications/Xcode.app/Contents/Developer' does not seem to exists. I've now broken even the program xcodebuild since I do not know how to reset it back. I have also tried to install the latest Xcode with no help. – Jernej Jul 17 '12 at 14:10
  • So you downloaded Xcode 4.3.3 from the Mac App Store, or Apple Developer downloads, mounted the `.dmg` and dragged `Xcode.app` to `/Applications` or `~/Applications`, right? – trojanfoe Jul 17 '12 at 14:12
  • No! I downloaded xcode and installed it with the wizzard present in the package. – Jernej Jul 17 '12 at 14:15
  • I don't know what's happened to your system, but it doesn't seem very well. The use of the `/Developer` directory is now deprecated so you should have just an `Xcode.app` in either `/Applications` or `~/Applications`. – trojanfoe Jul 17 '12 at 14:19