Note that there are some explanatory texts on larger screens.

plurals
  1. POMac 10.6 Universal Binary scipy: cephes/specfun "_aswfa_" symbol not found
    text
    copied!<p>I can't get scipy to function in 32 bit mode when compiled as a i386/x86_64 universal binary, and executed on my 64 bit 10.6.2 MacPro1,1.</p> <h3>My python setup</h3> <p>With the help of <a href="https://stackoverflow.com/questions/1654837/run-an-os-x-universal-binary-in-32-bit-mode/1654855#1654855">this answer</a>, I built a 32/64 bit intel universal binary of python 2.6.4 with the intention of using the <code>arch</code> command to select between the architectures. (I managed to make some universal binaries of a few libraries I wanted using lipo.) That all works. I then installed scipy according to the instructions on <a href="http://blog.hyperjeff.net/?p=160" rel="nofollow noreferrer">hyperjeff's article</a>, only with more up-to-date numpy (1.4.0) and skipping the bit about moving numpy aside briefly during the installation of scipy.</p> <p>Now, everything except scipy seems to be working as far as I can tell, and I can indeed select between 32 and 64 bit mode using <code>arch -i386 python</code> and <code>arch -x86_64 python</code>. </p> <h3>The error</h3> <p>Scipy complains in 32 bit mode: </p> <pre><code>$ arch -x86_64 python -c "import scipy.interpolate; print 'success'" success $ arch -i386 python -c "import scipy.interpolate; print 'success'" Traceback (most recent call last): File "&lt;string&gt;", line 1, in &lt;module&gt; File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/interpolate/__init__.py", line 7, in &lt;module&gt; from interpolate import * File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/interpolate/interpolate.py", line 13, in &lt;module&gt; import scipy.special as spec File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/special/__init__.py", line 8, in &lt;module&gt; from basic import * File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/special/basic.py", line 8, in &lt;module&gt; from _cephes import * ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/special/_cephes.so, 2): Symbol not found: _aswfa_ Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/special/_cephes.so Expected in: flat namespace in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/special/_cephes.so </code></pre> <h3>Attempt at tracking down the problem</h3> <p>It looks like scipy.interpolate imports something called <code>_cephes</code>, which looks for a symbol called <code>_aswfa_</code> but can't find it in 32 bit mode. Browsing through scipy's source, I find an <code>ASWFA</code> subroutine in specfun.f. The only scipy product file with a similar name is specfun.so, but both that and _cephes.so appear to be universal binaries:</p> <pre><code>$ cd /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/special/ $ file _cephes.so specfun.so _cephes.so: Mach-O universal binary with 2 architectures _cephes.so (for architecture i386): Mach-O bundle i386 _cephes.so (for architecture x86_64): Mach-O 64-bit bundle x86_64 specfun.so: Mach-O universal binary with 2 architectures specfun.so (for architecture i386): Mach-O bundle i386 specfun.so (for architecture x86_64): Mach-O 64-bit bundle x86_64 </code></pre> <p>Ho hum. I'm stuck. Things I may try but haven't figured out how yet include compiling specfun.so myself manually, somehow.</p> <p>I would imagine that scipy isn't broken for all 32 bit machines, so I guess something is wrong with the way I've installed it, but I can't figure out what. </p> <p>I don't really expect a full answer given my fairly unique (?) setup, but if anyone has any clues that might point me in the right direction, they'd be greatly appreciated. </p> <h1><strong>(edit)</strong> More details to address questions:</h1> <p>I'm using gfortran (GNU Fortran from GCC 4.2.1 Apple Inc. build 5646). </p> <p>Python 2.6.4 was installed more-or-less like so:</p> <pre><code>cd /tmp curl -O http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tar.bz2 tar xf Python-2.6.4.tar.bz2 cd Python-2.6.4 # Now replace buggy pythonw.c file with one that supports the "arch" command: curl http://bugs.python.org/file14949/pythonw.c | sed s/2.7/2.6/ &gt; Mac/Tools/pythonw.c ./configure --enable-framework=/Library/Frameworks --enable-universalsdk=/ --with-universal-archs=intel make -j4 sudo make frameworkinstall </code></pre> <p>Scipy 0.7.1 was installed pretty much as described as <a href="http://blog.hyperjeff.net/?p=160" rel="nofollow noreferrer">here</a>, but it boils down to a simple <code>sudo python setup.py install</code>.</p> <p>It would indeed appear that the symbol is undefined in the i386 architecture if you look at the _cephes library with <code>nm</code>, as suggested by David Cournapeau:</p> <pre><code>$ nm -arch x86_64 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/special/_cephes.so | grep _aswfa_ 00000000000d4950 T _aswfa_ 000000000011e4b0 d _oblate_aswfa_data 000000000011e510 d _oblate_aswfa_nocv_data (snip) $ nm -arch i386 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/special/_cephes.so | grep _aswfa_ U _aswfa_ 0002e96c d _oblate_aswfa_data 0002e99c d _oblate_aswfa_nocv_data (snip) </code></pre> <p>however, I can't yet explain its absence.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload