Can C++ STL and other C++ components be used in NDK?

943 views
Skip to first unread message

Hendy

unread,
Mar 8, 2010, 4:45:36 AM3/8/10
to android-ndk
I have read about the NDK docs/STABLE-APIS.TXT and it is said that "An
*extremely* minimal C++ support API is available".

And I have written some code for testing. I found that even some basic
C++ features are not support such as std::cout. Not even std::string
or STL.

But I find an article that gives a C++ sample code, in which std::cout
is used. It seems that it can run in emulator. Please refer
http://www.anddev.org/native_c_-und-quothello_world-und-quot_working_in_emulator-t61.html

The code is built with toolchain and with the -static option. It
sounds reasonable that link the static libraries that ndk doesn't
provided.

I want to know:
1. why NDK only supports that extremely minimal C++?
2. is the way mentioned above practicable? need to built with
toolchain? since headers and libraries not provided by NDK build
system.
3. is it possible that copy some header files to the include path for
use? since most template classes only have header files

anybody can explain something for me? thanks :-)

and i will also make some experiments. if any result, i will share
with you.

Hendy

unread,
Mar 8, 2010, 4:55:40 AM3/8/10
to android-ndk
Ah, sorry, I will try uSTL and STLPort first. As I read anthoer post
in this group and It reminds me the NDK docs recommend to do so.

It will be appricated that any comments added :-)

On 3月8日, 下午5时45分, Hendy <hendy...@gmail.com> wrote:
> I have read about the NDK docs/STABLE-APIS.TXT and it is said that "An
> *extremely* minimal C++ support API is available".
>
> And I have written some code for testing. I found that even some basic
> C++ features are not support such as std::cout. Not even std::string
> or STL.
>
> But I find an article that gives a C++ sample code, in which std::cout

> is used. It seems that it can run in emulator. Please referhttp://www.anddev.org/native_c_-und-quothello_world-und-quot_working_...

Dmitry Moskalchuk

unread,
Mar 8, 2010, 7:46:37 AM3/8/10
to andro...@googlegroups.com
Hi,

I've rebuilt Android NDK 1.6 with minimal changes and have enabled
full C++ support (STL, exceptions, RTTI). C++ library links statically
to application. I've ported my engine with active usage of exceptions,
templates and STL to android and it works fine. Also, as I know, guys
from Ogre3D project (http://www.ogre3d.org/) using my custom
distribution to port theirs engine to android.
See http://www.crystax.net/androidndk.php for details. You can
download my custom builds or build own version following instructions
I've provided there.


Dmitry Moskalchuk

08.03.2010, в 12:55, Hendy написал(а):

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

Hendy

unread,
Mar 9, 2010, 6:10:00 AM3/9/10
to android-ndk
Thanks a lot. I am trying...

On 3月8日, 下午8时46分, Dmitry Moskalchuk <crys...@gmail.com> wrote:
> Hi,
>
> I've rebuilt Android NDK 1.6 with minimal changes and have enabled
> full C++ support (STL, exceptions, RTTI). C++ library links statically
> to application. I've ported my engine with active usage of exceptions,
> templates and STL to android and it works fine. Also, as I know, guys
> from Ogre3D project (http://www.ogre3d.org/) using my custom
> distribution to port theirs engine to android.

> Seehttp://www.crystax.net/androidndk.phpfor details. You can

> > .- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Hendy

unread,
Mar 10, 2010, 7:41:33 AM3/10/10
to android-ndk
Very simple and very powerful, strongly recommended!

Thank you very much :-)

On 3月8日, 下午8时46分, Dmitry Moskalchuk <crys...@gmail.com> wrote:

> Hi,
>
> I've rebuilt Android NDK 1.6 with minimal changes and have enabled
> full C++ support (STL, exceptions, RTTI). C++ library links statically
> to application. I've ported my engine with active usage of exceptions,
> templates and STL to android and it works fine. Also, as I know, guys
> from Ogre3D project (http://www.ogre3d.org/) using my custom
> distribution to port theirs engine to android.

> Seehttp://www.crystax.net/androidndk.phpfor details. You can

Gregory Ray

unread,
Mar 10, 2010, 12:30:49 PM3/10/10
to andro...@googlegroups.com
Dmitry,

Is your custom distribution based on John Ripley NDK Wrapper scripts?

2010/3/8 Dmitry Moskalchuk <cry...@gmail.com>



--
Gregory Ray
COO, Seek Mobile Interactive, Inc.

---

This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential and protected by law from unauthorized disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

Dmitry Moskalchuk

unread,
Mar 10, 2010, 12:47:42 PM3/10/10
to andro...@googlegroups.com
No, it's exclusively my work. Actually I was started doing that after discussion with Martins Mozeiko (http://groups.google.com/group/android-ndk/msg/833130aaf0a3cd7e). That was good point to know that somebody have it done. So I've started investigation and, after number of iterations, got it fully working.


Dmitry Moskalchuk

10.03.2010, в 20:30, Gregory Ray написал(а):

Gregory Ray

unread,
Mar 10, 2010, 1:12:53 PM3/10/10
to andro...@googlegroups.com
Have you created an app using this process and tested it on the android market?

Dmitry Moskalchuk

unread,
Mar 10, 2010, 1:22:11 PM3/10/10
to andro...@googlegroups.com
Yes, I've ported my engine (~50 KLoc) to android. There is active usage of exceptions, templates and rtti. But I have not yet finished my application (which use that engine) so it's not on the android market yet).

Dmitry Moskalchuk

10.03.2010, в 21:12, Gregory Ray написал(а):

Gregory Ray

unread,
Mar 10, 2010, 1:28:32 PM3/10/10
to andro...@googlegroups.com
I guess what I am wondering is, your local dev environment is compiled with stl support on, but will out-of-the-box phones have that support enabled by default? I'm just trying to understand how this is working because it seems allot better than the stlport solution but I don't grasp how the stl libraries are packaged in a manner that can be distributed.

2010/3/10 Dmitry Moskalchuk <cry...@gmail.com>

Dmitry Moskalchuk

unread,
Mar 10, 2010, 1:41:58 PM3/10/10
to andro...@googlegroups.com
It's very simple - libstdc++ links statically. Therefore it does not need any runtime support from android system but existing. The only drawback is bit bigger size of final binary. But that's not problem for me - instead I have the same code compiling well on Linux, Mac OS X, iPhone and Android.


Dmitry Moskalchuk

10.03.2010, в 21:28, Gregory Ray написал(а):

Gregory Ray

unread,
Mar 10, 2010, 1:51:28 PM3/10/10
to andro...@googlegroups.com
So the apk that is created includes the libstdc++ static library? There's nothing wrong with that, the stlport has to be included as well. Does that all happen by just setting -enable-libstc__-v3, seems like you would need at minimum to modify your Android.mk and include the static library in your libs folder.

2010/3/10 Dmitry Moskalchuk <cry...@gmail.com>

Dmitry Moskalchuk

unread,
Mar 10, 2010, 2:04:40 PM3/10/10
to andro...@googlegroups.com
Setting --enable-libstdc__-v3 I've just informing build system that I need to build libstdc++ and libsupc++ from GCC. Then android version of libstdc++ replaced by GCC's one (see my patch, there are lines doing that). GCC already support ARM platform and do it well so the only reason to throw away it's libstdc++ and replace by own (as it was done by android team) is size of final binary.

Dmitry Moskalchuk

10.03.2010, в 21:51, Gregory Ray написал(а):

Gregory Ray

unread,
Mar 10, 2010, 2:28:00 PM3/10/10
to andro...@googlegroups.com
I will try out your solution. I am extremely skeptical the framework team threw out stl support only because of binary size, that seems irrational to me seeing how standard stl is. I'd love feedback from Fadden or Dianne on this.

Dmitry Moskalchuk

unread,
Mar 10, 2010, 2:39:13 PM3/10/10
to andro...@googlegroups.com
Yes, it was hard to believe to me too. But note that there is internal development policy in google - they don't use stl and exceptions. Therefore it just a dead weight for them. See also my discussion with David Turner - http://groups.google.com/group/android-ndk/browse_thread/thread/89db67ed1fbf6450/4de3dd6105eb26ce?#4de3dd6105eb26ce

Dmitry Moskalchuk

10.03.2010, в 22:28, Gregory Ray написал(а):

David Turner

unread,
Mar 10, 2010, 2:56:56 PM3/10/10
to andro...@googlegroups.com
I confirm that the Android framework has been specifically designed to not need any STL / C++ exceptions / RTTI.

This was a deliberate decision at the time the platform was first designed, because the available compiler and STL implementations at the time were very poor
and generated humongous code that ran very poorly on the puny ARM CPUs of the time. And all of this has been benchmarked a long time ago and I don't have
numbers to share.

As an example, Android provides its own C++ container templates that have been designed differently from the STL ones in order to avoid auto-generated code
explosion each time you need a new vector or map type. Having strings that don't provide iterators also allows to safely implement shared copy-on-write semantics.

The issues are complex, and frankly I think the right choice was made.

That's not to say we don't want to allow you to use these things in your own code, only that we will only provide official support for it once we're sure this is
not going to break the ABI or something in the future (e.g. when we switch from GCC 4.4.0 to 4.6.0 or something else).

2010/3/10 Gregory Ray <gr...@seekmobileinteractive.com>

David Turner

unread,
Mar 10, 2010, 2:57:35 PM3/10/10
to andro...@googlegroups.com
The Google coding conventions do not apply to the Android codebase. Different decisions by different engineers.

Dmitry Moskalchuk

unread,
Mar 10, 2010, 3:01:11 PM3/10/10
to Dmitry Moskalchuk, andro...@googlegroups.com
More info:

Download http://android.git.kernel.org/pub/android-ndk-toolchain-20090323.tar.bz2 (it is official sources used to build android NDK 1.6_r1), unpack it and read README - there is section about this parameter (--enable-libstdc__-v3). It is explanation from Google.


Dmitry Moskalchuk

10.03.2010, в 22:39, Dmitry Moskalchuk написал(а):

Dmitry Moskalchuk

unread,
Mar 10, 2010, 3:03:06 PM3/10/10
to andro...@googlegroups.com
Thanks, David, good to know.

Dmitry Moskalchuk

10.03.2010, в 22:57, David Turner написал(а):

Gregory Ray

unread,
Mar 10, 2010, 3:03:21 PM3/10/10
to andro...@googlegroups.com
David,

In your opinion, does using the stlport seem like an extra step vs using Dmitry's method of rebuilding the tool chain with --enable-libstdc__-v3? Also I love this kind of transparency, its not very often a system architect will hop on a forum and explain a design decision, I'm sure I speak for everybody that it is really appreciated.

Thanks

David Turner

unread,
Mar 10, 2010, 3:10:32 PM3/10/10
to andro...@googlegroups.com
I would love to provide choice for NDK developers in the future regarding STL support.
Ideally, you could have a macro like APP_CPP_STL that would indicate which STL you would like to link your application to, with possible values like:

gnu - for the GNU libstdc++
stlport - for STLPort
utsl - for uSTL

Mainly because the GNU libstdc++ is really *huge* when linked statically, stlport is noticeably smaller, while ustl is perfect for people who need minimal code size (though it is not fully compliant).
And because all details would be handled by the NDK, you would not have to hack your sysroot and system headers anyway.

That's the plan. It is very likely that the first NDK release that supports this new macro will only support the "gnu" value, with more to come later though.
And the result is likely to be very similar to Dmitry's patches (without the sysroot hacking).

Gregory Ray

unread,
Mar 10, 2010, 3:19:34 PM3/10/10
to andro...@googlegroups.com
David,

You are awesome.

That is all.

Thanks,
Greg

2010/3/10 David Turner <di...@android.com>

Martins Mozeiko

unread,
Mar 11, 2010, 7:29:57 AM3/11/10
to andro...@googlegroups.com
Hi, Gregory.

Yes, out-of-the-box phones will run applications that use STL or RTTI just fine. I myself have compiled & run LLVM project that uses a lot of stuff from C++ STL library and also uses C++ RTTI functionality (dynamic_cast's). Resulting binary runs fine both on emulator and Android device (G1 phone), it doesn't require any support from OS or device - everything it needs is compiled statically into binary.

--
Martins Mozeiko

Emmanuel

unread,
Mar 11, 2010, 5:07:39 AM3/11/10
to android-ndk
Android patch
in STLport!

Hi,

I see that there is quite some work about Stl for Android. You may
have seen that an Android patch has just been integrated in the
STLport repository:
- the patch:
http://sourceforge.net/tracker/?func=detail&aid=2943782&group_id=146814&atid=766246
- the source in the 5.2 branch:
http://stlport.git.sourceforge.net/git/gitweb.cgi?p=stlport/stlport;a=shortlog;h=refs/heads/STLport-5.2
- the discussion:
http://sourceforge.net/projects/stlport/forums/forum/490892/topic/3393072

That good news! For just Stl support, this can avoid us to need the
customized Ndk (which is tagged as experimental at this time).

The bad new though is that the Android port may not be kept in the
STLport code if nobody takes care of it. Any developer like me can
give some help to compile and run the tests. However, when a problem
occurs (with new Ndk or STLport versions), we may additionally need
some help from people who have some knowledge of STL and/or Android
internals.

Conclusion: at this time Stl support in the Ndk remains a future plan,
so in the meantime, what about joining the STLport developers?

Emmanuel

John Ripley

unread,
Mar 11, 2010, 1:46:51 PM3/11/10
to andro...@googlegroups.com
It would be nice if the changes noted where the original patches came from, which is something I took great pains to ensure I got right. I'm not really fussed about the lack of attribution (seems all too common), but some of the patches originate at Google.

Gregory Ray

unread,
Mar 11, 2010, 1:51:39 PM3/11/10
to andro...@googlegroups.com
John,

I agree with you 100% but according to Dmitry these are not based on the ndkwrapper scripts which surprised me.

-Greg

John Ripley

unread,
Mar 11, 2010, 1:59:51 PM3/11/10
to andro...@googlegroups.com

Gregory Ray

unread,
Mar 11, 2010, 2:05:14 PM3/11/10
to andro...@googlegroups.com
Although I have no association to that check-in or that project, as someone who really appreciates the ndkwrapper scripts, I will try and get in there to make sure the credit goes back the authors this weekend, I think there is some contribution from Pete Cole in there too.

KKK

unread,
Mar 12, 2010, 12:53:27 AM3/12/10
to android-ndk
Any tentative date/month when this version of NDK (with STL) will get
released ? Although there are multiple work-around's provided by
people in this group, waiting for the official NDK support on this.

Thanks and regards,
KKK.

> >> On Wed, Mar 10, 2010 at 11:39 AM, Dmitry Moskalchuk <crys...@gmail.com>wrote:
>
> >>> Yes, it was hard to believe to me too. But note that there is internal
> >>> development policy in google - they don't use stl and exceptions. Therefore
> >>> it just a dead weight for them. See also my discussion with David Turner -

> >>>http://groups.google.com/group/android-ndk/browse_thread/thread/89db6...


>
> >>> Dmitry Moskalchuk
>
> >>> 10.03.2010, в 22:28, Gregory Ray написал(а):
>
> >>> I will try out your solution. I am extremely skeptical the framework team
> >>> threw out stl support only because of binary size, that seems irrational to
> >>> me seeing how standard stl is. I'd love feedback from Fadden or Dianne on
> >>> this.
>

> >>> On Wed, Mar 10, 2010 at 11:04 AM, Dmitry Moskalchuk <crys...@gmail.com>wrote:
>
> >>>> Setting --enable-libstdc__-v3 I've just informing build system that I
> >>>> need to build libstdc++ and libsupc++ from GCC. Then android version of
> >>>> libstdc++ replaced by GCC's one (see my patch, there are lines doing that).
> >>>> GCC already support ARM platform and do it well so the only reason to throw
> >>>> away it's libstdc++ and replace by own (as it was done by android team) is
> >>>> size of final binary.
>
> >>>> Dmitry Moskalchuk
>
> >>>> 10.03.2010, в 21:51, Gregory Ray написал(а):
>
> >>>> So the apk that is created includes the libstdc++ static library?
> >>>> There's nothing wrong with that, the stlport has to be included as well.
> >>>> Does that all happen by just setting -enable-libstc__-v3, seems like you
> >>>> would need at minimum to modify your Android.mk and include the static
> >>>> library in your libs folder.
>

> >>>> 2010/3/10 Dmitry Moskalchuk <crys...@gmail.com>


>
> >>>>> It's very simple - libstdc++ links statically. Therefore it does not
> >>>>> need any runtime support from android system but existing. The only drawback
> >>>>> is bit bigger size of final binary. But that's not problem for me - instead
> >>>>> I have the same code compiling well on Linux, Mac OS X, iPhone and Android.
>
> >>>>> Dmitry Moskalchuk
>
> >>>>> 10.03.2010, в 21:28, Gregory Ray написал(а):
>
> >>>>> I guess what I am wondering is, your local dev environment is compiled
> >>>>> with stl support on, but will out-of-the-box phones have that support
> >>>>> enabled by default? I'm just trying to understand how this is working
> >>>>> because it seems allot better than the stlport solution but I don't grasp
> >>>>> how the stl libraries are packaged in a manner that can be distributed.
>

> >>>>> 2010/3/10 Dmitry Moskalchuk <crys...@gmail.com>


>
> >>>>>> Yes, I've ported my engine (~50 KLoc) to android. There is active
> >>>>>> usage of exceptions, templates and rtti. But I have not yet finished my
> >>>>>> application (which use that engine) so it's not on the android market yet).
>
> >>>>>> Dmitry Moskalchuk
>
> >>>>>> 10.03.2010, в 21:12, Gregory Ray написал(а):
>
> >>>>>> Have you created an app using this process and tested it on the
> >>>>>> android market?
>

> >>>>>> On Wed, Mar 10, 2010 at 9:47 AM, Dmitry Moskalchuk <crys...@gmail.com


> >>>>>> > wrote:
>
> >>>>>>> No, it's exclusively my work. Actually I was started doing that after
> >>>>>>> discussion with Martins Mozeiko (
> >>>>>>>http://groups.google.com/group/android-ndk/msg/833130aaf0a3cd7e).
> >>>>>>> That was good point to know that somebody have it done. So I've started
> >>>>>>> investigation and, after number of iterations, got it fully working.
>
> >>>>>>> Dmitry Moskalchuk
>
> >>>>>>> 10.03.2010, в 20:30, Gregory Ray написал(а):
>
> >>>>>>> Dmitry,
>
> >>>>>>> Is your custom distribution based on John Ripley NDK Wrapper scripts?
>

> >>>>>>> 2010/3/8 Dmitry Moskalchuk <crys...@gmail.com>


>
> >>>>>>>> Hi,
>
> >>>>>>>> I've rebuilt Android NDK 1.6 with minimal changes and have enabled
> >>>>>>>> full C++ support (STL, exceptions, RTTI). C++ library links statically to
> >>>>>>>> application. I've ported my engine with active usage of exceptions,
> >>>>>>>> templates and STL to android and it works fine. Also, as I know, guys from
> >>>>>>>> Ogre3D project (http://www.ogre3d.org/) using my custom
> >>>>>>>> distribution to port theirs engine to android.

> >>>>>>>> Seehttp://www.crystax.net/androidndk.phpfor details. You can

> >>>>>>>>> android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr oups.com>


> >>>>>>>>> .
> >>>>>>>>> For more options, visit this group at
> >>>>>>>>>http://groups.google.com/group/android-ndk?hl=en.
>
> >>>>>>>> --
> >>>>>>>> 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<android-ndk%2Bunsubscribe@googlegr oups.com>


> >>>>>>>> .
> >>>>>>>> For more options, visit this group at
> >>>>>>>>http://groups.google.com/group/android-ndk?hl=en.
>
> >>>>>>> --
> >>>>>>> Gregory Ray
> >>>>>>> COO, Seek Mobile Interactive, Inc.
>
> >>>>>>> ---
>
> >>>>>>> This e-mail message, including any attachments, is for the sole use
> >>>>>>> of the intended recipient(s) and may contain information that is
> >>>>>>> confidential and protected by law from unauthorized disclosure. Any
> >>>>>>> unauthorized review, use, disclosure or distribution is prohibited. If you
> >>>>>>> are not the intended recipient, please contact the sender by reply e-mail
> >>>>>>> and destroy all copies of the original message.
>
> >>>>>>> --
> >>>>>>> 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.
>
> >>>>>>> --
> >>>>>>> You received this message because you are
>

> ...
>
> read more >>

Emmanuel

unread,
Mar 12, 2010, 5:19:08 AM3/12/10
to android-ndk
That's true that it's not in the changelog file (your website is only
cited on the patch page).
I notify the maintainer!

Emmanuel

Emmanuel

unread,
Mar 17, 2010, 12:53:13 PM3/17/10
to android-ndk
I ran the STLport unit tests for Android. Here are the first results,
with several errors:
https://sourceforge.net/tracker/?func=detail&aid=2972060&group_id=146814&atid=766244

Any advice from people knowing Stl or Android is welcome, thanks!

Emmanuel

On Mar 11, 11:07 am, Emmanuel <etiev...@altern.org> wrote:
>  Android patch in STLport
>
> I see that there is quite some work aboutStlfor Android. You may


> have seen that an Android patch has just been integrated in the
> STLport repository:

> - the patch:http://sourceforge.net/tracker/?func=detail&aid=2943782&group_id=1468...
> - the source in the 5.2 branch:http://stlport.git.sourceforge.net/git/gitweb.cgi?p=stlport/stlport;a...
> - the discussion:http://sourceforge.net/projects/stlport/forums/forum/490892/topic/339...
>
> That good news! For justStlsupport, this can avoid us to need the


> customized Ndk (which is tagged as experimental at this time).
>
> The bad new though is that the Android port may not be kept in the
> STLport code if nobody takes care of it. Any developer like me can
> give some help to compile and run the tests. However, when a problem
> occurs (with new Ndk or STLport versions), we may additionally need
> some help from people who have some knowledge of STL and/or Android
> internals.
>

> Conclusion: at this timeStlsupport in the Ndk remains a future plan,

Emmanuel

unread,
Mar 17, 2010, 12:55:10 PM3/17/10
to android-ndk
By the way, here is how I use STLport on Android.

I compiled STLport statically (because LD_LIBRARY_PATH not used on
Android and /system/lib readonly). I did:
./configure --target=android
SYSROOT=/opt/android-ndk/build/platforms/android-4/arch-arm/ make -C
build/lib stldbg-static dbg-static release-static


To use it in a shared library, I added in Android.mk:
STLPORT_INC := ...
STLPORT_LIB := ...

LOCAL_CFLAGS += -I$(STLPORT_INC) \
-D__NEW__ \
-D__SGI_STL_INTERNAL_PAIR_H \
-DANDROID \
-DOS_ANDROID \
-D_STLP_NO_CWCHAR
# wchar: already in android
LOCAL_CFLAGS += -D__ANDROID__ \
-isystem build/platforms/android-4/arch-arm/usr/include

LOCAL_STATIC_LIBRARIES := \
-L$(STLPORT_LIB) -lstlport
# beware not to have the libstlport.so in the lib path


Emmanuel

Emmanuel

unread,
Mar 18, 2010, 11:30:47 AM3/18/10
to android-ndk
Oups, in fact static linking is not an option for STLport.
I started a new topic to discuss compilation and testing of STLport:
http://groups.google.com/group/android-ndk/browse_thread/thread/5d4192c6f0826598

Emmanuel

Jin Chiu

unread,
Mar 19, 2010, 4:45:38 PM3/19/10
to android-ndk
Hi Emmanuel,

Are you invoking the `./configure` command in the source root
directory? When I tried your command, I get: "Unknown configuration
option SYSROOT='...'"

`make -C build/lib stldbg-static dbg-static release-static`

The copy of source I have is a snapshot from the link you posted. I
noticed the directory hierarchy in this snapshot is different than the
package posted on stlport.org, and the source you have. For example,
there's no `build` directory under the source root. What is the proper
way for obtaining the Android patched stlport source?

Thanks!

On Mar 18, 11:30 am, Emmanuel <etiev...@altern.org> wrote:
> Oups, in fact static linking is not an option forSTLport.

> I started a new topic to discuss compilation and testing ofSTLport:http://groups.google.com/group/android-ndk/browse_thread/thread/5d419...
>
> Emmanuel

Emmanuel

unread,
Mar 23, 2010, 10:21:09 AM3/23/10
to android-ndk
The snapshot I used: the first 2010-03-05 in
http://stlport.git.sourceforge.net/git/gitweb.cgi?p=stlport/stlport;a=shortlog;h=refs/heads/STLport-5.2

In there, I have a stlport directory containing src, configure,
build, ...

You may have to run
SYSROOT=/opt/android-ndk/build/platforms/android-4/arch-arm/ make
before, without -C (as I did when trying), to create the build
directory...?


By the way, about static linking (dangerous in general for STLport),
you can see:
http://sourceforge.net/tracker/?func=detail&aid=2972060&group_id=146814&atid=766244
(For dynamic linking, I get a sigill signal at runtime for now:
unknown instruction...).

Emmanuel

Emmanuel

unread,
Mar 23, 2010, 10:21:16 AM3/23/10
to android-ndk

In there, I have a stlport directory containing src, configure,
build, ...

You may have to run
SYSROOT=/opt/android-ndk/build/platforms/android-4/arch-arm/ make
before, without -C (as I did when trying), to create the build
directory...?


By the way, about static linking (dangerous in general for STLport),
you can see:
http://sourceforge.net/tracker/?func=detail&aid=2972060&group_id=146814&atid=766244
(For dynamic linking, I get a sigill signal at runtime for now:
unknown instruction...).

Emmanuel


On Mar 19, 9:45 pm, Jin Chiu <live2drea...@gmail.com> wrote:

Mike v

unread,
Apr 7, 2010, 7:00:46 PM4/7/10
to android-ndk
Emanuel, have you meant to the following?:

1) first check out revision 2010-03-05 with git to some directory

2) set environment variable SYSROOT to one of appropriate android sdk/
arch path, where for me it would be typing "SYSROOT=/Users/
mike_vasiljevs/development/android/android-ndk-r3/build/platforms/
android-4/arch-arm" in the terminal

3) run configure with android as target "./configure --target=android"

4) run make in $STLPORTSOURCE/build/lib "cd $STLPORTSOURCE/build/lib;
make stldbg-static dbg-static release-static"

...to get a cross-compiled stl library.


recent version of stlport seems to have '$STLPORTSOURCE/build/
Makefiles/gmake/android' entry missing. Will try revision mentioned,
need to find out how to use git first...


best regards
mike

On Mar 23, 4:21 pm, Emmanuel <etiev...@altern.org> wrote:
> The snapshot I used: the first 2010-03-05 inhttp://stlport.git.sourceforge.net/git/gitweb.cgi?p=stlport/stlport;a...


>
> In there, I have a stlport directory containing src, configure,
> build, ...
>
> You may have to run
> SYSROOT=/opt/android-ndk/build/platforms/android-4/arch-arm/ make
> before, without -C (as I did when trying), to create the build
> directory...?
>
> By the way, about static linking (dangerous in general for STLport),

> you can see:http://sourceforge.net/tracker/?func=detail&aid=2972060&group_id=1468...

Emmanuel

unread,
Apr 8, 2010, 7:11:13 AM4/8/10
to android-ndk
Yes, I first meant that, for the static library. But now I got the
dynamic library to work, and this avoid potentially BIG troubles.
Please see now:
http://groups.google.com/group/android-ndk/browse_thread/thread/5d4192c6f0826598

Mike v

unread,
Apr 8, 2010, 10:58:21 AM4/8/10
to android-ndk
Could you please make the whole Android.mk/Application.mk (as a link/
attached files) available, as the one obtained from the google groups
does not seem to work.

Many thanks

mike

On Apr 8, 1:11 pm, Emmanuel <etiev...@altern.org> wrote:
> Yes, I first meant that, for the static library. But now I got the
> dynamic library to work, and this avoid potentially BIG troubles.

> Please see now:http://groups.google.com/group/android-ndk/browse_thread/thread/5d419...

impete

unread,
Apr 19, 2010, 4:26:53 PM4/19/10
to android-ndk
Hi all - great work by the sound of it!

I got John's STLport variant working a way back (many thanks for
making that available, John!), and thought I'd try to get the version
from http://stlport.git.sourceforge.net working ...

I'm obviously tired (long day), but where do I find the steps for
building on Android?

I've done the git command and put the STLport folder so that it is
under my android-ndk-r3 folder... :

~/android-ndk-r3/STLport

... and then get stuck. :)

Best wishes to all,

Pete

impete

unread,
Apr 19, 2010, 4:35:03 PM4/19/10
to android-ndk
I should note that I did this (on a Mac, FWIW!):

cd ~/android-ndk-r3/STLport
export SYSROOT=/Users/pete/android-ndk-r3/build/platforms/android-4/
arch-arm
./configure --target=android

... and nothing happened (I was expecting a build sub-folder to get
created...)

Emmanuel

unread,
Apr 20, 2010, 12:48:55 PM4/20/10
to android-ndk
To avoid potentially BIG troubles, compile the dynamically linked
Stlport library.
Please see now the procedure here:
http://groups.google.com/group/android-ndk/browse_thread/thread/5d4192c6f0826598
(12th of April message)

+ Android.mk as Attached Files here:
http://sourceforge.net/tracker/?func=detail&aid=2972060&group_id=146814&atid=766244
Reply all
Reply to author
Forward
0 new messages