简体   繁体   中英

NCurses 6.0 Compilation Error Using Android-NDK

I'm trying to cross-compile ncurses using android-ndk but compilation error shows halfway the process.

Command:

CC=~/my-toolchain/bin/arm-linux-androideabi-gcc ./configure --host=arm-linux-androideabi --prefix=/Android 

Output:

** Configuration summary for NCURSES 6.0 20150808:

   extended funcs: yes
   xterm terminfo: xterm-new

    bin directory: /Android/bin
    lib directory: /Android/lib
include directory: /Android/include/ncurses
    man directory: /Android/share/man
terminfo directory: /Android/share/terminfo

** Include-directory is not in a standard location  

Command

make  

Output

../objects/tic.o:tic.c:function usage: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function put_translate: error: undefined reference to 'stdout'
../objects/tic.o:tic.c:function copy_input: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function open_input: error: undefined reference to 'stdin'
../objects/tic.o:tic.c:function open_input: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function show_databases: error: undefined reference to 'stdout'
../objects/tic.o:tic.c:function show_databases: error: undefined reference to 'stderr'
../objects/dump_entry.o:dump_entry.c:function show_entry: error: undefined reference to 'stdout'
../objects/dump_entry.o:dump_entry.c:function compare_entry: error: undefined reference to 'stdout'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_SET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_SET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_ISSET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_ISSET_chk'
collect2: error: ld returned 1 exit status
Makefile:242: recipe for target 'tic' failed
make[1]: *** [tic] Error 1
make[1]: Leaving directory '/home/jrm/softether/src/curses/ncurses-6.0/progs'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2

I don't have any idea about the error. I tried using google but i can't seem to find similar problems like mine.

The usual reason for this error is that you've compiled against android-23 or higher but are linking against something earlier. Another variation of that issue is when you have multiple libraries built against different API levels.

It looks like you are using a standalone toolchain ? If that's correct, then I'd suspect your issue is either a prebuilt library that's part of libcurses (FWIR there aren't any of those, so unlikely) or that there's something funky going on in their build scripts that causes one of the two issues I mentioned. Tons of projects add their own Android specific hacks to their build scripts that always end up being the cause of these sorts of issues, so that wouldn't surprise me at all.

Should look at both the compilation command for tic.c and the link command for whatever library/executable is failing to link there. Make sure both are using the same API levels (look for things like $NDK/platforms/android-$API_LEVEL , -D__ANDROID_API__=$API_LEVEL , and -target arm-linux-androideabi$API_LEVEL ).

btw, not ncurses 6, but I do have an example showing how to use standalone toolchains that had to build ncurses 5.9: https://github.com/DanAlbert/lua-ndk/blob/master/build_lua_with_libreadline.sh#L75 . Might be worth taking a look to see if that helps at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM