cocuh's note

type(あうとぷっと) -> 駄文

importing cython binary raises Symbol Not Found: expected flat namespace, Mac OS X

数週間悩まされつづけたので書きました。
This error troubles me in a few weeks, though the cause is tooo simple.

RESULT

UPDATE YOUR XCode FROM GUI

symptons

  • using cython, I want to wrap c++ library
  • write setup.py and compile it with python setup.py build_ext --inplace -f
  • the error raises when I import the compiled library in python.
>>> import foo
ImportError: dlopen(${LIBRARY_PATH}.so, 2): Symbol not found: _ZNSt8ios_base4InitD1Ev
  Referenced from: ${LIBRARY_PATH}.so
  Expected in: flat namespace
  • using homebrew, install gcc
  • compile with export CXX=g++-5 and `export CC=g++-5'

trial

_ZNSt8ios_base4InitD1Ev means std::ios::Init.(using c++flit). I suppose link error to standard library. I also tried setting LD_LIBRARY_PATH and DYLD_LIBARY_PATH. I tried updating gcc and update some tools, copying /usr/lib/libc++.dylib to CWD, setting -stdlib=libc++ or -stdlib=libstdc++... and so on. When I run brew doctor, it said 'XCode is too OLD, update pleese'.

I'm linux user(archer)and not MACer. I didn't understand when MacOSX's SoftwareUpdate update softwares and I thought stdlib is also updated when package manager update compiler. Though I run softwareupdate -i -a and restart, the XCode wasn't updated.←why?????????? You should run softwareupdate from gui. I angry with the f*ckin UI, though it's lack of knowledge.