Untitled #12

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

ivkosh commented Mar 15, 2011

Fix macvim compilation with Xcode4.

Make loadfont.c compile without ppc architecture, allowing macvim
be built with Xcode4.

If ARCHFLAGS environment variable is not set, python distutils
(used by setup.py) sets -arch command line arguments for gcc to
'-arch x86_x64 -arch ppc -arch i386', thus gcc is trying to build
universal binary with ppc support.

Xcode4 does not contain command line tools for ppc platform
(assembler tools). As a result ppc architecture is failed to build,
loadfont.c is not compiled, icons are note generated and macvim
is failed to build.

Explicit setting ARCHFLAGS environment variable in Makefile
solves the problem.

Make loadfont.c compile without ppc architecture, allowing macvim
be built with Xcode4.

If ARCHFLAGS environment variable is not set, python distutils
(used by setup.py) sets -arch command line arguments for gcc to
'-arch x86_x64 -arch ppc -arch i386', thus gcc is trying to build
universal binary with ppc support.

Xcode4 does not contain command line tools for ppc platform
(assembler tools). As a result ppc architecture is failed to build,
loadfont.c is not compiled, icons are note generated and macvim
is failed to build.
Owner

b4winckler commented Mar 17, 2011

Thanks for sending me a patch. However, this will not work on PPC.

Is there any way to get the python distutils not to set the arch flag? Or will it work to simply clear the arch flag before compiling instead of setting it to intel platforms?

ivkosh commented Mar 17, 2011

On Thu, Mar 17, 2011 at 12:32:01AM -0700, b4winckler wrote:

Thanks for sending me a patch. However, this will not work on PPC.

Is there any way to get the python distutils not to set the arch flag? Or will it work to simply clear the arch flag before compiling instead of setting it to intel platforms?

I reviewed source of distutils and didn't found standart way to do this.
distutils checks environment variables CXXFLAGS and ARCHFLAGS for -arch
parameter and if none found it guesses that universal binary should be
built and sets all available architectures: -arch x86_64 -arch ppc -arch i386.

I didn't found parameters in setup() to override this.
But environment (ARCHFLAG variable) can be modified inside python
script (setup.py) just before setup(name=...), something like this:

import platform
import os

if platform.machine() == 'i386':
    os.environ['ARCHFLAGS']='-arch i386 -arch x86_64'
setup(name="loadfont", version="1.0",
    ext_modules = [Extension("loadfont", ["loadfont.c"])])

Looks like it is the only pythonic-way to handle this distutils feature.

However setting correct environment variable before
calling /usr/bin/python setup.py install --install-lib .
in Makefile solves the problem.

To let loadfont.c compile both on ppc and on intel with xcode4
there are few options:

  1. simply clear ARCHFLAGS environment variable on ppc, as you wrote;
  2. set ARCHFLAGS='-arch ppc' on ppc (generally the same way as 1);
  3. modify setup.py.

I think changing Makefile environment depending on platform type
(options 1 or 2) is more natural way.

P.S.
This problem will arise for all software using distutils with Xcode4.
To override this everywhere on my mac I just added ARCHFLAGS=x86_64
to my shell profile.

Reply to this email directly or view it on GitHub:
#12 (comment)

Owner

b4winckler commented Mar 21, 2011

Thanks for the explanation as to what is going on.

The document icons have caused so many headaches that I decided to disable them by default instead of jumping through hoops to get them to build on all platforms. See

3811f44

and the bottom of

https://github.com/b4winckler/macvim/wiki/Building

I have added an archive containing all document icons (as noted in the above link) so that if there are problems generating them it is now possible to skip the generation step all together. This way we don't need to patch anything.

@b4winckler b4winckler closed this Mar 30, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment