Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 392981

Summary: If ARCHFLAGS is set Python will (may) not build correctly
Product: Gentoo/Alt Reporter: Alfredo Deza <arufuredosan>
Component: Prefix SupportAssignee: Gentoo Prefix <prefix>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: x86   
OS: OS X   
Whiteboard:
Package list:
Runtime testing required: ---

Description Alfredo Deza 2011-12-03 05:02:44 UTC
Some Python packages depend on having $ARCHFLAGS set so that it knows what type of architecture they are building against.

In my particular case, I had them set like:

     export ARCHFLAGS="-arch i386 -arch x86_64"

There is a particular section in Python's distutils that checks for this possibility and tries to loop over certain options, but it is not careful enough to handle non-existant flags and breaks the build with a KeyError:

Traceback (most recent call last):
  File "./setup.py", line 15, in <module>
    from distutils.command.build_ext import build_ext
  File "/Users/adeza/Gentoo/tmp/var/tmp/python-2.7.2/Python-2.7.2/Lib/distutils/command/build_ext.py", line 37, in <module>
    class build_ext (Command):
  File "/Users/adeza/Gentoo/tmp/var/tmp/python-2.7.2/Python-2.7.2/Lib/distutils/command/build_ext.py", line 67, in build_ext
    "(default: %s)" % get_platform()),
  File "/Users/adeza/Gentoo/tmp/var/tmp/python-2.7.2/Python-2.7.2/Lib/distutils/util.py", line 98, in get_platform
    cfgvars = get_config_vars()
  File "/Users/adeza/Gentoo/tmp/var/tmp/python-2.7.2/Python-2.7.2/Lib/distutils/sysconfig.py", line 545, in get_config_vars
    flags = _config_vars[key]
KeyError: 'CXXFLAGS'

After I commented out ARCHFLAG I was able to build/bootstrap with no problems.

Versions:
OSX 10.6.8
GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Xcode 4.02

Reproducible: Always

Steps to Reproduce:
1. Add ARCHFLAGS as an environment variable
2. Start a Gentoo-prefix installation following these instructions: http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml
3. Fail when trying to bootstrap Python 
3.
Actual Results:  
A traceback was generated when calling distutils.py
Comment 1 Fabian Groffen gentoo-dev 2011-12-03 09:26:32 UTC
maybe I sound stupid here, but why would you set ARCHFLAGS?  In fact, your environment should be as empty as possible, to eliminate any possible negative influence from environmental settings like these
Comment 2 Alfredo Deza 2011-12-03 12:22:42 UTC
ARCHFLAGS is (in my case) needed to build Python packages that in turn build some C-extensions. These extensions rely upon having proper ARCHFLAGS set.

Since I work with Python it is cumbersome to set this flag over and over again every time a Python package that has a C extension needs to be built.

It makes sense to have a bare system to start with, but it wasn't an option with any of OSX machines since they are  used quite heavily for work. Also, it might be worth adding that as a note in the instructions for installing Gentoo-prefix.
Comment 3 Fabian Groffen gentoo-dev 2011-12-03 12:40:59 UTC
Ok, then you better prepare for a shock: it won't work in Prefix.  We don't do any multilib stuff, and we're not going to go down that route either.  The way to do it, is to just have two prefixes, one for 32-bits and the other for 64-bits.

We don't support this, because can't.