marsliteng / pyv8

Automatically exported from code.google.com/p/pyv8
0 stars 0 forks source link

"python setup.py test" failing with "Symbol not found: __ZSt20__throw_length_errorPKc" #220

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Using pyv8 r566, v8 r18418, boost 1.55.0 r86799 on OSX 10.9.1
2. "python setup.py build" succeeds
3. Boost from source and Boost from brew produce same results

What is the expected output? What do you see instead?

python setup.py test
INFO: Found Google v8 base on V8_HOME </path/v8>
running test
running egg_info
writing requirements to PyV8.egg-info/requires.txt
writing PyV8.egg-info/PKG-INFO
writing top-level names to PyV8.egg-info/top_level.txt
writing dependency_links to PyV8.egg-info/dependency_links.txt
reading manifest template 'MANIFEST.in'
writing manifest file 'PyV8.egg-info/SOURCES.txt'
running build_ext
copying build/lib.macosx-10.9-intel-2.7/_PyV8.so -> 
Traceback (most recent call last):
  File "setup.py", line 624, in <module>
    **extra)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.macosx-10.9-intel/egg/setuptools/command/test.py", line 138, in run
  File "build/bdist.macosx-10.9-intel/egg/setuptools/command/test.py", line 118, in with_project_on_sys_path
  File "build/bdist.macosx-10.9-intel/egg/setuptools/command/test.py", line 164, in run_tests
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/path/PyV8.py", line 32, in <module>
    import _PyV8
ImportError: dlopen(/path/pyv8/_PyV8.so, 2): Symbol not found: 
__ZSt20__throw_length_errorPKc
  Referenced from: /path/pyv8/_PyV8.so
  Expected in: flat namespace
 in /path/pyv8/_PyV8.so

What version of the product are you using? On what operating system?

sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.9.1
BuildVersion:   13B42

Please provide any additional information below.

python -V
Python 2.7.5

Boost built with: "boostrap.sh", "b2 --layout=tagged install"

otool -L _PyV8.so 
_PyV8.so:
    libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

nm _PyV8.so | grep __ZSt20__throw_length_errorPKc
                 U __ZSt20__throw_length_errorPKc

Original issue reported on code.google.com by joel...@gmail.com on 26 Dec 2013 at 6:07

GoogleCodeExporter commented 9 years ago
The root cause is v8 default link with libstdc++ instead of libc++

https://code.google.com/p/v8/issues/detail?id=3072

Original comment by flier...@gmail.com on 27 Dec 2013 at 11:17

GoogleCodeExporter commented 9 years ago
Thanks for the tip. 10.9 has been a treat.

Got past this by building v8 with:
export CXXFLAGS='-std=c++11 -stdlib=libc++ -mmacosx-version-min=10.8'
export LDFLAGS=-lc++

But then ran into problems with icu:
...
Symbol not found: __ZTVN6icu_4613FieldPositionE
  Referenced from: /path/pyv8/_PyV8.so
...

Worked-around by re-building v8 with "i18nsupport=off"

Not ideal, but it works.

Original comment by joel...@gmail.com on 27 Dec 2013 at 7:14

GoogleCodeExporter commented 9 years ago
you could build v8 with pyv8's setup script, which will disable i18n by default 
:)

Original comment by flier...@gmail.com on 7 Jan 2014 at 10:46