|
From: | Peter Groves |
Subject: | How do I resolve ncurses build error in source file generated by MKlib_gen.sh |
Date: | Thu, 29 Aug 2024 12:36:44 +0000 |
Hi Stack Overflow issue “How do I resolve ncurses build error in source file generated by MKlib_gen.sh“ refers. Thank you for your comment in directing me to your bug reporting portal – please pardon my hesitation in terms of not having used this option. I thought it might have seemed inappropriate as I believe the problem I am facing is probably
of my own making rather than a bug associated with the ncurses software itself. Following your recommendation, I have therefore outlined the issue below, by including additional info which may be useful.
Problem description I have been tasked with upgrading to bluez-5.65.tar.gz as part of a linux development build cross-compiled for a target arm-none-linux-gnueabi processor. The build system uses the opensource Freescale GNU/Linux Target Image Builder (LTIB)
tool. The build was simplified initially by dropping ‘readline’ with the --disable-client option in the bluez spec file however this comes at a cost because ‘bluetoothctl’ is consequently also excluded. Reconfiguring to include ‘readline’ leads to dependencies
on other packages and in particular a number of undefined references in the package bluez build (see attached), despite the readline package building successfully. /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `tputs' /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `tgoto' /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `tgetflag' /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `UP' /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `tgetent' /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `tgetnum' /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `PC' /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `tgetstr' /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rootfs/usr/lib//libreadline.so: undefined reference to `BC' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:5401: client/bluetoothctl] Error 1 make[1]: *** Waiting for unfinished jobs.... Some investigation revealed that libtinfo installed as part of ncurses could resolve this. A LTIB sample ncurses spec file is provided with reference to a very early version (see attached), namely, ncurses-5.3.tar.gz. This was downloaded
from the ncurses website
https://invisible-island.net/ncurses/ncurses.faq.html#other_versions, along with the associated path file patch-5.3-5.4.sh.gz located here
https://invisible-island.net/ncurses/ncurses.faq.html#where_patches. I was able to apply the patches successfully using the example provided on the website as a reference. It
would doubtless be prudent to consider using a later version of ncurses except for the fact that I’m not very confident of deriving a corresponding spec file. For the moment I have disabled PKG_LIBTERMCAP, though may need to revert this setting at some stage. config PKG_NCURSES #select PKG_LIBTERMCAP bool "ncurses" help The curses library routines are a terminal-independent method of updating character screens with reasonable optimization. The ncurses (new curses) library is a freely distributable replacement for the discontinued 4.4BSD classic curses library. The build for ncurses initially generated the following error, which I resolved by setting “--with-build-cc=gcc” in the ncurses spec file, to ensure that the ‘make_keys’ is compiled using the host compiler rather than being cross-compiled
for the target. A similar issue was raised here:
https://lists.gnu.org/archive/html/bug-ncurses/2002-10/msg00091.html gcc -o make_hash -DHAVE_CONFIG_H -I../ncurses -I. -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -DMAIN_PROGRAM ./tinfo/comp_hash.c
sh ./tinfo/MKcaptab.awk mawk ./../include/Caps > comp_captab.c ./tinfo/MKcaptab.awk: line 20: ./make_hash: cannot execute binary file: Exec format error ./tinfo/MKcaptab.awk: line 21: ./make_hash: cannot execute binary file: Exec format error sh ./tty/MKexpanded.sh "gcc -E" -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG > expanded.c sh ./tinfo/MKfallback.sh /usr/share/terminfo ../misc/terminfo.src >fallback.c gcc -o make_keys -DHAVE_CONFIG_H -I../ncurses -I. -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 ./tinfo/make_keys.c
AWK=mawk sh ./tinfo/MKkeys_list.sh ../include/Caps | sort >keys.list ./make_keys keys.list > init_keytry.h /bin/sh: ./make_keys: cannot execute binary file: Exec format error make[1]: *** [Makefile:196: init_keytry.h] Error 126 make[1]: Leaving directory '/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rpm/BUILD/ncurses-5.3/ncurses' make: *** [Makefile:96: all] Error 2 error: Bad exit status from /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/tmp/rpm-tmp.65852 (%build) The build for ncurses generates the following error (see attached) in the source file ../ncurses/comp_captab.c, which is in fact generated by the ncurses script MKlib_gen.sh.
+ make -j1 'HOSTCC=ccache /usr/bin/gcc -B/usr/bin/' cd man && make DESTDIR="/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/tmp/ncurses" all make[1]: Entering directory '/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rpm/BUILD/ncurses-5.3/man' sh ./MKterminfo.sh ./terminfo.head ./../include/Caps ./terminfo.tail >terminfo.5 make[1]: Leaving directory '/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rpm/BUILD/ncurses-5.3/man' cd include && make DESTDIR="/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/tmp/ncurses" all make[1]: Entering directory '/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rpm/BUILD/ncurses-5.3/include' cat curses.head >curses.h AWK=mawk sh ./MKkey_defs.sh ./Caps >>curses.h sh -c 'if test "chtype" = "cchar_t" ; then cat ./curses.wide >>curses.h ; fi' cat ./curses.tail >>curses.h mawk -f MKterm.h.awk ./Caps > term.h sh ./edit_cfg.sh ../include/ncurses_cfg.h term.h ** edit: HAVE_TCGETATTR 1 ** edit: HAVE_TERMIOS_H 1 ** edit: HAVE_TERMIO_H 1 ** edit: BROKEN_LINKER 0 make[1]: Leaving directory '/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rpm/BUILD/ncurses-5.3/include' cd ncurses && make DESTDIR="/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/tmp/ncurses" all make[1]: Entering directory '/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rpm/BUILD/ncurses-5.3/ncurses' sh ./base/MKlib_gen.sh "gcc -E -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG" "mawk" generated <../include/curses.h | \ fgrep undef >../include/nomacros.h sh ./base/MKlib_gen.sh "gcc -E -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG" "mawk" generated <../include/curses.h >lib_gen.c sh ./base/MKlib_gen.sh "gcc -E -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG" "mawk" implemented <../include/curses.h >link_test.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./tty/hashmap.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_beep.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_color.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_endwin.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_flash.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/lib_gen.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_getstr.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_mouse.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./tty/lib_mvcur.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_newterm.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_restart.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_screen.c ../ncurses/./base/lib_screen.c: In function 'getwin': ../ncurses/./base/lib_screen.c:48:5: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] (void) fread(&tmp, sizeof(WINDOW), 1, filep); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../ncurses/./base/lib_screen.c:95:6: warning: ignoring return value of 'fread', declared with attribute warn_unused_result [-Wunused-result] (void) fread(nwin->_line[n].text, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sizeof(NCURSES_CH_T), ~~~~~~~~~~~~~~~~~~~~~ (size_t) (nwin->_maxx + 1), ~~~~~~~~~~~~~~~~~~~~~~~~~~~ filep); ~~~~~~ cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_set_term.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_slk.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_slkrefr.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./tty/lib_vidattr.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./tty/tty_update.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/lib_dft_fgbg.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./tinfo/lib_print.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/resizeterm.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./base/wresize.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./tinfo/alloc_entry.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/./tinfo/alloc_ttype.c cd ../obj_s; gcc -DHAVE_CONFIG_H -I../ncurses -I. -I. -I../include -D_GNU_SOURCE -DNDEBUG -O2 -fPIC -c ../ncurses/comp_captab.c ../ncurses/comp_captab.c: In function '_nc_get_table': ../ncurses/comp_captab.c:74:19: error: '_nc_cap_table' undeclared (first use in this function) return termcap ? _nc_cap_table: _nc_info_table ; ^~~~~~~~~~~~~ ../ncurses/comp_captab.c:74:19: note: each undeclared identifier is reported only once for each function it appears in ../ncurses/comp_captab.c:74:34: error: '_nc_info_table' undeclared (first use in this function) return termcap ? _nc_cap_table: _nc_info_table ; ^~~~~~~~~~~~~~ make[1]: *** [Makefile:974: ../obj_s/comp_captab.o] Error 1 make[1]: Leaving directory '/home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/rpm/BUILD/ncurses-5.3/ncurses' make: *** [Makefile:96: all] Error 2 error: Bad exit status from /home/pgroves/workspace/RELEASE5301.orig/Eagle-Ltib/tmp/rpm-tmp.48770 (%build) ` To summarize, I was expecting ncurses to build successfully, hopefully to resolve my linker error associated with the bluez-5.65 package. I wasn't expecting the build to fail for a file generated by the ncurses script.
How may I resolve this issue please? I do anticipate further ncurses package dependencies that may still be required in order to ultimately generate a ‘bluetoolctl’ executable file. Thanking you. Kind Regards. Peter Groves |
Ncurses-build-error.pdf
Description: Ncurses-build-error.pdf
Bluez-build-undefined-references.pdf
Description: Bluez-build-undefined-references.pdf
Ltib-ncurses-spec-file.pdf
Description: Ltib-ncurses-spec-file.pdf
[Prev in Thread] | Current Thread | [Next in Thread] |