Xcode 4 中没有 gcc 4.2 编译器选项?
在我的 Xcode 4 安装中,我只有 2 个编译器选项:
- Apple LLVM 编译器 3.0
- GCC LLVM 4.2
在许多 Xcode 示例中,我看到 GCC 4.2 显示为第三个选项,但这根本不存在。我特意对 XCode 4 进行了全新安装。如果 GCC 4.2 尚不存在,是否有添加 GCC 4.2 的标准方法?我的一个项目要求我使用 GCC(而不是 GCC LLVM),其他项目我对 GCC LLVM 很满意,所以这只是该项目的一个问题。
In my Xcode 4 installation, I only have 2 compiler options:
- Apple LLVM compiler 3.0
- GCC LLVM 4.2
In many Xcode examples I have seen that GCC 4.2 is shown as a third option, but this simply isn't there. I intentionally did a clean installation of XCode 4. Is there a standard method for adding GCC 4.2 if it's not already there? One of my projects requires that I use GCC (and not GCC LLVM), the other projects I am happy with GCC LLVM, so it's only an issue for that one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一种在 xcode 4.2 中启用 gcc 4.2 编译的方法。这主要是通过命令行完成的,因此当您看到以以下开头的行时:
[ 15:30 jon@MacBookPro / ]$
,您需要打开Terminal.app并运行在$
之后开始的命令。下载 - 但暂时不要安装 - xcode_4.1_for_lion.dmg 或 xcode_4.1_for_snow_leopard.dmg< /p>
/Developer-4.1
:备份工作
/Developer
目录(安装 Xcode 4.2 的位置)使用默认安装位置 (
/Developer
) 运行 Xcode 4.1 安装程序将新的 Xcode 4.1 安装移至
/Developer-4.1
:将 Xcode 4.2 开发人员目录移回
/Developer
:编辑 Xcode 4.2
GCC 4.2.xcspec
文件以获取 gcc 4.2在编译器选项列表中显示[1]:将 41 和 42 行从此更改:
致此:
备份 Xcode 4.2 iOS/Simulator Framework
usr
目录:将 Xcode 4.1 iOS/Simulator Framework
usr
目录复制到 Xcode 4.2:< /p>复制
gcc
和info
从 Xcode 4.1 到 Xcode 4.2 的 iOS SDK 库目录[2]:使用gcc-4.2编译!
这是一个我写的博客文章提供了有关此过程的更多信息。如果您遇到任何问题或有任何疑问,请随时在博客上发表评论。
[1] 如果从命令行打开(使用类似
vi
、emacs
、nano
等)确保将路径用引号括起来 "/long path/with space/in it/ file.xcspec" 或转义空格/some/long\ path/with\spaces/in\ it/file.xcspec[2] 这是必要的,因为 iPhoneOS.platform SDK 有自己的单独的
/usr/lib
目录,但 iPhoneSimulator.platform SDK 没有Here is a way to enable compiling with gcc 4.2 in xcode 4.2. This is mostly done via command line so when you see lines starting with:
[ 15:30 jon@MacBookPro / ]$
, you need to open up Terminal.app and run the command that starts after the$
.Download - but do not install yet - xcode_4.1_for_lion.dmg or xcode_4.1_for_snow_leopard.dmg
Now, follow these steps to install Xcode 4.1 into
/Developer-4.1
:Backup the working
/Developer
directory (where Xcode 4.2 is installed)Run the Xcode 4.1 installer using the default install location (
/Developer
)Move the new Xcode 4.1 installation to
/Developer-4.1
:Move the Xcode 4.2 developer directory back to
/Developer
:Edit the Xcode 4.2
GCC 4.2.xcspec
file to get gcc 4.2 to show in the list of compiler options [1]:Change lines 41 and 42 from this:
To This:
Backup the Xcode 4.2 iOS/Simulator Framework
usr
directories:Copy Xcode 4.1 iOS/Simulator Framework
usr
directories to Xcode 4.2:Copy the
gcc
andinfo
iOS SDK library directories from Xcode 4.1 to Xcode 4.2 [2]:Compile using gcc-4.2!
This is a blog post I've written with a little more info about this process. Feel free to leave a comment on the blog if you run into any issues or have any questions.
[1] If opening from a command line (using something like
vi
,emacs
,nano
, etc) make sure to either enclose the path in quotes "/long path/with spaces/in it/file.xcspec" or escape the spaces /some/long\ path/with\ spaces/in\ it/file.xcspec[2] This is necessary because the iPhoneOS.platform SDK has its own seperate
/usr/lib
directories but the iPhoneSimulator.platform SDK does notXcode 4.3 有一个特定的文件夹
/Applications/Xcode.app/Contents/Developer/Toolchains
。有没有办法添加其他工具链,如 AVR-gcc 和 PIC32-gcc?
Xcode 4.3 has a specific folder
/Applications/Xcode.app/Contents/Developer/Toolchains
.Is there a way to add other tool-chains as AVR-gcc and PIC32-gcc?