将自定义编译器添加到 XCode 3.2

发布于 2024-08-15 18:48:02 字数 431 浏览 4 评论 0原文

我有一个适用于 ARM Cortex-m3 的有效 gcc 4.3.3 工具链,并希望将其集成到 XCode 中。

有没有办法设置 XCode (3.2) 以使用此 gcc 工具链而不是内置的 GCC 4.2?

到目前为止我尝试过的: 我添加了 GCC 4.2.xcplugin 的修改副本,并更改​​了名称、版本和可执行路径。它显示在 XCode 中,但每当我将“C/C++ 编译器版本”设置为自定义编译器时,它都会失败

GCC_VERSION 的值“4.3.3”无效

似乎有效的版本号被硬编码在其他地方,因为即使当我删除原始的 GCC 4.2.xcplugin 时,值 4.2 仍然存在有效(但在“C/C++ 编译器版本”下拉列表中不再可见)。

I have a working gcc 4.3.3 toolchain for an ARM Cortex-m3 and would like to integrate it into XCode.

Is there a way to set up XCode (3.2) to use this gcc toolchain instead of the built-in GCC 4.2?

What I've tried so far:
I've added a modified copy of the GCC 4.2.xcplugin and changed the name, version and executable path. It shows up in XCode but whenever I set the "C/C++ Compiler Version" to the custom compiler it fails with

Invalid value '4.3.3' for GCC_VERSION

It seems like the valid version numbers are hardcoded somewhere else because even when I remove the original GCC 4.2.xcplugin, the value 4.2 remains valid (but is not visible in the "C/C++ Compiler Version" drop down anymore).

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

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

发布评论

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

评论(3

删除→记忆 2024-08-22 18:48:02

仅供参考 - 我将 gcc 4.4 集成到最新的 Xcode 3.2.4 中,包括标志 - 请参阅博客 http://skurganov.blogspot.com /

FYI - I got gcc 4.4 integrated into latest Xcode 3.2.4 including flags - see blog at http://skurganov.blogspot.com/

没有心的人 2024-08-22 18:48:02

我自己正在做这件事。

目前,看起来您必须继承内置的编译器引用规范。

添加以下键:

BasedOn = "com.apple.compilers.gcc.4_2";

使插件正确加载。然而,由于苹果特定的编译器补丁,存在无效标志的问题。我现在正在研究那部分。

I'm working on this myself.

Currently, it's looking like you have to inherit a built in compiler ref spec.

Adding a key of:

BasedOn = "com.apple.compilers.gcc.4_2";

Makes the plugin load correctly. However, there's the issue of invalid flags due to the apple specific compiler patches. I'm working on that part right now.

野鹿林 2024-08-22 18:48:02

我已经让编译阶段开始工作了。为此:

  1. 在 /Developer/Library/Xcode/Plug-ins
  2. cp "GCC 4.2.xcplugin" "GCC Arm 4.4.1.xcplugin"
  3. cd "GCC Arm 4.4.1.xcplugin"/Contents
  4. 修改 Info.plist (可能不绝对必要)
8c8
-   com.apple.xcode.compilers.gcc.arm-4_4_1
---
+   com.apple.xcode.compilers.gcc.4_2
12c12
-   GCC Arm 4.4.1 Compiler Xcode Plug-in
---
+   GCC 4.2 Compiler Xcode Plug-in
  1. cd Resources
  2. mv "GCC 4.2.xcspec" "GCC Arm 4.4.1.xcspec"
  3. 修改 "GCC Arm 4.4.1.xcspec"
10c10
-     Identifier = "com.apple.compilers.gcc.arm-4_4_1";
---
+     Identifier = "com.apple.compilers.gcc.4_2";
13,16c13,16
-     Name = "GCC Arm 4.4.1";
-     Description = "GNU Arm C/C++ Compiler 4.4.1";
-     Version = "arm-4.4.1";
---
+     Name = "GCC 4.2";
+     Description = "GNU C/C++ Compiler 4.2";
+     Version = "4.2";
39c39
-         "com.apple.compilers.gcc.headers.arm_4_4_1",
---
+         "com.apple.compilers.gcc.headers.4_2",
42c42
-     ExecPath = "$(PLATFORM_DEVELOPER_BIN_DIR)/gcc-arm.4.4.1";
---
+     ExecPath = "$(PLATFORM_DEVELOPER_BIN_DIR)/gcc-4.2";
48,49c48,49
-     SupportsZeroLink = No;
-     "SupportsPredictiveCompilation" = No;
---
+     SupportsZeroLink = Yes;
+     "SupportsPredictiveCompilation" = Yes;
52,53c52,53
-     "SupportsMacOSXDeploymentTarget" = No;
-     "SupportsMacOSXMinVersionFlag" = No;
---
+     "SupportsMacOSXDeploymentTarget" = Yes;
+     "SupportsMacOSXMinVersionFlag" = Yes;
88a89,90
-                     "-arch",
-                     "$(value)",
  1. 将编译器链接到 /Developer/usr/bin/gcc-arm.4.4.1

由于 wiki 重新格式化,上面的差异并不准确,但相关信息是存在的。我注意到的关键部分(以及您在上面出现的错误)是标识符更改必须与版本号更改相对应(将“.”替换为“_”)。

摆脱 -arch 参数适用于编译,但不适用于链接。由于我的 gcc 不接受此参数,因此我目前无法链接。除非我找到另一种方法来解决这个问题,否则我可能会放入一个脚本而不是 gcc 可执行文件来删除此选项。

I've gotten the compile phase to work. To do this:

  1. In /Developer/Library/Xcode/Plug-ins
  2. cp "GCC 4.2.xcplugin" "GCC Arm 4.4.1.xcplugin"
  3. cd "GCC Arm 4.4.1.xcplugin"/Contents
  4. Modify Info.plist (may not be strictly necessary)
8c8
-   com.apple.xcode.compilers.gcc.arm-4_4_1
---
+   com.apple.xcode.compilers.gcc.4_2
12c12
-   GCC Arm 4.4.1 Compiler Xcode Plug-in
---
+   GCC 4.2 Compiler Xcode Plug-in
  1. cd Resources
  2. mv "GCC 4.2.xcspec" "GCC Arm 4.4.1.xcspec"
  3. Modify "GCC Arm 4.4.1.xcspec"
10c10
-     Identifier = "com.apple.compilers.gcc.arm-4_4_1";
---
+     Identifier = "com.apple.compilers.gcc.4_2";
13,16c13,16
-     Name = "GCC Arm 4.4.1";
-     Description = "GNU Arm C/C++ Compiler 4.4.1";
-     Version = "arm-4.4.1";
---
+     Name = "GCC 4.2";
+     Description = "GNU C/C++ Compiler 4.2";
+     Version = "4.2";
39c39
-         "com.apple.compilers.gcc.headers.arm_4_4_1",
---
+         "com.apple.compilers.gcc.headers.4_2",
42c42
-     ExecPath = "$(PLATFORM_DEVELOPER_BIN_DIR)/gcc-arm.4.4.1";
---
+     ExecPath = "$(PLATFORM_DEVELOPER_BIN_DIR)/gcc-4.2";
48,49c48,49
-     SupportsZeroLink = No;
-     "SupportsPredictiveCompilation" = No;
---
+     SupportsZeroLink = Yes;
+     "SupportsPredictiveCompilation" = Yes;
52,53c52,53
-     "SupportsMacOSXDeploymentTarget" = No;
-     "SupportsMacOSXMinVersionFlag" = No;
---
+     "SupportsMacOSXDeploymentTarget" = Yes;
+     "SupportsMacOSXMinVersionFlag" = Yes;
88a89,90
-                     "-arch",
-                     "$(value)",
  1. Link the compiler into /Developer/usr/bin/gcc-arm.4.4.1

Due to wiki reformatting, the diff's above are not exact, but the relevant information is there. The critical piece that I've noted (and what you appear to have wrong above) is that the Identifier change must correspond with the version number change (with "." replaced with "_").

Getting rid of the -arch parameter works for compiles, but not for linking. Since my gcc won't accept this parameter I can't link at the moment. Unless I find another way to fix this, I'll probably put in a script instead of the gcc executable to yank out this option.

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