开发者

./configure can't find C compiler after OS X Lion installation

While cc and gcc are perfectly in their right path (/Developer/usr/bin in OS X Lion), running ./configure tries t开发者_高级运维o compile it through a hard coded (I guess) path - /usr/bin.

Where do I setup configure's paths?


The right answer is to install Xcode 4 from the App Store (free) and then run /Applications/Install Xcode.app. Then everything you need will be in /usr/.


The best thing to do is actually to download and install the new Command Line Developer Tools package from Apple, which gives you your tools in /usr/bin along with libraries in the proper place and documentation (e.g. manpages). Either go find it on developer.apple.com or check here for details and a link.


I just ran into this... I "solved" it by just installing the XCode "Command Line Tools" package

But for some reason it is not possible (for me at least) to reach the same preferences window when a project is open. I had to do the following

  • Close XCode (if running)
  • Start XCode (do not open a project yet)
  • Press Command+,
  • Go to Downloads
  • Click on install


njamesp is correct; the proper solution to your problem is to get your compiler tool chain correctly installed. But to the question Where do I setup configure's paths?, there are a couple of solutions.

  1. Pass it to configure as a command line option: /path/to/configure CC=/p/a/t/h

  2. (Deprecated-bourne shell) Pass it in the environment: CC=/p/a/t/h /p/t/configure

  3. (Deprecated-csh) env CC=/p/a/t/h /p/t/configure

  4. setup a config.site. Put CONFIG_SITE in your environment as the path of a file, (eg export CONFIG_SITE=$HOME/config.site), put CC=/p/a/t/h in that file

  5. put CC=/p/a/t/h in /usr/local/share/config.site

All of this assumes that your configure script was generated by autoconf. Options 2 and 3 are discouraged, but if your configure script is ancient option 1 may not work. Option 5 is flexible, and you can use different config.sites depending on prefix. $prefix/share/config.site can be used to set options for projects installed in $prefix.


Item 1 correct: I just did the same thing.

Install XCODE Launch XCODE Click on Xcode Choose Preferences Click on Downloads in the XCode Preference pane Click on command line tools and click "Install"

The compilers are install in /usr/bin

cd there, and type "gcc -v" (without the quotes)and you should get back the following:

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
$ 


I recently installed OSX Mavericks and wanted to upgrade to php 5.5.5 and faced a similar issue

[user@host /path/to/php5.5.5_src]$ ./configure
checking for cc... cc
checking whether the C compiler works... no

Looking at my include path, I noticed that only de base Xcode path was added (I have Xcode 5)

[user@host ~]$ cat /etc/paths
/usr/bin
/Applications/Xcode.app/Contents/Developer/usr/bin
/bin
...

All I needed to do is add the path to the Toolchains

[user@host ~]$ sudo vi /etc/paths
/usr/bin
/Applications/Xcode.app/Contents/Developer/usr/bin
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
/bin
...

And voilà, it found it.

[user@host /path/to/php5.5.5_src]$ ./configure
checking for cc... cc
checking whether the C compiler works... yes

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜