Android build quick start guide

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Android build quick start guide

Post by Wolfmanfx »

I added a quick start guide for android -> http://www.ogre3d.org/tikiwiki/tiki-ind ... on=Android
Also i updated the dependencies -> http://sourceforge.net/projects/ogre/fi ... ndroid/1.9

Plz use ndk 0.8 and not 0.8b there is bug inside the google toolchain which prevents linking with freeimage.
qwertzui11
Halfling
Posts: 80
Joined: Wed May 14, 2008 10:44 am
Location: EU
x 22

Re: Android build quick start guide

Post by qwertzui11 »

thx 4 the great work!
Ologon
Halfling
Posts: 70
Joined: Sun Dec 02, 2007 11:10 am
Location: Italy
x 2

Re: Android build quick start guide

Post by Ologon »

Thanks for the great work :D
User avatar
Thoran
Halfling
Posts: 94
Joined: Mon Dec 01, 2008 2:04 pm
Location: Germany
x 1

Re: Android build quick start guide

Post by Thoran »

Thanks wolfmanfx. This is greatly anticipated and highly appreciated by me. I am eager to give it a go. Alas I only need to root my Android device now, to be able to use a CyanogenMod version taht includes Android 2.3.x. Keep up the excellent work.

Thoran
saishani
Gnoblar
Posts: 2
Joined: Wed Aug 29, 2012 12:59 pm

Re: Android build quick start guide

Post by saishani »

Thanks for the great work !!!
saishani
Gnoblar
Posts: 2
Joined: Wed Aug 29, 2012 12:59 pm

Re: Android build quick start guide

Post by saishani »

Hi Wolfmanfx , Thanks for your great work!
I'm new to android.I just only developed ogre applications with vs.
if I want to hook an ogre project to an android project, how can this be done in eclipse?
How could I set up a new application and use the ogre libs ? I hope to get your reply,thanks!
Thanks very much!
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

I have build, tested and fixed the ogre sample browser build on linux - have to update the guide to reflect the needed steps to get it working.
slythfox
Gnoblar
Posts: 2
Joined: Thu Sep 27, 2012 6:36 pm
x 1

Re: Android build quick start guide

Post by slythfox »

I went down the rabbit hole of trying to use android.toolchain.cmake from Android CMake (which OpenCV for Android uses). Don't do that. Use the one provided in CMake/toolchain/ of the 1.9 repo.
NazguL
Kobold
Posts: 33
Joined: Tue Mar 09, 2010 2:17 am

Re: Android build quick start guide

Post by NazguL »

Hello,
I am following this guide but encountered a problem while linking libOgreMain.so:

Linking CXX shared library ../lib/libOgreMain.so
CMakeFiles/OgreMain.dir/src/OgrePlatformInformation.cpp.o: In function `Ogre::PlatformInformation::getCpuFeatures()':
OgrePlatformInformation.cpp:(.text._ZN4Ogre19PlatformInformation14getCpuFeaturesEv+0x30): undefined reference to `android_getCpuFeatures'
CMakeFiles/OgreMain.dir/src/OgrePlatformInformation.cpp.o: In function `Ogre::PlatformInformation::getCpuIdentifier()':
OgrePlatformInformation.cpp:(.text._ZN4Ogre19PlatformInformation16getCpuIdentifierEv+0x50): undefined reference to `android_getCpuFamily'
OgrePlatformInformation.cpp:(.text._ZN4Ogre19PlatformInformation16getCpuIdentifierEv+0x9c): undefined reference to `android_getCpuFeatures'
CMakeFiles/OgreMain.dir/src/Android/OgreAndroidLogListener.cpp.o: In function `Ogre::AndroidLogListener::messageLogged(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Ogre::LogMessageLevel, bool, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool&)':
/home/ogre/ogre_src_mercurial/ogre/OgreMain/src/Android/OgreAndroidLogListener.cpp:21: undefined reference to `__android_log_print'
/home/ogre/ogre_src_mercurial/ogre/OgreMain/src/Android/OgreAndroidLogListener.cpp:17: undefined reference to `__android_log_print'
collect2: ld returned 1 exit status
make[2]: *** [lib/libOgreMain.so.2.1.0] Error 1
make[1]: *** [OgreMain/CMakeFiles/OgreMain.dir/all] Error 2
make: *** [all] Error 2


Does anyone have encountered this?
the android_getCpuFeatures, android_getCpuFamily should be part of libcpufeatures but it isn't pre-built from the NDK, do I have to build it myself first?

Thanks
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

Mmm you are not using my guide or you use the wrong branch - why? My scripts force static linking and build automaticly the cpufeatures as static lib.
NazguL
Kobold
Posts: 33
Joined: Tue Mar 09, 2010 2:17 am

Re: Android build quick start guide

Post by NazguL »

I am using the Ogre sources from the repository and I'm on the default branch, is this the correct one to build Android?
I didn't find any details regarding the branch on this guide I'm following: http://www.ogre3d.org/tikiwiki/tiki-ind ... on=Android

v1-9 3885:07dfd1a35d56
v2-0 3864:dac6bfcd3327
default 3749:2aea1c30ffa5
v1-7 3343:72308319f630
v1-6 1697:ad6be123a04c
v1-8 3879:bcf6d0883047 (inactive)


Then I'm using the dependencies already built from here http://sourceforge.net/projects/ogre/fi ... p/download
I'm then targeting a newer Android SDK, 14 instead of 9, but I figured that shouldn't affect the cpufeatures issue I'm facing.
I'm building on Ubuntu and launching the cmake in this way:

cmake -DCMAKE_TOOLCHAIN_FILE=../CMake/toolchain/android.toolchain.cmake -DOGRE_DEPENDENCIES_DIR=../AndroidDependencies/ -DANDROID_NATIVE_API_LEVEL=14 ..

I'm not specifying the -G"NMake Makefiles" option though, since I thought it was for the VisualStudio/Win version.
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

No default branch is wrong you have to use 1.9
NazguL
Kobold
Posts: 33
Joined: Tue Mar 09, 2010 2:17 am

Re: Android build quick start guide

Post by NazguL »

Thanks that made it build successfully! :)
However textures of the samplebrowser don't get rendered correctly, I assume it's because at the cmake stage it doesn't find the FreeImage dependency.
I am using your pack of pre-built dependencies, and seems to work fine for all the others like:
+ zlib
+ zziplib
+ freetype
+ OpenGL ES 1.x
+ OpenGL ES 2.x
+ OIS

but not for FreeImage, do you think the texture rendering problem I'm facing might be due to that?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

Yes thats missing freeimage codec - just delete build folder and execute the cmake command (which is in the wiki) again and everything should be done :)
NazguL
Kobold
Posts: 33
Joined: Tue Mar 09, 2010 2:17 am

Re: Android build quick start guide

Post by NazguL »

I actually had to rename libFreeImage.a to libfreeimage.a because I've seen that FindFreeImage.cmake was looking for the library in lower case. (Or could have modified the cmake file)
I've noticed that some of the demos don't run and segfault on libOgreSampleBrowser.so, are they using some features not ported yet on the Android version?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

yeah a few are not functional but i am working on that - but atm i am working on the gles 1 rendersystem
MexWi
Gnoblar
Posts: 2
Joined: Tue Oct 09, 2012 9:51 am

Re: Android build quick start guide

Post by MexWi »

Hi, I can run the sample successfully, then I create android project with ogre,I use static lib libOgreMainStatic.a libRenderSystem_GLES2Static.a and libOgreOverlayStatic.a only,then my application show "Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)" when mRoot->renderOneFrame(); after overlay->show(). I can't solve, please help me
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

You have to use the OverlayComponent -> OverlaySystem.h look at the SampleBrowser how its done (You have to register it on your SceneManager otherwise it wont render)
MexWi
Gnoblar
Posts: 2
Joined: Tue Oct 09, 2012 9:51 am

Re: Android build quick start guide

Post by MexWi »

Thank you! I use RTSS in my project ,then it's ok .now I can show overlay and 3D mesh. so I can ask that RTSS is essential for Android Ogre?
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

No you do not need use rtss
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

And also you could use the gles1 RS i updated it for use with android.
User avatar
gabrielf
Gnoblar
Posts: 2
Joined: Thu Oct 11, 2012 4:59 pm

Re: Android build quick start guide

Post by gabrielf »

Hi,

I've been trying to compile..(Ogre 1-9, and with the dependecies, Ubuntu x64) but I got the libfreetype link error during make:
(I use android-ndk-r8)

Linking CXX shared library ../lib/libOgreMain.so
../../Dependencies/lib/libfreetype.a: could not read symbols: File format not recognized
collect2: ld returned 1 exit status
make[2]: *** [lib/libOgreMain.so.2.1.0] Error 1
make[1]: *** [OgreMain/CMakeFiles/OgreMain.dir/all] Error 2
make: *** [all] Error 2

And I keep getting this warning everywhere:
cc1plus: warning: unrecognized command line option "-Wno-unused-but-set-parameter"

there was also a asset-manager.h issue... where he couldn't find the file... but I put the complete path in the #include... and it passed..

Any tips?

Best Regards,
Gabriel
User avatar
Wolfmanfx
OGRE Team Member
OGRE Team Member
Posts: 1525
Joined: Fri Feb 03, 2006 10:37 pm
Location: Austria - Leoben
x 99

Re: Android build quick start guide

Post by Wolfmanfx »

yes something is wrong on android cmake should only create static libs no so files. clean the build the dir and try the guide again.
User avatar
gabrielf
Gnoblar
Posts: 2
Joined: Thu Oct 11, 2012 4:59 pm

Re: Android build quick start guide

Post by gabrielf »

ok.. I forced OGRE_STATIC TRUE.... its building now... for some reason its going dynamic...
DDD Michel
Gnoblar
Posts: 1
Joined: Tue Oct 16, 2012 4:09 pm
x 1

Re: Android build quick start guide

Post by DDD Michel »

Great work, Wolfmanx!

I am a long time Android developer and I have also been a long time user of cmake and mercurial, so I love to see that this project puts all three together.

However, I must admit to be lost as to how you pull everything in an Android project. I have just started digging but would like a few pointers:
  • What is a simple way to start a new project?
  • How to use eclipse to do all but creating the static Ogre libraries?
  • How can I still have a java project and an Ogre controlled view?
I could make more questions, but they can all come back to the three above.

Thanks