NDK compilation phases

240 views
Skip to first unread message

Jota

unread,
Dec 15, 2010, 10:22:16 AM12/15/10
to android-ndk
Hi everyone,

Something came up when i was compiling my c/c++ libraries.

The thing was: when I was including some libraries in c++ that have
"dynamic_cast" to my project, I had the obvious problems regarding the
-fno-rtti g++ flag. So in order to solve it, I removed the flag. Then
I made "ndk-build clean" the the compilation went well until the
linkage stage that had some problems with my JNI file.

So in a miraculous step, or absurd one, I include the -fno-rtti flag,
then nkd-build clean and once more ndk-build. Then i get the expected
error wen compiling the "dynamic_cast". So once again I remove the -
fno-rtti flag and make ndk-build with NO previous clean. And the
compilation went well.

I was suspicious, so i made the same steps all over again:

1ª - remove no-rtti -> clean -> compile -> linkagem error -> FAIL

and then 2º - include no-rtti -> ndk-build clean -> compile ->
dynamic_problem -> remove no-rtti -> compile (with NO clean) -> DONE
with no errors

Can some one explain why this happens, I can't understand it, and
can't really in libraries compiled in this way. I also thing that have
something to do with the ndk compilation phases

David Turner

unread,
Dec 15, 2010, 12:46:02 PM12/15/10
to andro...@googlegroups.com
You need to link to libsupc++ if you enable rtti: LOCAL_LDLIBS += -lsupc++
You don't have to remove the -fno-rtti flag, just add -frtti to your LOCAL_CFLAGS

NOTE: If you use the gnustl_static STL implementation, there is no need to link to libsupc++ (it is automatically linked for you).


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


João

unread,
Dec 28, 2010, 1:06:20 PM12/28/10
to android-ndk
Thanks David for the help, the solution presented by you was very
helpfull in the compilation phase.


But something came up, I still have problems regarding my libraries
compilation, i mean linckage phase..
In some situations that can be solved by removing the "virtual"
declaration of functions, but that not seams to be the best solution
in my point of view.

Other thing regards the information that I read (googleing the rtti
and ndk), does the ndk have support for rtti?


Thanks for all the help

João
> > android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>
> > .
Reply all
Reply to author
Forward
0 new messages