[MacPorts] #24694: py26-numpy @1.4.1_1 build fails with gcc43

MacPorts noreply at macports.org
Tue Apr 27 14:48:41 PDT 2010


#24694: py26-numpy @1.4.1_1 build fails with gcc43
----------------------------------------+-----------------------------------
 Reporter:  macports-trac@…             |       Owner:  macports-tickets@…                   
     Type:  defect                      |      Status:  new                                  
 Priority:  Normal                      |   Milestone:                                       
Component:  ports                       |     Version:  1.8.2                                
 Keywords:                              |        Port:                                       
----------------------------------------+-----------------------------------
 This is an error in numpy configuration: the compiler flag -arch is passed
 to gcc4.3, which doesn't understand it.  Details follow.

 OS version: 10.6.3
 Machine: Intel MacBook Core Duo
 gcc_select: mp-gcc4.3
 python_select: python26

 To reproduce: In environment as just detailed, do "sudo port build
 py26-numpy".
 Behavior observed (relevant part; entire session attached):


 {{{
 [... snip ...]
 customize Gnu95FCompiler using config
 C compiler: /opt/local/bin/gcc-mp-4.3 -arch x86_64 -arch i386 -isysroot /
 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall
 -Wstrict-prototypes

 compile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core
 -Inumpy/core/src/npymath -Inumpy/core/src/multiarray
 -Inumpy/core/src/umath -Inumpy/core/include
 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6
 -c'
 gcc-mp-4.3: _configtest.c
 cc1: error: unrecognized command line option "-arch"
 cc1: error: unrecognized command line option "-arch"
 cc1: error: unrecognized command line option "-arch"
 cc1: error: unrecognized command line option "-arch"
 failure.
 removing: _configtest.c _configtest.o
 Traceback (most recent call last):
   File "setup.py", line 187, in <module>
     setup_package()
   File "setup.py", line 180, in setup_package
     configuration=configuration )
   File
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-numpy/work/numpy-1.4.1/numpy/distutils/core.py",
 line 186, in setup
     return old_setup(**new_attr)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py",
 line 152, in setup
     dist.run_commands()
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py",
 line 987, in run_commands
     self.run_command(cmd)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py",
 line 1007, in run_command
     cmd_obj.run()
   File
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-numpy/work/numpy-1.4.1/numpy/distutils/command/build.py",
 line 37, in run
     old_build.run(self)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/build.py",
 line 134, in run
     self.run_command(cmd_name)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py",
 line 333, in run_command
     self.distribution.run_command(command)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py",
 line 1007, in run_command
     cmd_obj.run()
   File
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-numpy/work/numpy-1.4.1/numpy/distutils/command/build_src.py",
 line 152, in run
     self.build_sources()
   File
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-numpy/work/numpy-1.4.1/numpy/distutils/command/build_src.py",
 line 163, in build_sources
     self.build_library_sources(*libname_info)
   File
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-numpy/work/numpy-1.4.1/numpy/distutils/command/build_src.py",
 line 298, in build_library_sources
     sources = self.generate_sources(sources, (lib_name, build_info))
   File
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-numpy/work/numpy-1.4.1/numpy/distutils/command/build_src.py",
 line 385, in generate_sources
     source = func(extension, build_dir)
   File "numpy/core/setup.py", line 657, in get_mathlib_info
     raise RuntimeError("Broken toolchain: cannot link a simple C program")
 RuntimeError: Broken toolchain: cannot link a simple C program
 Error: Target org.macports.build returned: shell command " cd
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-numpy/work/numpy-1.4.1"
 &&
 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
 setup.py --no-user-cfg build " returned error 1
 DEBUG: Backtrace: shell command " cd
 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py26-numpy/work/numpy-1.4.1"
 &&
 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
 setup.py --no-user-cfg build " returned error 1
     while executing
 "command_exec build"
     (procedure "portbuild::build_main" line 9)
     invoked from within
 "$procedure $targetname"
 Warning: the following items did not execute (for py26-numpy):
 org.macports.activate org.macports.build org.macports.destroot
 org.macports.install
 Error: Status 1 encountered during processing.
 To report a bug, see <http://guide.macports.org/#project.tickets>

 }}}

 Analysis:  The indicated point (line 657) of the file numpy/core/setup.py
 is invoking the try_link() method of a very generic command object as a
 sanity check to see whether the build environment can really compile and
 link .c files.  However, this command object is constructed and used
 without correcting for the actual build environment of the port, which
 uses gcc43.  Instead, the environment of the Python 2.6 build is picked up
 by default, and it was built with the macports default of the system
 /usr/bin/gcc4.2.  The hybrid construction of the test compile command
 passes -arch flags to gcc4.3, which doesn't accept them.

 Workaround:  disable lines 655-657 of the file numpy/core/setup.py.  This
 removes the premature environment check, and the actual resulting build
 commands invoke gcc4.3 without -arch flags as required.  The revised
 context is:
 {{{
     def get_mathlib_info(*args):
         # Another ugly hack: the mathlib info is known once build_src is
 run,
         # but we cannot use add_installed_pkg_config here either, so we
 only
         # updated the substition dictionary during npymath build
         config_cmd = config.get_config_cmd()

         # Check that the toolchain works, to fail early if it doesn't
         # (avoid late errors with MATHLIB which are confusing if the
         # compiler does not work).
         # st = config_cmd.try_link('int main(void) { return 0;}')
         # if not st:
         #    raise RuntimeError("Broken toolchain: cannot link a simple C
 program")
         mlibs = check_mathlib(config_cmd)

         posix_mlib = ' '.join(['-l%s' % l for l in mlibs])
         msvc_mlib = ' '.join(['%s.lib' % l for l in mlibs])
         subst_dict["posix_mathlib"] = posix_mlib
         subst_dict["msvc_mathlib"] = msvc_mlib

 }}}

 Should I report this to SciPy?

-- 
Ticket URL: <http://trac.macports.org/ticket/24694>
MacPorts <http://www.macports.org/>
Ports system for Mac OS


More information about the macports-tickets mailing list