[SciPy-Dev] Symbol not found: __ZNSt8ios_base4InitD1Ev for scipy.sparse

Matthew Brett matthew.brett at gmail.com
Mon Feb 3 15:28:14 EST 2014


Hi,

On Sun, Feb 2, 2014 at 5:13 PM, Ralf Gommers <ralf.gommers at gmail.com> wrote:
>
>
>
> On Sun, Feb 2, 2014 at 9:14 PM, Matthew Brett <matthew.brett at gmail.com>
> wrote:
>>
>> Hi,
>>
>> On Sun, Feb 2, 2014 at 7:54 AM, Ralf Gommers <ralf.gommers at gmail.com>
>> wrote:
>> >
>> >
>> >
>> > On Fri, Jan 31, 2014 at 5:09 AM, Matthew Brett <matthew.brett at gmail.com>
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >> On Wed, Jan 22, 2014 at 4:59 PM, Matthew Brett
>> >> <matthew.brett at gmail.com>
>> >> wrote:
>> >> > Hi,
>> >> >
>> >> > On Wed, Jan 22, 2014 at 11:33 AM, Ralf Gommers
>> >> > <ralf.gommers at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >>
>> >> >>
>> >> >> On Mon, Jan 20, 2014 at 1:24 PM, Matthew Brett
>> >> >> <matthew.brett at gmail.com>
>> >> >> wrote:
>> >> >>>
>> >> >>> Hi,
>> >> >>>
>> >> >>> I am trying to install scipy master on OSX 10.9.
>> >> >>>
>> >> >>> I'm using
>> >> >>>
>> >> >>> export CC=clang
>> >> >>> export CXX=clang
>> >> >>> export FFLAGS=--ff2c
>> >> >>>
>> >> >>> from http://www.scipy.org/scipylib/building/macosx.html
>> >> >>>
>> >> >>> I built and installed numpy with these flags, then scipy.
>> >> >>>
>> >> >>> scipy installs:
>> >> >>>
>> >> >>> >>> scipy.__version__
>> >> >>> '0.14.0.dev-6b18a3b'
>> >> >>>
>> >> >>> but then:
>> >> >>>
>> >> >>> >>> import scipy.sparse
>> >> >>> Traceback (most recent call last):
>> >> >>>   File "<stdin>", line 1, in <module>
>> >> >>>   File
>> >> >>>
>> >> >>>
>> >> >>> "/Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/site-packages/scipy/sparse/__init__.py",
>> >> >>> line 206, in <module>
>> >> >>>     from .csr import *
>> >> >>>   File
>> >> >>>
>> >> >>>
>> >> >>> "/Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/site-packages/scipy/sparse/csr.py",
>> >> >>> line 13, in <module>
>> >> >>>     from .sparsetools import csr_tocsc, csr_tobsr,
>> >> >>> csr_count_blocks, \
>> >> >>>   File
>> >> >>>
>> >> >>>
>> >> >>> "/Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/site-packages/scipy/sparse/sparsetools/__init__.py",
>> >> >>> line 5, in <module>
>> >> >>>     from .csr import *
>> >> >>>   File
>> >> >>>
>> >> >>>
>> >> >>> "/Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/site-packages/scipy/sparse/sparsetools/csr.py",
>> >> >>> line 26, in <module>
>> >> >>>     _csr = swig_import_helper()
>> >> >>>   File
>> >> >>>
>> >> >>>
>> >> >>> "/Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/site-packages/scipy/sparse/sparsetools/csr.py",
>> >> >>> line 22, in swig_import_helper
>> >> >>>     _mod = imp.load_module('_csr', fp, pathname, description)
>> >> >>>   File
>> >> >>> "/Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/imp.py",
>> >> >>> line 183, in load_module
>> >> >>>     return load_dynamic(name, filename, file)
>> >> >>> ImportError:
>> >> >>>
>> >> >>>
>> >> >>> dlopen(/Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/site-packages/scipy/sparse/sparsetools/_csr.so,
>> >> >>> 2): Symbol not found: __ZNSt8ios_base4InitD1Ev
>> >> >>>   Referenced from:
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> /Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/site-packages/scipy/sparse/sparsetools/_csr.so
>> >> >>>   Expected in: flat namespace
>> >> >>>  in
>> >> >>>
>> >> >>>
>> >> >>> /Users/mb312/.virtualenvs/py33-sp-devel/lib/python3.3/site-packages/scipy/sparse/sparsetools/_csr.so
>> >> >>>
>> >> >>> Here's clang version info:
>> >> >>>
>> >> >>> $ clang -v
>> >> >>> Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
>> >> >>> Target: x86_64-apple-darwin13.0.0
>> >> >>> Thread model: posix
>> >> >>>
>> >> >>> I noticed a similar issue here:
>> >> >>>
>> >> >>> https://github.com/scipy/scipy/issues/3053
>> >> >>>
>> >> >>> but I think I have clean install (into a virtualenv).
>> >> >>>
>> >> >>> Any hints as to where to look next?
>> >> >>
>> >> >>
>> >> >> I can't reproduce this with the same OS and Clang versions, XCode
>> >> >> 5.0.1
>> >> >> and
>> >> >> Homebrew Python 2.7.
>> >> >>
>> >> >> Do you get the same without a virtualenv? Maybe try ``git clean
>> >> >> -xdf``
>> >> >> followed by an in-place build. Do you get this for Python 2.7 as
>> >> >> well?
>> >> >> And
>> >> >> which XCode and Python (version + how installed)?
>> >> >
>> >> > Thanks for checking.
>> >> >
>> >> > I do get the same with an in-place python 2.7 build, after git clean
>> >> > -fxd, and I get the same in a virtualenv with python 2.7.
>> >> >
>> >> > For both python 3.3 and python 2.7 I'm using the python.org binaries
>> >> > installed from the binary dmg installers.
>> >> >
>> >> > [mb312 at Kerbin ~]$ python2.7 --version
>> >> > Python 2.7.6
>> >> > [mb312 at Kerbin ~]$ python3.3 --version
>> >> > Python 3.3.2
>> >> > [mb312 at Kerbin ~]$ xcodebuild -version
>> >> > Xcode 5.0.2
>> >> > Build version 5A3005
>> >>
>> >> Just as a data point - the build works fine for system python.
>> >
>> >
>> > Probably the issue is that more recent XCode ignores
>> > __STDC_FORMAT_MACROS
>> > defined here:
>> >
>> > https://github.com/scipy/scipy/blob/master/scipy/sparse/sparsetools/setup.py#L15.
>> > At least that's what's claimed here:
>> > http://software.intel.com/en-us/forums/topic/498727. Workaround
>> > suggested
>> > there, can you try that out?
>> >
>> > That still doesn't explain why only the python.org binaries fail, but
>> > that
>> > should have something to do with the different build flags coming from
>> > distutils for the different Pythons.
>>
>> Sorry to be dumb - but I wasn't sure what the workaround should be,
>> from that page. Is it:
>>
>> export CLANG_CXX_LIBRARY=libstdc++
>
>
> Sorry, yes that should do it.

Short version: I needed

export CXX=clang++

instead of

export CXX=clang

Long version:

Hint here: http://stackoverflow.com/questions/4788721/how-can-i-resolve-missing-symbols-when-compiling-c-code-with-clang-2-8-on-mac

Full flags for compile:

export CC=clang
export CXX=clang++
export FFLAGS=-ff2c

I didn't set the CLANG_CXX_LIBRARY (and doing so didn't fix the compile).

I think that should be correct for earlier xcodes, so I proposed the
change in the docs here:

https://github.com/scipy/scipy.org/pull/49

Best,

Matthew



More information about the SciPy-Dev mailing list