2015-04-21 5 views
7

Ich versuche, PyFTGL auf MacOSX Yosemite zu installieren.MacOSX + Boost_Python + PyFTGL: - Symbol nicht gefunden, erwartet in: flacher Namespace

Die Python-Version, die ich verwende, ist 2.7 von Macports. Ich habe Boost von Macports installiert, die + python27 spezifizieren.

Um PyFTGL installiert ich aus dem Quellcode und bearbeiten die setup.py-Datei aus:

module_ftgl_libs = [ 
    'GLU', 
    'GL', 
    'freetype', 
    'z', 
    'ftgl', 
    'boost_python', 
    ] 

module_ftgl = Extension(
    'FTGL', 
    module_ftgl_src, 
    include_dirs=module_ftgl_include_dirs, 
    libraries=module_ftgl_libs 
    ) 

zu:

module_ftgl_libs = [ 
    'freetype', 
    'z', 
    'ftgl', 
    'boost_python', 
    ] 

module_ftgl = Extension(
    'FTGL', 
    module_ftgl_src, 
    include_dirs=module_ftgl_include_dirs, 
    libraries=module_ftgl_libs, 
    extra_link_args=['-framework', 'OpenGL', '-framework', 'GLUT'] 
    ) 

ich die setup.py-Datei dann bauen und die daraus resultierenden ftgl kopieren. also file in den gleichen Ordner wie mein Python-Code test.py, der die FTGL-Funktionen verwendet.

Mein Problem ist, wenn ich jetzt meinen Code ich folgende Fehlermeldung erhalten, laufen:

Traceback (most recent call last): 
    File "test.py", line 29, in <module> 
    import FTGL 
ImportError: dlopen(/Users/james/Desktop/test/FTGL.so, 2): Symbol not found:__ZN5boost6python7objects15function_objectERKNS1_11py_functionERKNSt3__14pairIPNS0_6detail7keywordESA_EE 
    Referenced from: /Users/james/Desktop/test/FTGL.so 
    Expected in: flat namespace 
in /Users/james/Desktop/test/FTGL.so 

Ich weiß nicht viel über die Verknüpfung, setup.py Dateien und steigern, und ich habe eine lange Zeit mit der Erforschung auf ausgegeben sowohl Google als auch Stack Overflow, aber jetzt kann ich das Problem nicht lösen.

+0

Ich habe dieses Problem auch. Hast du das jemals gelöst? – kilojoules

+0

Können Sie versuchen, nm zu verwenden, um Ihre Symboltabelle in FTGL.so anzuzeigen? http://stackoverflow.com/questions/2989233/python-import-error-symbol-not-found-but-the-symbols-sis-s-not-present –

Antwort

1

konnte ich diesen Fehler überwinden, indem alle Boost-Bibliotheken dann brew install boost155 --with-python --with-mpi --without-single mit deinstallieren und von Homebrew gcc Schalt/g ++ - 5 bis gcc/g ++ - 4.9

-brew edit boost155 gehen und das Layout tagged-system ersetzen, wenn

möglich
1

Mit c++filt kann das Symbol als dekodiert werden:

$ c++filt -n _ZN5boost6python7objects15function_objectERKNS1_11py_functionERKSt4pairIPKNS0_6detail7keywordES9_E 
boost::python::objects::function_object(boost::python::objects::py_function const&, std::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&) 

Da ich das gleiche Problem haben, sah ich für ähnliche Symbole in der libboost_python.dylib:

$ nm -gU ~/Downloads/boost_1_60_0/bin.v2/libs/python/build/darwin-4.2.1/debug/libboost_python.dylib | grep function_object 
0000000000027cd0 T __ZN5boost6python7objects15function_objectERKNS1_11py_functionE 
0000000000027c20 T __ZN5boost6python7objects15function_objectERKNS1_11py_functionERKNSt3__14pairIPKNS0_6detail7keywordESA_EE 

Eines davon decodiert als:

boost::python::objects::function_object(boost::python::objects::py_function const&, std::__1::pair<boost::python::detail::keyword const*, boost::python::detail::keyword const*> const&) 

Der einzige Unterschied besteht darin, dass die Boost dynamische lib verwendet std::__1::pair anstelle von std::pair. Wie auch hier erwähnt: Why can't clang with libc++ in c++0x mode link this boost::program_options example?, libc++ und libstdc++ sind nicht kompatibel. Eine Möglichkeit ist, Boost mit libstdc++ zu rekompilieren:

Verwandte Themen