Author Topic: MinGW compilers for android ndk r3/r4.  (Read 26519 times)

mingw-and-ndk

  • Guest
MinGW compilers for android ndk r3/r4.
« on: June 20, 2010, 07:51:49 pm »
Hello,

Not sure if anyone's very interested, but, I've started a google code project for building
native Windows (mingw) compilers for the android ndk. They include full C++ support
(C++ exceptions, RTTI and Standard C++ Library), the patch for this comes from Crystax:
http://www.crystax.net/android/ndk-r4.php

Links:

Project Page
http://code.google.com/p/mingw-and-ndk/
The svn repo has precompiled ndk r3 and r4 toolchains and everything needed to build them.

This site seems to be related to setting C::B up for using the cygwin gcc that google ships
http://www.csharpwin.com/dotnetspace/4100r6181.shtml

I've not tried using them yet, beyond compiling the samples.

Some nitty gritty...

Getting an up-to-date mingw/msys environment is a bit painful these days (old installers,
updates provided individually in lzma format) so I've written a few batch files and shell scripts
to simplify this. This part may be of use to people who compile a lot of stuff in MinGW
(e.g. cross compiler toolchains like android..). It's also helpful in that it creates a fixed system
to build on (rather than everyone having different versions of different parts of MinGW). A lot
of my patching work has been to gcc's fixincludes, and this work might be useful to people building
cross compilers on MinGW.

To bootstrap the whole thing, download everything from:
http://code.google.com/p/mingw-and-ndk/source/browse/trunk/
to e.g. C:\mingw-and-ndk
Install 7-zip to C:\Program Files\7-Zip
Then run mk-mingw32-env.bat. It'll overwrite your C:\usr folder, download mingw and msys,
install them (follow the prompts) and update them.

If you then run C:\usr\msys.bat, then from the bash shell,
cd /usr
./mk-gcc-cross-build-env.sh C:/mingw-and-ndk

Then it'll download the official mingw 4.5.0 compilers and various build tools. It also patches an issue
in mingw's sys/types.h that prevents building cross-gcc libgcc natively on mingw (there is probably
a better way to fix this), and leave you with a fairly up-to-date mingw cross-gcc build environment.

To go further than this and build android ndk from this point, you can type:
./android.mk C:/mingw-and-ndk

Testers are very welcome.

mingw-and-ndk
« Last Edit: June 20, 2010, 08:11:52 pm by mingw-and-ndk »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6025
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: MinGW compilers for android ndk r3/r4.
« Reply #1 on: July 03, 2010, 08:04:50 am »
Nice. So, now C::B support another Compiler: MinGW Compiler for Android. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline autobot

  • Single posting newcomer
  • *
  • Posts: 7
Re: MinGW compilers for android ndk r3/r4.
« Reply #2 on: July 15, 2010, 09:01:27 am »
I will get at this when I get more time and let you know how it goes. Thanks for sharing your work.
« Last Edit: July 15, 2010, 09:08:25 am by autobot »