OS X Lion 安装后./configure 找不到 C 编译器

发布于 2024-11-26 09:47:57 字数 193 浏览 1 评论 0原文

虽然 ccgcc 完全位于正确的路径(OS X Lion 中的 /Developer/usr/bin),但运行 ./ configure 尝试通过硬编码(我猜)路径 - /usr/bin 来编译它。

在哪里设置配置路径?

While cc and gcc are perfectly in their right path (/Developer/usr/bin in OS X Lion), running ./configure tries to compile it through a hard coded (I guess) path - /usr/bin.

Where do I setup configure's paths?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

靑春怀旧 2024-12-03 09:47:57

正确的答案是从 App Store(免费)安装 Xcode 4,然后运行 ​​/Applications/Install Xcode.app。然后你需要的一切都将在 /usr/ 中。

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

拒绝两难 2024-12-03 09:47:57

最好的办法实际上是从 Apple 下载并安装新的命令行开发工具包,它为您提供了 /usr/bin 中的工具以及适当位置的库和文档(例如手册页)。可以在developer.apple.com上找到它,或者检查此处了解详细信息和链接。

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.

花开柳相依 2024-12-03 09:47:57

我刚刚遇到了这个...我通过安装 XCode“命令行工具”包“解决”了它

但是由于某种原因,当项目打开时不可能(至少对我来说)到达相同的首选项窗口。我必须执行以下操作:

  • 关闭 XCode(如果正在运行)
  • 启动 XCode(暂时不要打开项目)
  • 按 Command+,
  • 转到 下载
  • 点击在安装

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
烦人精 2024-12-03 09:47:57

njamesp 是正确的;解决您问题的正确方法是正确安装编译器工具链。但对于在哪里设置配置路径?这个问题,有几个解决方案。

  1. 将其作为命令行选项传递到配置: /path/to/configure CC=/p/a/t/h

  2. (已弃用的 bourne shell)将其传递到环境中:CC=/p/a/t/ h /p/t/配置

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

  4. 设置一个配置.站点。将 CONFIG_SITE 放入您的环境中作为文件的路径,
    (例如导出CONFIG_SITE=$HOME/config.site),将CC=/p/a/t/h放入该文件

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

所有这些都假设您的配置脚本是由 autoconf 生成的。不鼓励使用选项 2 和 3,但如果您的配置脚本很古老,则选项 1 可能不起作用。选项 5 很灵活,您可以根据前缀使用不同的 config.sites。 $prefix/share/config.site 可用于设置安装在 $prefix 中的项目的选项。

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.

就像说晚安 2024-12-03 09:47:57

第 1 条正确:我刚刚做了同样的事情。

安装 XCODE 启动 XCODE
单击 Xcode
选择偏好设置
点击
在 XCode 首选项窗格中下载
单击命令行工具并
点击“安装”

编译器安装在 /usr/bin

cd 中,然后输入“gcc -v”(不带引号),您应该得到以下结果:

$ 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)
$ 

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)
$ 
极度宠爱 2024-12-03 09:47:57

我最近安装了 OSX Mavericks 并想升级到 php 5.5.5 并面临类似的问题

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

查看我的包含路径,我注意到只添加了 de base Xcode 路径(我有 Xcode 5)

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

我所需要做的就是添加路径到工具链

[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
...

瞧,它找到了。

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

希望这有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文