wangyu5 / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

Avoid passing -arch onto the compiler on OSX #260

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. compile a package using gyp (v8 in my case)
2. use FSF gcc, or self-compiled gcc-apple (from www.opensource.apple.com)
2. see the compilation die due to unsupported -arch flag

-arch XXX is necessary only when building FAT objects.  The gyp sources suggest 
this is not supported yet, hence passing the single -arch is not doing much, 
except for the case where -m32 and -m64 would be fine as well.

svn checkout in /trunk:
Last Changed Rev: 11316
Last Changed Date: 2012-04-13 15:01:33 +0200 (Fri, 13 Apr 2012)

It would help if -arch was not unconditionally added to CFLAGS.  It is only 
necessary to do so if another architecture is targetted than the one the 
toolchain defaults to.  In any case, my compiler breaks on this as follows:

  x86_64-apple-darwin11-g++ '-DENABLE_DEBUGGER_SUPPORT' -I../src  -O3 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof -arch x86_64 -fno-strict-aliasing -Wall -Wendif-labels -W -Wno-unused-parameter -Wnon-virtual-dtor -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -fno-threadsafe-statics -MMD -MF /Library/Gentoo/var/tmp/portage/dev-lang/v8-9999/work/v8-9999/out/x64.release/.deps//Library/Gentoo/var/tmp/portage/dev-lang/v8-9999/work/v8-9999/out/x64.release/obj.target/preparser_lib/src/diy-fp.o.d.raw -O3 -march=core2 -pipe -c -o /Library/Gentoo/var/tmp/portage/dev-lang/v8-9999/work/v8-9999/out/x64.release/obj.target/preparser_lib/src/diy-fp.o ../src/diy-fp.cc
cc1plus: error: unrecognized command line option "-arch"

% gcc --version
gcc (GCC) 4.2.1 (Gentoo 4.2.1_p5666, Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Original issue reported on code.google.com by grob...@gentoo.org on 19 Apr 2012 at 6:58