English 中文(简体)
Add a custom compiler to XCode 3.2
原标题:

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

最佳回答

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.





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签