Port Ogre to Android?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Port Ogre to Android?

Post by Assaf Raman »

Look here: Android NDK add stlport and compile C++ program.

BTW: OGRE does support compiling with stlport.
Watch out for my OGRE related tweets here.
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

But STLport supports full exceptions stuff? why don't we use STLport with the official NDK and compile ogre with it?
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Port Ogre to Android?

Post by Assaf Raman »

I think that the compiler that comes with Android doesn't support exceptions.
I am not an expert.
Watch out for my OGRE related tweets here.
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

Well, then I'll try to compile STLport with my compiled compiler. It should work the same way. But we could try to see if we can use the regular android compiler and use STLport for exceptions. Probably not since there are some flags unset etc.
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Port Ogre to Android?

Post by Assaf Raman »

exceptions are part of the compiler and not the STL as far as I know...
Watch out for my OGRE related tweets here.
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

http://android.git.kernel.org/?p=platfo ... 34;hb=HEAD :)
When I get the libstdc++ compiled I'm gonna try compiling hello-jni (since that uses libstdc++ anyway) and if that works in the emulator I'm going to compile the gl es lib + the san angeles demo app.
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Port Ogre to Android?

Post by Assaf Raman »

I am not sure if exceptions are an OS feature or a compiler feature... what do you think?
Watch out for my OGRE related tweets here.
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

I think compiler feature and libsupc++ feature, but:
Image
:D
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Port Ogre to Android?

Post by Assaf Raman »

I am not sure - possibly the code in the compiler assumes that some OS interrupt exist...
Watch out for my OGRE related tweets here.
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

Yes, they say the Dalvik VM (the exe runner for Android) should support it too. Online they say that you could use the Dalvik VM to execute the JNI function ThrowNew which causes a java exception to occur. So that a real exception is caused in the application. Dunno if this works that way though.
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
liberator
Greenskin
Posts: 117
Joined: Mon Jan 24, 2005 2:27 pm
Location: Sillicon Valley, California

Re: Port Ogre to Android?

Post by liberator »

calsmurf2904 wrote:Yes, they say the Dalvik VM (the exe runner for Android) should support it too. Online they say that you could use the Dalvik VM to execute the JNI function ThrowNew which causes a java exception to occur. So that a real exception is caused in the application. Dunno if this works that way though.
C++ exceptions should not cross over into the Java realm so it does not matter whether the DalvikVM supports exceptions for compiling/running native C++ exception enable code. Any exception should be caught within the native module and not allowed to go beyond it. So I am confused as to why java exceptions have anything to do with this nor DalvikVM features?
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

Well, the application normally allows java exceptions which cause the app to exit. When linking with C++ Native code you need the C runtime to be able to stop the app too when an uncaught exception is found. This could be done by just making the exception implementation in the C runtime call the java exception implementation so that the java runtime quits.
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
liberator
Greenskin
Posts: 117
Joined: Mon Jan 24, 2005 2:27 pm
Location: Sillicon Valley, California

Re: Port Ogre to Android?

Post by liberator »

Translating the exception from native to Java is one way to go but I myself would choose to go with return values at the native/java boundary which would eliminate the need to do any exception translation work and reliance on Dalvik's exceptions. Either case,.. I guess that's an application development choice which can be made independent of the question of how to get a native Ogre onto Android.
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

True, this would mean we won't need to change anything in the OS itself. Only at the application-side. (libc etc.). Which I already done (I already compiled newlib, so that stands in for libc and libm and I compiled libstdc++ which fills in the exceptions stuff etc). I only need to test it out.
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

I can't seem to be able to compile the hello-jni app since I need to use androids build system, so I need to adapt my toolchain to use their directory and filename structure. I'm gonna do it in the weekend so that I can finally test it out :)
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3

Re: Port Ogre to Android?

Post by Praetor »

You're making some amazing progress. Thanks for pushing ahead. When I ran into the C++ wall I gave up. Thanks for having more courage than me.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
ethan
Gnoblar
Posts: 6
Joined: Tue Feb 26, 2008 5:19 pm
Location: Nice (France)

Re: Port Ogre to Android?

Post by ethan »

Hey,
I just discovered this topic. I want you to know I fully support you. I would be very glad to have ogre ported to android.
They did this for the iPhone, so we should have it too!
I can offer my help, but if I don't have specific knowledge in this area. Nevertheless I would be very glad to contribute.
I am closely following this thread now. Thanks and keep going with the good work :)
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

ethan wrote:Hey,
I just discovered this topic. I want you to know I fully support you. I would be very glad to have ogre ported to android.
They did this for the iPhone, so we should have it too!
I can offer my help, but if I don't have specific knowledge in this area. Nevertheless I would be very glad to contribute.
I am closely following this thread now. Thanks and keep going with the good work :)
Praetor wrote:You're making some amazing progress. Thanks for pushing ahead. When I ran into the C++ wall I gave up. Thanks for having more courage than me.
Thanks! Now it would suck if the compiler generated executables won't run lol.
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

calsmurf2904 wrote:
ethan wrote:Hey,
I just discovered this topic. I want you to know I fully support you. I would be very glad to have ogre ported to android.
They did this for the iPhone, so we should have it too!
I can offer my help, but if I don't have specific knowledge in this area. Nevertheless I would be very glad to contribute.
I am closely following this thread now. Thanks and keep going with the good work :)
Praetor wrote:You're making some amazing progress. Thanks for pushing ahead. When I ran into the C++ wall I gave up. Thanks for having more courage than me.
Thanks! Now it would suck if the compiler generated executables won't run lol.
or when this happens:

Code: Select all

$ make APP=hello-jni
Android NDK: Building for application 'hello-jni'
Compile thumb  : hello-jni <= apps/hello-jni/project/jni/hello-jni.c
Assembler messages:
Fatal error: Invalid -march= option: `armv5te'
make: *** [out/apps/hello-jni//objs/hello-jni/hello-jni.o] Error 1
That define is in the makefiles of the android system, so it has to be something essential (march? architecture?), which would suck even more since that could be that the compiled compiler is compiled for a wrong target.
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
SomeFusion
Gremlin
Posts: 191
Joined: Sun Dec 01, 2002 12:38 am
x 3

Re: Port Ogre to Android?

Post by SomeFusion »

If somebody is going to attend GDC this year you might attend the Android lessons there. Google is also giving away free phones to attendees:

http://android-developers.blogspot.com/ ... opers.html
Summoning Wars is an open source role-playing game, featuring both a single-player and a multiplayer mode for about 2 to 8 players.
http://www.sumwars.org
User avatar
liberator
Greenskin
Posts: 117
Joined: Mon Jan 24, 2005 2:27 pm
Location: Sillicon Valley, California

Re: Port Ogre to Android?

Post by liberator »

SomeFusion wrote:If somebody is going to attend GDC this year you might attend the Android lessons there. Google is also giving away free phones to attendees:

http://android-developers.blogspot.com/ ... opers.html
Its next-door for me,.. but I'm not going,.. have you seen the price of the passes??? OMG 1400$ for all access.
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

SomeFusion wrote:If somebody is going to attend GDC this year you might attend the Android lessons there. Google is also giving away free phones to attendees:

http://android-developers.blogspot.com/ ... opers.html
A-side when the part where its about 1400km away from me :P its too expensive for me too :(
Anyway, I've been on a small vacation so I haven't worked on this much, resting now, gonna work on it starting tomorrow.
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
User avatar
liberator
Greenskin
Posts: 117
Joined: Mon Jan 24, 2005 2:27 pm
Location: Sillicon Valley, California

Re: Port Ogre to Android?

Post by liberator »

Any news?
I'm eagerly awaiting the outcome of your experiment :)
User avatar
calsmurf2904
Orc
Posts: 401
Joined: Tue Sep 16, 2008 9:39 pm
Location: Netherlands

Re: Port Ogre to Android?

Post by calsmurf2904 »

Sorry :( Some private stuff happened, I'll be on it soon. I would probably have to recompile the compiler (I keep thinking that sentence sounds a bit ironic? :P like who was there first? the chicken or the egg) with some good settings. (Mainly the thumb-interwork stuff, which I didn't add a flag for :/)
Visit my blog at http://calsmurf2904.wordpress.com !
Got a Google Wave account? Add me as contact! (projectxgame <at> gmail <dot> com)
Image
fredguinog
Gnoblar
Posts: 5
Joined: Tue Feb 02, 2010 3:51 am

Re: Port Ogre to Android?

Post by fredguinog »

Hi Guys,

Since I'm also interested creating games using Ogre in Android device, I was taking a look at this thread and by luck I noticed a link to a post in google's forum about ndk which may be interesting for you.

http://groups.google.com/group/android- ... ed1fbf6450

I'll just copy what Dimitry wrote there:

"Hi all,
I've built my own version of android ndk which support full C++
standard library (including STL), exceptions and RTTI. I did it using
official ndk build scripts and sources, just little patched them.
Actually I was wonder how easy it was. I've used exceptions in massive
piece of code which I have now ported to android (libstdc++ linked
statically) and seems all works fine.
Only linux and darwin variants ready for now -
http://www.crystax.net/data/android-ndk ... ax.tar.bz2,
http://www.crystax.net/data/android-ndk ... rystax.tar....
Diff I've created to build customized ndk -
http://www.crystax.net/data/android-ndk ... ystax.diff.
Hope it would help to you guys :) "

And:
"Hi,
Just want to inform that windows build is also done - http://www.crystax.net/data/android-ndk ... rystax.zip
Dmitry Moskalchuk "

I hope it helps. Cheers,

Fred