Android build quick start guide

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

Android build quick start guide

Post by Wolfmanfx » Sun Sep 09, 2012 11:08 pm

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.
0 x

qwertzui11
Halfling
Posts: 78
Joined: Wed May 14, 2008 10:44 am
Location: EU
Contact:

Re: Android build quick start guide

Post by qwertzui11 » Sun Sep 09, 2012 11:17 pm

thx 4 the great work!
0 x

Ologon
Halfling
Posts: 70
Joined: Sun Dec 02, 2007 11:10 am
Location: Italy

Re: Android build quick start guide

Post by Ologon » Wed Sep 12, 2012 9:19 pm

Thanks for the great work :D
0 x

User avatar
Thoran
Halfling
Posts: 94
Joined: Mon Dec 01, 2008 2:04 pm
Location: Germany
Contact:

Re: Android build quick start guide

Post by Thoran » Thu Sep 13, 2012 3:32 pm

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
0 x

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

Re: Android build quick start guide

Post by saishani » Sun Sep 16, 2012 9:34 am

Thanks for the great work !!!
0 x

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

Re: Android build quick start guide

Post by saishani » Wed Sep 19, 2012 1:01 pm

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!
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Thu Sep 20, 2012 11:19 pm

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.
0 x

slythfox
Gnoblar
Posts: 2
Joined: Thu Sep 27, 2012 6:36 pm

Re: Android build quick start guide

Post by slythfox » Thu Sep 27, 2012 6:42 pm

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.
0 x

NazguL
Kobold
Posts: 33
Joined: Tue Mar 09, 2010 2:17 am

Re: Android build quick start guide

Post by NazguL » Fri Sep 28, 2012 7:19 pm

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
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Fri Sep 28, 2012 7:50 pm

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.
0 x

NazguL
Kobold
Posts: 33
Joined: Tue Mar 09, 2010 2:17 am

Re: Android build quick start guide

Post by NazguL » Fri Sep 28, 2012 10:35 pm

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.
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Sat Sep 29, 2012 7:11 am

No default branch is wrong you have to use 1.9
0 x

NazguL
Kobold
Posts: 33
Joined: Tue Mar 09, 2010 2:17 am

Re: Android build quick start guide

Post by NazguL » Mon Oct 01, 2012 4:53 pm

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?
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Mon Oct 01, 2012 5:17 pm

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 :)
0 x

NazguL
Kobold
Posts: 33
Joined: Tue Mar 09, 2010 2:17 am

Re: Android build quick start guide

Post by NazguL » Mon Oct 01, 2012 7:44 pm

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?
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Mon Oct 01, 2012 7:56 pm

yeah a few are not functional but i am working on that - but atm i am working on the gles 1 rendersystem
0 x

MexWi
Gnoblar
Posts: 2
Joined: Tue Oct 09, 2012 9:51 am

Re: Android build quick start guide

Post by MexWi » Tue Oct 09, 2012 10:11 am

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
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Tue Oct 09, 2012 2:01 pm

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)
0 x

MexWi
Gnoblar
Posts: 2
Joined: Tue Oct 09, 2012 9:51 am

Re: Android build quick start guide

Post by MexWi » Thu Oct 11, 2012 8:30 am

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?
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Thu Oct 11, 2012 8:46 am

No you do not need use rtss
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Thu Oct 11, 2012 9:00 am

And also you could use the gles1 RS i updated it for use with android.
0 x

User avatar
gabrielf
Gnoblar
Posts: 2
Joined: Thu Oct 11, 2012 4:59 pm

Re: Android build quick start guide

Post by gabrielf » Thu Oct 11, 2012 5:17 pm

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
0 x

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

Re: Android build quick start guide

Post by Wolfmanfx » Thu Oct 11, 2012 8:21 pm

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.
0 x

User avatar
gabrielf
Gnoblar
Posts: 2
Joined: Thu Oct 11, 2012 4:59 pm

Re: Android build quick start guide

Post by gabrielf » Thu Oct 11, 2012 9:16 pm

ok.. I forced OGRE_STATIC TRUE.... its building now... for some reason its going dynamic...
0 x

DDD Michel
Gnoblar
Posts: 1
Joined: Tue Oct 16, 2012 4:09 pm

Re: Android build quick start guide

Post by DDD Michel » Tue Oct 16, 2012 4:19 pm

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
0 x

Post Reply