Add a custom compiler to XCode 3.2

不想你离开。 提交于 2019-12-03 13:37:20

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

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!