I got the crazy notion to try to compile a native vim binary for android, and one of its dependencies is libncurses.
Make sure you have the ndk installed and working.
You'll need the agcc wrapper, a perl script that creates appropriate command line arguments for arm-eabi-gcc. I learned today that the order of arguments to gcc can be quite significant while linking. I kept getting errors about the "__aeabi_unwind_cpp_pr0" symbol and common functions like printf not being found when it tried to link.
So I hacked Vlad's hacked agcc to make sure that libgcc.a and libc.a get put at the end of the command line, which seems to be necessary for static linking. Here's my hacked version of Vlad's agcc.
Make sure both agcc and arm-eabi-gcc are in your path.
Download ncurses-5.7.tar.gz.
Run configure:
CC=agcc.pl ./configure --host=arm-eabi --without-cxx-binding
When I tried to build, I got errors saying "'struct lconv' has no member named 'decimal_point'"", because android has a broken locale implementation.
So I commented out the HAVE_LOCALE_H line from include/ncurses_cfg.h. (Is there a better way to force configure to set a value like that during the ./configure process?)
It might be possible to build ncurses with the C++ binding, but I didn't try.
Once I had all that fixed, the make ran just fine, and I ended up with lib/libncurses.a.
7 comments:
Thanks, I used your hacked script to produce YAHS (yet another hacked script) that would work for the OSX (darwin) NDK and the arm-eabi-4.4.0.
the link is here:
https://docs.google.com/leaf?id=0B5GHo8hfeTGgNGZiMDg3YTMtNmVhNS00MDY5LWI2YTAtNWE4MDlkZThkOTMw&hl=en&authkey=CKjm3J0J
also I had to use
CC=agcc RANLIB=arm-eabi-ranlib ./configure --target=arm-eabi --host=i386-apple-darwin --without-cxx-binding
and the apply the hack
#define HAVE_LOCALE 0
in
ncurses_cfg.h
thanks again for the great walkthrough!
I kept encountering problems when configuring, and it turned out to be a mistake in the post.
Please change:
CC=agcc ./configure --host=arm-eabi --without-cxx-binding
to
CC=agcc.pl ./configure --host=arm-eabi --without-cxx-binding
thanks.
Hi,
I am getting error while configuring with following command:
$ CC=agcc ./configure --target=arm-eabi --host=arm-eabi --without-cxx-binding
ERROR:
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-eabi
checking target system type... arm-unknown-eabi
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for arm-eabi-gcc... agcc
checking for C compiler default output file name...
configure: error: in `/home/akshat/work/gdb-7.3':
configure: error: C compiler cannot create executables
See `config.log' for more details.
In config.log I found:
arm-eabi-gcc: /home/akshat/work/google-android-Nov18/platforms/android-8/arch-arm/usr/lib/crtend_android.o: No such file or directory
arm-eabi-gcc: /home/akshat/work/google-android-Nov18/platforms/android-8/arch-arm/usr/lib/crtbegin_dynamic.o: No such file or directory
arm-eabi-gcc: /home/akshat/work/google-android-Nov18/prebuilt/linux-x86/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a: No such file or directory
arm-eabi-gcc: /home/akshat/work/google-android-Nov18/platforms/android-8/arch-arm/usr/lib/libc.a: No such file or directory
I have export arm-eabi-4.4.3 in my path
Thanks in Advance
Akshat
Thank you very much, works fine, well appreciated !
Thank you for the tips!
The better way to disable locale.h is to set the env var "ac_cv_header_locale_h=no", for example:
CC=agcc.pl ac_cv_header_locale_h=no ./configure --host=arm-eabi --without-cxx-binding
tested on ncurses-6.0
Hello nnice post
Post a Comment