9

After upgrading to Lion, and upgrading Xcode, make can't seem to locate headers and libs. I looked in /usr/include. The only thing in there was 'parallels-server'. So, I renamed /usr/include to /usr/include.old, and made a symlink to:

/Developer/SDKs/MacOSX10.6.sdk/usr/include/

This is pretty evil. But, make can now find headers. Still can't locate libs (e.g., lcrt1.10.6.o).

What is the correct way to solve both the include and lib problems?

Thanks!

skaffman
  • 398,947
  • 96
  • 818
  • 769
gederer
  • 105
  • 1
  • 1
  • 4
  • I noticed /Developer/About Xcode.pdf says "UNIX Development. Command-line tools used for UNIX-based development. Its components are always placed in /usr - only one version installed at a time." – njamesp Jul 22 '11 at 20:47

4 Answers4

23

After downloading Xcode 4 from the App Store, try running "/Applications/Install Xcode.app".

njamesp
  • 760
  • 5
  • 11
  • @ameyazing Just for completeness, if the file-names contains whitespace, you have to either escape the space with a backslash, or put the whole name in double-quotes. – Volker Stolz Aug 05 '14 at 14:24
7

From me, just downloading the Xcode Command line tools did the trick. (For that, of course, I had first to install Xcode itself, which I installed trough App Store.

  1. Start Xcode
  2. Open Xcode→Preferences...
  3. Select the Downloads tab
  4. Install the Command line tools

That installs a few packages, see /var/db/receipts. The package that contains /usr/include is com.apple.pkg.DevSDKLeo.

I don't think xcode-select is needed, but I had run that command before I downloaded the Command line tools, so I don't know for sure.

Pekka Nikander
  • 1,585
  • 16
  • 15
2

To get Xcode to populate the /usr/include directory, run the following command:

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

You may need to install the Xcode Command Line Tools within Xcode for this to work. Open the Preferences menu, then under Downloads install Command Line Tools.

James
  • 151
  • 2
0

The above answer by njamesp also addresses the following error:

configure: error: C compiler cannot create executables

I received this error when trying to compile code on my 10.7 system after setting it up from a 10.5 time machine, so I assume the wrong version of xcode was installed on my system.

keflavich
  • 18,278
  • 20
  • 86
  • 118