wangyu5 / gyp

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

Support multiple ARCHs on Mac OS X (fat binaries) #252

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. set 'xcode_settings': {'ARCHS': ['x86_64', 'i386']}
2. compile

What is the expected output? What do you see instead?

Expect: generation of a fat binary with compilation products for both i386 and 
x86_64

What I see instead: Warning: Ignoring not yet implemented key "ARCHS".

What version of the product are you using? On what operating system?

r1214 on Mac OS X 10.6.8

Please provide any additional information below.

I made the following naive hack to the gyp (rev1214) included in nodejs to see 
what the results would be.

Made changes to gyp/xcode_emulation.py and common.gypi to see if I could 
generate a fat binary produced this error:

  gcc-4.2: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags

These flags can be turned off in a configure generated with Automake by addin 
'--disable-dependency-tracking' to the ./configure invocation.

Don't know how to do this with gyp.

$ git diff tools/gyp/pylib/gyp/xcode_emulation.py
diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py 
b/tools/gyp/pylib/gyp/xcode_emulation.py
index 4d8440b..6a95d1a 100644
--- a/tools/gyp/pylib/gyp/xcode_emulation.py
+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
@@ -291,8 +291,10 @@ class XcodeSettings(object):
     if len(archs) != 1:
       # TODO: Supporting fat binaries will be annoying.
       self._WarnUnimplemented('ARCHS')
-      archs = ['i386']
-    cflags.append('-arch ' + archs[0])
+      cflags.append('-arch ' + archs[0])
+      cflags.append('-arch ' + archs[1])
+    else:
+      cflags.append('-arch ' + archs[0])

     if archs[0] in ('i386', 'x86_64'):
       if self._Test('GCC_ENABLE_SSE3_EXTENSIONS', 'YES', default='NO'):

$ git diff common.gypi
diff --git a/common.gypi b/common.gypi
index 00fad43..5e5824a 100644
--- a/common.gypi
+++ b/common.gypi
@@ -175,7 +175,7 @@
             'xcode_settings': {'ARCHS': ['i386']},
           }],
           ['target_arch=="x64"', {
-            'xcode_settings': {'ARCHS': ['x86_64']},
+            'xcode_settings': {'ARCHS': ['x86_64', 'i386']},
           }],
         ],
       }],

Original issue reported on code.google.com by sbanna...@concord.org on 21 Feb 2012 at 7:03

GoogleCodeExporter commented 9 years ago
I think this was fixed in gyp r1692

Original comment by thakis@chromium.org on 5 Feb 2014 at 4:54