开发者

Why is Apple's gcc output mixed up when compiling for multiple architectures?

When running gcc on the command line in OS X, every now and then, 开发者_开发问答I'll get warnings and/or errors. But I'm always compiling for multiple architectures (with the -arch option), and since gcc spawns several processes for each architecture, errors will constantly get garbled. For example, just running gcc (options) -### will result in

Using built-in specs.
Target: powerpc-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5493~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --enable-werror-always --program-prefix=powerpc-apple-darwin9- --host=i686-apple-darwin9 --target=powerpc-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5493)
Using built-in specs.
 "/uTarget: powerpc-apple-darwin9
sr/Configured with: /var/tmp/gcc/gcc-5493~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --enable-werror-always --program-prefix=powerpc-apple-darwin9- --host=i686-apple-darwin9 --target=powerpc-apple-darwin9
liThread model: posix
bexgcc version 4.0.1 (Apple Inc. build 5493)

In this copy-pasted block from the console, you can see that output is messed up. Look at the lines:

 "/uTarget:
liThread model: posix
bexgcc version 4.0.1 (Apple Inc. build 5493)

It continues throughout the output. It looks like many different programs are writing to the terminal at the same time. The same mixture for outputs happens with errors, warnings and the like. It makes the entire output useless and unreadable. Is there anything I can pass to Apple's gcc to print it's output sanely?


GCC has driver programs, like gcc, g++ and gfortran, which call the language compilers (named cc1, cc1plus and f951) to generated assembler code, then calls the assembler to create object files, and then the linker (well, this last step is a bit more complicated, because it involves determining the correct order of object files and libraries, which is done by a program named collect2).

So, Apple added to GCC's drivers a "driver driver", which handles multiple -arch options, and spawns driver processes for each arch. These processes run concurrently, and their output can sometimes be mixed up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜