[osg-users] Android osgPlugins

Christian Kehl christian-kehl at web.de
Sat Apr 25 13:11:24 PDT 2015


Hi,

Thank you for the clarification. I followed the example, which gave me this output:

christian at PROMETHEUS:/media/christian/DATA/osgAndroid/org.openscenegraph.android$ ${ANDROID_NDK}/ndk-build
[armeabi] Compile++ thumb: jniosg-gles1 <= JNIosgViewer.cpp
jni/JNIosgViewer.cpp:23:28: fatal error: osg/observer_ptr: No such file or directory
 #include <osg/observer_ptr>
                            ^
compilation terminated.
make: *** [obj/local/armeabi/objs/jniosg-gles1/JNIosgViewer.o] Error 1

I had a look into the Android.mk file, which gave me the following insights:
1) the makefile statically searches for the osg plugins of version 3.3.3 - I hardcoded now 3.3.7 (which is the version I am using). Perhaps that could be done with some environment variable or automatic parsing ? I would involve a bit cmake code, I guess ...
2) the error above may come because "LOCAL_C_INCLUDES" is set, but "LOCAL_CPP_INCLUDES" is not. Because OSG is C++ and because that distinction matters for me with g++ in teh backend, I set the path.

After this minor adaptations, the compilation with the ndk actually progresses, but has problems when starting to link the libraries:

christian at PROMETHEUS:/media/christian/DATA/osgAndroid/org.openscenegraph.android$ ${ANDROID_NDK}/ndk-build
[armeabi] Compile++ thumb: jniosg-gles1 <= JNIosgViewer.cpp
[armeabi] Compile++ thumb: jniosg-gles1 <= JNIosg.cpp
[armeabi] Compile++ thumb: jniosg-gles1 <= JNIosgDB.cpp
[armeabi] Compile++ thumb: jniosg-gles1 <= JNIosgUtil.cpp
[armeabi] Compile++ thumb: jniosg-gles1 <= JNIosgGA.cpp
[armeabi] Compile++ thumb: jniosg-gles1 <= JNIUtils.cpp
[armeabi] Compile++ thumb: jniosg-gles1 <= MultiViewNode.cpp
[armeabi] Compile++ thumb: jniosg-gles1 <= GLES2ShaderGenVisitor.cpp
[armeabi] SharedLibrary  : libjniosg-gles1.so
/home/christian/Downloads/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: cannot find -losgdb_serializers_osgpresentation
/home/christian/Downloads/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lgnustl_static
/home/christian/android_install/lib/osgPlugins-3.3.7/libosgdb_ive.a(DataOutputStream.cpp.o):DataOutputStream.cpp:typeinfo for osg::Node const*: error: undefined reference to 'vtable for __cxxabiv1::__pointer_type_info'
/home/christian/Downloads/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function
/home/christian/android_install/lib/libosgWidget.a(Input.cpp.o):Input.cpp:function osgWidget::Input::_calculateCursorOffsets(): error: undefined reference to 'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
/home/christian/android_install/lib/libosgWidget.a(Input.cpp.o):Input.cpp:function osgWidget::Input::_calculateCursorOffsets(): error: undefined reference to 'std::__detail::_List_node_base::_M_unhook()'
/home/christian/android_install/lib/libosgWidget.a(Widget.cpp.o):Widget.cpp:function osgWidget::Widget::Widget(osgWidget::Widget const&, osg::CopyOp const&): error: undefined reference to 'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
/home/christian/android_install/lib/libosgWidget.a(Window.cpp.o):Window.cpp:function osgWidget::Window::getParentList(std::list<osg::observer_ptr<osgWidget::Window>, std::allocator<osg::observer_ptr<osgWidget::Window> > >&) const: error: undefined reference to 'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
/home/christian/android_install/lib/libosgWidget.a(Window.cpp.o):Window.cpp:function osgWidget::Window::getEmbeddedList(std::list<osg::observer_ptr<osgWidget::Window>, std::allocator<osg::observer_ptr<osgWidget::Window> > >&) const: error: undefined reference to 'std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
/home/christian/android_install/lib/libosgViewer.a(CompositeViewer.cpp.o):CompositeViewer.cpp:function void std::list<osg::ref_ptr<osgGA::Event>, std::allocator<osg::ref_ptr<osgGA::Event> > >::merge<SortEvents>(std::list<osg::ref_ptr<osgGA::Event>, std::allocator<osg::ref_ptr<osgGA::Event> > >&, SortEvents): error: undefined reference to 'std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)'
/home/christian/android_install/lib/libosgViewer.a(CompositeViewer.cpp.o):CompositeViewer.cpp:function void std::list<osg::ref_ptr<osgGA::Event>, std::allocator<osg::ref_ptr<osgGA::Event> > >::merge<SortEvents>(std::list<osg::ref_ptr<osgGA::Event>, std::allocator<osg::ref_ptr<osgGA::Event> > >&, SortEvents): error: undefined reference to 'std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)'
/home/christian/android_install/lib/libosgViewer.a(CompositeViewer.cpp.o):CompositeViewer.cpp:function void std::list<osg::ref_ptr<osgGA::Event>, std::allocator<osg::ref_ptr<osgGA::Event> > >::sort<SortEvents>(SortEvents): error: undefined reference to 'std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)'
/home/christian/android_install/lib/libosgViewer.a(CompositeViewer.cpp.o):CompositeViewer.cpp:function void std::list<osg::ref_ptr<osgGA::Event>, std::allocator<osg::ref_ptr<osgGA::Event> > >::sort<SortEvents>(SortEvents): error: undefined reference to 'std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)'
/home/christian/android_install/lib/libosgViewer.a(CompositeViewer.cpp.o):CompositeViewer.cpp:function void std::list<osg::ref_ptr<osgGA::Event>, std::allocator<osg::ref_ptr<osgGA::Event> > >::sort<SortEvents>(SortEvents): error: undefined reference to 'std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)'
/home/christian/android_install/lib/libosgViewer.a(CompositeViewer.cpp.o):CompositeViewer.cpp:function void std::list<osg::ref_ptr<osgGA::Event>, std::allocator<osg::ref_ptr<osgGA::Event> > >::sort<SortEvents>(SortEvents): error: undefined reference to 'std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)'
/home/christian/android_install/lib/libosgViewer.a(CompositeViewer.cpp.o):CompositeViewer.cpp:function osgViewer::CompositeViewer::eventTraversal(): error: undefined reference to 'std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)'
/home/christian/android_install/lib/libosgViewer.a(GraphicsWindow.cpp.o):GraphicsWindow.cpp:function std::list<osgViewer::View*, std::allocator<osgViewer::View*> >::sort(): error: undefined reference to 'std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)'
/home/christian/android_install/lib/libosgViewer.a(GraphicsWindow.cpp.o):GraphicsWindow.cpp:function osgViewer::GraphicsWindow::getViews(std::list<osgViewer::View*, std::allocator<osgViewer::View*> >&): error: undefined reference to 'std::__detail::_List_node_base::_M_unhook()'
/home/christian/android_install/lib/libosgViewer.a(View.cpp.o):View.cpp:function osgViewer::View::removeEventHandler(osgGA::EventHandler*): error: undefined reference to 'std::__detail::_List_node_base::_M_unhook()'
/home/christian/android_install/lib/libosgViewer.a(View.cpp.o):View.cpp:function std::list<osg::ref_ptr<osg::Camera>, std::allocator<osg::ref_ptr<osg::Camera> > >::operator=(std::list<osg::ref_ptr<osg::Camera>, std::allocator<osg::ref_ptr<osg::Camera> > > const&): error: undefined reference to 'std::__detail::_List_node_base::_M_unhook()'
/home/christian/android_install/lib/libosgText.a(Glyph.cpp.o):Glyph.cpp:function osgText::GlyphTexture::apply(osg::State&) const: error: undefined reference to 'glGenerateMipmap'
/home/christian/android_install/lib/libosgFX.a(AnisotropicLighting.cpp.o):AnisotropicLighting.cpp:function (anonymous namespace)::ViewMatrixExtractor::compare(osg::StateAttribute const&) const: error: undefined reference to 'std::type_info::before(std::type_info const&) const'
/home/christian/android_install/lib/libosgFX.a(BumpMapping.cpp.o):BumpMapping.cpp:function (anonymous namespace)::ViewMatrixExtractor::compare(osg::StateAttribute const&) const: error: undefined reference to 'std::type_info::before(std::type_info const&) const'
/home/christian/android_install/lib/libosgFX.a(SpecularHighlights.cpp.o):SpecularHighlights.cpp:function (anonymous namespace)::AutoTextureMatrix::compare(osg::StateAttribute const&) const: error: undefined reference to 'std::type_info::before(std::type_info const&) const'
/home/christian/android_install/lib/libosgFX.a(Validator.cpp.o):Validator.cpp:function osgFX::Validator::compare(osg::StateAttribute const&) const: error: undefined reference to 'std::type_info::before(std::type_info const&) const'
/home/christian/android_install/lib/libosg.a(Shader.cpp.o):Shader.cpp:function osg::Shader::PerContextShader::compileShader(osg::State&): error: undefined reference to 'glShaderBinary'
/home/christian/android_install/lib/libosg.a(Texture.cpp.o):Texture.cpp:function osg::Texture::TextureObjectManager::checkConsistency() const: error: undefined reference to 'typeinfo for char const*'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi/libjniosg-gles1.so] Error 1

I'll investigate that further by tomorrow.

I attached my new Android.mk, so you can have a look on the changes. it's the one from the "org.openscenegraph.android/jni" folder.

Thank you!

Cheers,
Christian

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63534#63534




Attachments: 
http://forum.openscenegraph.org//files/android_makefiletar_136.gz





More information about the osg-users mailing list