[osg-users] [build] Building the android examples with Eclipse on mac

Lonni Besançon lonni.besancon at gmail.com
Mon Jun 1 09:38:06 PDT 2015


Hi,

I'm completely new to openSceneGraph. I have it running more or less on my mac (I still encounter some weird segmentation fault on a code that works perfectly for a friend of mine on Linux) but appart from that I guess I'm fine with it.

However I would like to work on android. I do know how to use the native development on android and I have tried to build one of the exemples: the one for openGLES1. My problem is that I cannot use ndk-build without getting over and over the same mistake:



Code:
Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries in linker flags: -lgnustl_static -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    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
Android NDK: WARNING:jni/Android.mk:osgNativeLib: non-system libraries in linker flags: -lgnustl_static -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    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
[armeabi] Compile++ thumb: osgNativeLib <= osgNativeLib.cpp
In file included from jni/OsgMainApp.hpp:21:0,
                 from jni/osgNativeLib.cpp:7:
/Users/lonnibesancon/Desktop/OpenSceneGraph-3.2.2-rc2/buildandroid/include/osg/GL:124:35: fatal error: GL/gl.h: No such file or directory
#include <GL/gl.h>
compilation terminated.
make: *** [obj/local/armeabi/objs/osgNativeLib/osgNativeLib.o] Error 1



For some reasons, the include is not complete on the piece of code above, the include that doesn't work is GL/gl.h.

Now I have MAC OS Yosemite, the ndk 10 and I have modified the Android.mk to have

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

include $(CLEAR_VARS)

LOCAL_MODULE    := osgNativeLib
### Main Install dir
OSG_ANDROID_DIR	:= /Users/lonnibesancon/Desktop/OpenSceneGraph-3.2.2-rc2/examples/osgAndroidExampleGLES1
LIBDIR 			:= $(OSG_ANDROID_DIR)/obj/local/armeabi

FRAMEWORK = -framework GLUT
FRAMEWORK += -framework OpenGL 

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:= /Users/lonnibesancon/Desktop/OpenSceneGraph-3.2.2-rc2/buildandroid/include
LOCAL_CFLAGS    := -Werror -fno-short-enums
LOCAL_CPPFLAGS  := -DOSG_LIBRARY_STATIC 

LOCAL_LDLIBS    := -llog -lGLESv1_CM -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)


.

Finally, this is the command I'm using:


> ~/Desktop/OpenSceneGraph-3.2.2-rc2/examples/osgAndroidExampleGLES1$ ../../../../android-ndk-r10e/ndk-build


Hope my questions is not dumb and you can help me out.

Thanks in advance anyway;

Cheers,
Lonni

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








More information about the osg-users mailing list