OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Android - NDK Compiling fails


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Crisium (Peter Wraae Marino)
User


Joined: 30 Dec 2008
Posts: 49

PostPosted: Thu Jul 25, 2013 7:56 am    Post subject:
Android - NDK Compiling fails
Reply with quote

Hi,

This has been a long process trying to get android to work with OpenSceneGraph and I'm still not there.

Some Info:

Windows 7
OpenSceneGraph 3.2


Where I'm at:

OpenSceneGraph 3.2 compiled/links ok.

Now I'm trying to run ndk-make in the JNI directory for the osgAndroidExampleGLES2 and it fails here. 100's of errors that look like this:

C:/Android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/
ld.exe: C:\Android\OpenSceneGraph-3.2\osginstall/obj/local/armeabi/libosg.a(Notify.o): in function vtable for osg::NotifyStreamBuffer:Notify.cpp(.data.rel.ro._Z
TVN3osg18NotifyStreamBufferE+0x3c): error: undefined reference to 'std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow(int)'
collect2: ld returned 1 exit status

this of course looks like the famous stl problem mentioned on this forum with 10 different ways to solve it. I tried all 10 ways putting the -lgnustl-static in the LOCAL_LDLIBS and/or in the LOCAL_LDFLAGS as mention in different forums... no success.

I'm kinda' stumped and do not know how I should proceed to solve this problem.

Thank you!

Cheers,
Peter
Back to top
View user's profile Send private message
Jordi Torres
Guest





PostPosted: Thu Jul 25, 2013 8:05 am    Post subject:
Android - NDK Compiling fails
Reply with quote

Hi Peter,


Can you post your Android.mk file. For me it was enough to add gnustl-static to the LOCAL_LDFLAGS and remove it from LOCAL_LDLIBS.


Cheers.




2013/7/25 Peter Wraae Marino < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
Hi,

This has been a long process trying to get android to work with OpenSceneGraph and I'm still not there.

Some Info:

Windows 7
OpenSceneGraph 3.2


Where I'm at:

OpenSceneGraph 3.2 compiled/links ok.

Now I'm trying to run ndk-make in the JNI directory for the osgAndroidExampleGLES2 and it fails here. 100's of errors that look like this:

C:/Android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/
ld.exe: C:AndroidOpenSceneGraph-3.2osginstall/obj/local/armeabi/libosg.a(Notify.o): in function vtable for osg::NotifyStreamBuffer:Notify.cpp(.data.rel.ro._Z
TVN3osg18NotifyStreamBufferE+0x3c): error: undefined reference to 'std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow(int)'
collect2: ld returned 1 exit status

this of course looks like the famous stl problem mentioned on this forum with 10 different ways to solve it. I tried all 10 ways putting the -lgnustl-static in the LOCAL_LDLIBS and/or in the LOCAL_LDFLAGS as mention in different forums... no success.

I'm kinda' stumped and do not know how I should proceed to solve this problem.

Thank you!

Cheers,
Peter

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Jordi Torres

------------------
Post generated by Mail2Forum
Back to top
Crisium (Peter Wraae Marino)
User


Joined: 30 Dec 2008
Posts: 49

PostPosted: Thu Jul 25, 2013 8:09 am    Post subject:
Reply with quote

sure here it is... but like i mentioned i tried many different combinations also the one you described.

Code:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := osgNativeLib
### Main Install dir
OSG_ANDROID_DIR   := C:\Android\OpenSceneGraph-3.2\osginstall
LIBDIR          := $(OSG_ANDROID_DIR)/obj/local/armeabi

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
   LOCAL_ARM_NEON    := true
   LIBDIR          := $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a
endif

### Add all source file names to be included in lib separated by a whitespace

LOCAL_C_INCLUDES:= $(OSG_ANDROID_DIR)/include
LOCAL_CFLAGS    := -Werror -fno-short-enums
LOCAL_CPPFLAGS  := -DOSG_LIBRARY_STATIC

### which one, I would think the static, but some people in the forum say the shared.. makes no sense?... libgnustl_shared lgnustl_static
LOCAL_LDLIBS    := -llog -lGLESv2 -ldl -lz -lgnustl_static
LOCAL_SRC_FILES := osgNativeLib.cpp OsgMainApp.cpp OsgAndroidNotifyHandler.cpp
LOCAL_LDFLAGS   := -L $(LIBDIR) \
-losgdb_dds \
-losgdb_openflight \
-losgdb_tga \
-losgdb_rgb \
-losgdb_osgterrain \
-losgdb_osg \
-losgdb_ive \
-losgdb_deprecated_osgviewer \
-losgdb_deprecated_osgvolume \
-losgdb_deprecated_osgtext \
-losgdb_deprecated_osgterrain \
-losgdb_deprecated_osgsim \
-losgdb_deprecated_osgshadow \
-losgdb_deprecated_osgparticle \
-losgdb_deprecated_osgfx \
-losgdb_deprecated_osganimation \
-losgdb_deprecated_osg \
-losgdb_serializers_osgvolume \
-losgdb_serializers_osgtext \
-losgdb_serializers_osgterrain \
-losgdb_serializers_osgsim \
-losgdb_serializers_osgshadow \
-losgdb_serializers_osgparticle \
-losgdb_serializers_osgmanipulator \
-losgdb_serializers_osgfx \
-losgdb_serializers_osganimation \
-losgdb_serializers_osg \
-losgViewer \
-losgVolume \
-losgTerrain \
-losgText \
-losgShadow \
-losgSim \
-losgParticle \
-losgManipulator \
-losgGA \
-losgFX \
-losgDB \
-losgAnimation \
-losgUtil \
-losg \
-lOpenThreads

include $(BUILD_SHARED_LIBRARY)
Back to top
View user's profile Send private message
Jordi Torres
Guest





PostPosted: Thu Jul 25, 2013 8:25 am    Post subject:
Android - NDK Compiling fails
Reply with quote

Try this:

LOCAL_LDLIBS    := -llog -lGLESv2 -ldl -lz /path-to-your-android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a


I think it should be enough.



2013/7/25 Peter Wraae Marino < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
sure here it is... but like i mentioned i tried many different combinations also the one you described.


Code:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := osgNativeLib
### Main Install dir
OSG_ANDROID_DIR := C:AndroidOpenSceneGraph-3.2osginstall
LIBDIR                  := $(OSG_ANDROID_DIR)/obj/local/armeabi

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
        LOCAL_ARM_NEON  := true
        LIBDIR                  := $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a
endif

### Add all source file names to be included in lib separated by a whitespace

LOCAL_C_INCLUDES:= $(OSG_ANDROID_DIR)/include
LOCAL_CFLAGS    := -Werror -fno-short-enums
LOCAL_CPPFLAGS  := -DOSG_LIBRARY_STATIC

### which one, I would think the static, but some people in the forum say the shared.. makes no sense?... libgnustl_shared lgnustl_static
LOCAL_LDLIBS    := -llog -lGLESv2 -ldl -lz -lgnustl_static
LOCAL_SRC_FILES := osgNativeLib.cpp OsgMainApp.cpp OsgAndroidNotifyHandler.cpp
LOCAL_LDFLAGS   := -L $(LIBDIR)
-losgdb_dds
-losgdb_openflight
-losgdb_tga
-losgdb_rgb
-losgdb_osgterrain
-losgdb_osg
-losgdb_ive
-losgdb_deprecated_osgviewer
-losgdb_deprecated_osgvolume
-losgdb_deprecated_osgtext
-losgdb_deprecated_osgterrain
-losgdb_deprecated_osgsim
-losgdb_deprecated_osgshadow
-losgdb_deprecated_osgparticle
-losgdb_deprecated_osgfx
-losgdb_deprecated_osganimation
-losgdb_deprecated_osg
-losgdb_serializers_osgvolume
-losgdb_serializers_osgtext
-losgdb_serializers_osgterrain
-losgdb_serializers_osgsim
-losgdb_serializers_osgshadow
-losgdb_serializers_osgparticle
-losgdb_serializers_osgmanipulator
-losgdb_serializers_osgfx
-losgdb_serializers_osganimation
-losgdb_serializers_osg
-losgViewer
-losgVolume
-losgTerrain
-losgText
-losgShadow
-losgSim
-losgParticle
-losgManipulator
-losgGA
-losgFX
-losgDB
-losgAnimation
-losgUtil
-losg
-lOpenThreads

include $(BUILD_SHARED_LIBRARY)




------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=55429#55429





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





--
Jordi Torres

------------------
Post generated by Mail2Forum
Back to top
Crisium (Peter Wraae Marino)
User


Joined: 30 Dec 2008
Posts: 49

PostPosted: Thu Jul 25, 2013 8:43 am    Post subject:
Re: Android - NDK Compiling fails
Reply with quote

Hi Jordi,

that worked!

thanks.... it only needs to be more generic and perhaps committed to the repository.. it seems that everybody gets stuck here.

thanks,
Peter


Jordi Torres wrote:
Try this:

LOCAL_LDLIBS    := -llog -lGLESv2 -ldl -lz /path-to-your-android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a


I think it should be enough.



2013/7/25 Peter Wraae Marino < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
sure here it is... but like i mentioned i tried many different combinations also the one you described.


Code:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := osgNativeLib
### Main Install dir
OSG_ANDROID_DIR := C:AndroidOpenSceneGraph-3.2osginstall
LIBDIR                  := $(OSG_ANDROID_DIR)/obj/local/armeabi

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
        LOCAL_ARM_NEON  := true
        LIBDIR                  := $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a
endif

### Add all source file names to be included in lib separated by a whitespace

LOCAL_C_INCLUDES:= $(OSG_ANDROID_DIR)/include
LOCAL_CFLAGS    := -Werror -fno-short-enums
LOCAL_CPPFLAGS  := -DOSG_LIBRARY_STATIC

### which one, I would think the static, but some people in the forum say the shared.. makes no sense?... libgnustl_shared lgnustl_static
LOCAL_LDLIBS    := -llog -lGLESv2 -ldl -lz -lgnustl_static
LOCAL_SRC_FILES := osgNativeLib.cpp OsgMainApp.cpp OsgAndroidNotifyHandler.cpp
LOCAL_LDFLAGS   := -L $(LIBDIR)
-losgdb_dds
-losgdb_openflight
-losgdb_tga
-losgdb_rgb
-losgdb_osgterrain
-losgdb_osg
-losgdb_ive
-losgdb_deprecated_osgviewer
-losgdb_deprecated_osgvolume
-losgdb_deprecated_osgtext
-losgdb_deprecated_osgterrain
-losgdb_deprecated_osgsim
-losgdb_deprecated_osgshadow
-losgdb_deprecated_osgparticle
-losgdb_deprecated_osgfx
-losgdb_deprecated_osganimation
-losgdb_deprecated_osg
-losgdb_serializers_osgvolume
-losgdb_serializers_osgtext
-losgdb_serializers_osgterrain
-losgdb_serializers_osgsim
-losgdb_serializers_osgshadow
-losgdb_serializers_osgparticle
-losgdb_serializers_osgmanipulator
-losgdb_serializers_osgfx
-losgdb_serializers_osganimation
-losgdb_serializers_osg
-losgViewer
-losgVolume
-losgTerrain
-losgText
-losgShadow
-losgSim
-losgParticle
-losgManipulator
-losgGA
-losgFX
-losgDB
-losgAnimation
-losgUtil
-losg
-lOpenThreads

include $(BUILD_SHARED_LIBRARY)




------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=55429#55429





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





--
Jordi Torres

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Crisium (Peter Wraae Marino)
User


Joined: 30 Dec 2008
Posts: 49

PostPosted: Thu Jul 25, 2013 8:49 am    Post subject:
Reply with quote

Hi Jordi,

a little follow up:

this is what it does when it works:

C:\Android\OpenSceneGraph-3.2\examples\osgAndroidExampleGLES2\jni>ndk-build
"Compile++ thumb : osgNativeLib <= osgNativeLib.cpp
"Compile++ thumb : osgNativeLib <= OsgMainApp.cpp
"Compile++ thumb : osgNativeLib <= OsgAndroidNotifyHandler.cpp
SharedLibrary : libosgNativeLib.so
Install : libosgNativeLib.so => libs/armeabi/libosgNativeLib.so
"Compile++ thumb : osgNativeLib <= osgNativeLib.cpp
"Compile++ thumb : osgNativeLib <= OsgMainApp.cpp
"Compile++ thumb : osgNativeLib <= OsgAndroidNotifyHandler.cpp
SharedLibrary : libosgNativeLib.so
Install : libosgNativeLib.so => libs/armeabi-v7a/libosgNativeLib.so


what I do not understand is why is it creating the dynamic libraries and not the static... the documentation says we should be working with the static. Is there something wrong or is everything as it should be?

Thank you!

Cheers,
Peter
Back to top
View user's profile Send private message
Jordi Torres
Guest





PostPosted: Thu Jul 25, 2013 8:52 am    Post subject:
Android - NDK Compiling fails
Reply with quote

Hi Peter,


We use OSG as a static library, included in libosgNativeLib.so. This is the library that the VM loads when the application is started (a dynamic library). So the static part refers to the OpenSceneGraph libraries.


Cheers.



2013/7/25 Peter Wraae Marino < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)>
Quote:
Hi Jordi,

a little follow up:

this is what it does when it works:

C:AndroidOpenSceneGraph-3.2examplesosgAndroidExampleGLES2jni>ndk-build
"Compile++ thumb : osgNativeLib <= osgNativeLib.cpp
"Compile++ thumb : osgNativeLib <= OsgMainApp.cpp
"Compile++ thumb : osgNativeLib <= OsgAndroidNotifyHandler.cpp
SharedLibrary  : libosgNativeLib.so
Install        : libosgNativeLib.so => libs/armeabi/libosgNativeLib.so
"Compile++ thumb : osgNativeLib <= osgNativeLib.cpp
"Compile++ thumb : osgNativeLib <= OsgMainApp.cpp
"Compile++ thumb : osgNativeLib <= OsgAndroidNotifyHandler.cpp
SharedLibrary  : libosgNativeLib.so
Install        : libosgNativeLib.so => libs/armeabi-v7a/libosgNativeLib.so


what I do not understand is why is it creating the dynamic libraries and not the static... the documentation says we should be working with the static. Is there something wrong or is everything as it should be?

Thank you!

Cheers,
Peter

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=55433#55433





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org





--
Jordi Torres

------------------
Post generated by Mail2Forum
Back to top
alisterbadcoke
Newbie


Joined: 31 Jan 2014
Posts: 2

PostPosted: Fri Jan 31, 2014 8:36 am    Post subject:
Thanks
Reply with quote

Hi,

Thanks for providing such useful information. Here i got significant information, my cell phone has same problem but here i get the solution for it.


Thank you!

Cheers,
alisterbadcoke
Back to top
View user's profile Send private message
alisterbadcoke
Newbie


Joined: 31 Jan 2014
Posts: 2

PostPosted: Tue Mar 04, 2014 9:25 am    Post subject:
Android - NDK Compiling fails
Reply with quote

Hi,

Thanks for providing such useful information. Here i got significant information, my cell phone has same problem but here i get the solution for it.


Thank you!

Cheers,
alisterbadcoke

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







------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts OpenSceneGraph static linking for And... tanshihaj Build system [build] 0 Sun Aug 13, 2017 10:09 pm View latest post
No new posts osg plugin couldn't load an osgb or i... first_gle General 2 Sat May 27, 2017 3:52 am View latest post
No new posts A problem with regard to std:istream ... first_gle General 2 Fri May 26, 2017 6:11 am View latest post
No new posts Building OSG for Android -- Windowing... bwhaines Build system [build] 4 Sun Apr 23, 2017 2:01 am View latest post
No new posts OSG + Qt on Android Treazy General [3rdparty] 2 Fri Mar 31, 2017 10:44 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP