PyCEGUIOpenGLRenderer fails to link: missing implementation of ~OpenGLRenderTarget()

Issue #995 resolved
Former user created an issue

Automatic migration. Original reporter: "CABAListic"

This one is a bit puzzling. Linking the PyCEGUIOpenGLRenderer module with clang on OSX failed for me because the linker couldn't find the implementation of OpenGLRenderTarget<T>'s destructor, as referenced by the module's wrapper class around ViewportTarget. I'm not exactly sure, why. It clearly must be contained in the CEGUIOpenGLRenderer library which the Python module links against, and this works on Windows. Perhaps the implementation is hidden for whatever reason.

I'm not sure how to fix it properly. I hacked it by linking the PyCEGUIOpenGLRenderer target against OpenGL, GLM and GLEW and including RenderTarget.inl in OpenGLViewportTarget.pypp.cpp. That makes it work, but given that that file is generated by pypp, it's not a proper fix.

Reproducibility: always

OS: OSX, OS build: 10.7, Platform: Mac

Comments (8)

  1. ATAGOYAMA Tanuki

    Did you say about following errors?

     Linking CXX shared module ../../../../../lib/PyCEGUIOpenGLRenderer.so
    cd /tmp/cegui-20171122-21228-fdwjbn/cegui-0.8.7/cegui/src/ScriptModules/Python/bindings && /usr/local/Cellar/cmake/3.10.0/bin/cmake -E cmake_link_script CMakeFiles/PyCEGUIOpenGLRenderer.dir/link.txt --verbose=1
    ccache /usr/local/Homebrew/Library/Homebrew/shims/super/clang++  -std=c++03  -fsigned-char -DNDEBUG -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -bundle -Wl,-headerpad_max_install_names   -fsigned-char -o ../../../../../lib/PyCEGUIOpenGLRenderer.so CMakeFiles/PyCEGUIOpenGLRenderer.dir/output/CEGUIOpenGLRenderer/OpenGLGeometryBufferBase.pypp.cpp.o CMakeFiles/PyCEGUIOpenGLRenderer.dir/output/CEGUIOpenGLRenderer/OpenGLRenderer.pypp.cpp.o CMakeFiles/PyCEGUIOpenGLRenderer.dir/output/CEGUIOpenGLRenderer/OpenGLRendererBase.pypp.cpp.o CMakeFiles/PyCEGUIOpenGLRenderer.dir/output/CEGUIOpenGLRenderer/OpenGLTextureTarget.pypp.cpp.o CMakeFiles/PyCEGUIOpenGLRenderer.dir/output/CEGUIOpenGLRenderer/OpenGLViewportTarget.pypp.cpp.o CMakeFiles/PyCEGUIOpenGLRenderer.dir/output/CEGUIOpenGLRenderer/PyCEGUIOpenGLRenderer.main.cpp.o /usr/local/lib/libboost_python3-mt.dylib /usr/local/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib ../../../../../lib/libCEGUIOpenGLRenderer-0.dylib ../../../../../lib/libCEGUIBase-0.dylib /usr/lib/libiconv.dylib /usr/local/lib/libfreetype.dylib /usr/local/lib/libpcre.dylib /usr/local/lib/libfribidi.dylib /usr/local/lib/libglib-2.0.dylib /usr/local/opt/gettext/lib/libintl.dylib /usr/local/lib/libminizip.dylib -framework OpenGL /usr/local/lib/libGLEW.dylib 
    Undefined symbols for architecture x86_64:
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::deactivate()", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::draw(CEGUI::RenderQueue const&)", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::draw(CEGUI::GeometryBuffer const&)", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::setArea(CEGUI::Rect<float> const&)", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::activate()", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::deactivate()", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::draw(CEGUI::RenderQueue const&)", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::draw(CEGUI::GeometryBuffer const&)", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::setArea(CEGUI::Rect<float> const&)", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::activate()", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::updateMatrix() const", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::unprojectPoint(CEGUI::GeometryBuffer const&, CEGUI::Vector2<float> const&, CEGUI::Vector2<float>&) const", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::getArea() const", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::updateMatrix() const", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::unprojectPoint(CEGUI::GeometryBuffer const&, CEGUI::Vector2<float> const&, CEGUI::Vector2<float>&) const", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::getArea() const", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [lib/PyCEGUIOpenGLRenderer.so] Error 1
    make[1]: *** [cegui/src/ScriptModules/Python/bindings/CMakeFiles/PyCEGUIOpenGLRenderer.dir/all] Error 2
    

    Because these symbols aren't global.

    $ nm -g -o lib/libCEGUIOpenGLRenderer-0.dylib |c++filt |sed -e "s/^.*.dylib://" |grep "deactivate"
     0000000000005da6 T CEGUI::OpenGLFBOTextureTarget::deactivate()
     0000000000004f10 T CEGUI::OpenGLApplePBTextureTarget::deactivate()
    
    $ nm -o lib/libCEGUIOpenGLRenderer-0.dylib |c++filt |sed -e "s/^.*.dylib://" |grep "deactivate"
     00000000000073b6 unsigned short CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::deactivate()
     00000000000073b6 unsigned short CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::deactivate()
     0000000000005da6 T CEGUI::OpenGLFBOTextureTarget::deactivate()
     0000000000004f10 T CEGUI::OpenGLApplePBTextureTarget::deactivate()
    
  2. ATAGOYAMA Tanuki

    Adding the following lines to cegui/src/RendererModules/OpenGL/ViewportTarget.cpp reduced errors, but failed to completely eliminate the error.

    template void CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::deactivate();
    template void CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::draw(CEGUI::RenderQueue const&);
    template void CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::draw(CEGUI::GeometryBuffer const&);
    template void CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::setArea(CEGUI::Rect<float> const&);
    template void CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::activate();
    template void CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::updateMatrix() const;
    template void CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::unprojectPoint(CEGUI::GeometryBuffer const&, CEGUI::Vector2<float> const&, CEGUI::Vector2<float>&) const;
    template void CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::deactivate();
    template void CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::draw(CEGUI::RenderQueue const&);
    template void CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::draw(CEGUI::GeometryBuffer const&);
    template void CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::setArea(CEGUI::Rect<float> const&);
    template void CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::activate();
    template void CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::updateMatrix() const;
    template void CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::unprojectPoint(CEGUI::GeometryBuffer const&, CEGUI::Vector2<float> const&, CEGUI::Vector2<float>&) const;
    
    Undefined symbols for architecture x86_64:
      "CEGUI::OpenGLRenderTarget<CEGUI::RenderTarget>::getArea() const", referenced from:
          vtable for OpenGLViewportTarget_wrapper in OpenGLViewportTarget.pypp.cpp.o
      "CEGUI::OpenGLRenderTarget<CEGUI::TextureTarget>::getArea() const", referenced from:
          vtable for OpenGLTextureTarget_wrapper in OpenGLTextureTarget.pypp.cpp.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [lib/PyCEGUIOpenGLRenderer.so] Error 1
    make[1]: *** [cegui/src/ScriptModules/Python/bindings/CMakeFiles/PyCEGUIOpenGLRenderer.dir/all] Error 2
    
  3. ATAGOYAMA Tanuki

    There are other undetected problems.

    $ nm -o /usr/local/Cellar/cegui/0.8.7/lib/libCEGUIIrrlichtRenderer-0.dylib |sed -e "s/^.*: //"|c++filt|grep "IrrlichtRenderTarget"
    0000000000004eb8 unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::RenderTarget>::deactivate()
    000000000000b44e unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::RenderTarget>::draw(CEGUI::RenderQueue const&)
    000000000000b430 unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::RenderTarget>::draw(CEGUI::GeometryBuffer const&)
    000000000000c5fc unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::RenderTarget>::setArea(CEGUI::Rect<float> const&)
    000000000000c6da unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::RenderTarget>::activate()
    000000000000b450 unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::TextureTarget>::draw(CEGUI::RenderQueue const&)
    000000000000b432 unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::TextureTarget>::draw(CEGUI::GeometryBuffer const&)
    000000000000b45e unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::TextureTarget>::setArea(CEGUI::Rect<float> const&)
    000000000000b13a unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::TextureTarget>::activate()
    000000000000cc5e unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::RenderTarget>::updateMatrix() const
    000000000000c76e unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::RenderTarget>::unprojectPoint(CEGUI::GeometryBuffer const&, CEGUI::Vector2<float> const&, CEGUI::Vector2<float>&) const
    000000000000b540 unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::RenderTarget>::getArea() const
    000000000000ba3c unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::TextureTarget>::updateMatrix() const
    000000000000b54c unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::TextureTarget>::unprojectPoint(CEGUI::GeometryBuffer const&, CEGUI::Vector2<float> const&, CEGUI::Vector2<float>&) const
    000000000000b542 unsigned short CEGUI::IrrlichtRenderTarget<CEGUI::TextureTarget>::getArea() const
    
    $ nm -o /usr/local/Cellar/cegui/0.8.7/lib/libCEGUIOgreRenderer-0.dylib |sed -e "s/^.*: //"|c++filt|grep "OgreRenderTarget"
    0000000000006306 unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::deactivate()
    0000000000010590 unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::updateViewport()
    000000000000f71a unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::setOgreViewportDimensions(CEGUI::Rect<float> const&)
    000000000000f5f6 unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::updateOgreViewportDimensions(Ogre::RenderTarget const*)
    000000000000ede4 unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::draw(CEGUI::RenderQueue const&)
    000000000000edc6 unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::draw(CEGUI::GeometryBuffer const&)
    000000000000fcc2 unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::setArea(CEGUI::Rect<float> const&)
    000000000000fda6 unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::activate()
    000000000000fa5c unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::OgreRenderTarget(CEGUI::OgreRenderer&, Ogre::RenderSystem&)
    000000000001046c unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::~OgreRenderTarget()
    0000000000010462 unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::~OgreRenderTarget()
    000000000000fb8c unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::~OgreRenderTarget()
    00000000000062fe unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::deactivate()
    000000000000e8e4 unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::updateViewport()
    000000000000f720 unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::setOgreViewportDimensions(CEGUI::Rect<float> const&)
    000000000000f5fa unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::updateOgreViewportDimensions(Ogre::RenderTarget const*)
    000000000000edec unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::draw(CEGUI::RenderQueue const&)
    000000000000edce unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::draw(CEGUI::GeometryBuffer const&)
    000000000000edfa unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::setArea(CEGUI::Rect<float> const&)
    000000000000eeee unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::activate()
    000000000000e570 unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::OgreRenderTarget(CEGUI::OgreRenderer&, Ogre::RenderSystem&)
    000000000000f5bc unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::~OgreRenderTarget()
    000000000000f5b2 unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::~OgreRenderTarget()
    000000000000e77e unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::~OgreRenderTarget()
    000000000001049e unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::updateMatrix() const
    000000000000fe0c unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::unprojectPoint(CEGUI::GeometryBuffer const&, CEGUI::Vector2<float> const&, CEGUI::Vector2<float>&) const
    000000000000eedc unsigned short CEGUI::OgreRenderTarget<CEGUI::RenderTarget>::getArea() const
    000000000000f766 unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::updateMatrix() const
    000000000000ef54 unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::unprojectPoint(CEGUI::GeometryBuffer const&, CEGUI::Vector2<float> const&, CEGUI::Vector2<float>&) const
    000000000000eee4 unsigned short CEGUI::OgreRenderTarget<CEGUI::TextureTarget>::getArea() const
    00000000000160d8 double vtable for CEGUI::OgreRenderTarget<CEGUI::RenderTarget>
    0000000000015fa8 double vtable for CEGUI::OgreRenderTarget<CEGUI::TextureTarget>
    
  4. Log in to comment