Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 454736

Summary: x11-terms/xterm-285 with sys-libs/ncurses[tinfo] - resize.c:(.text.startup+0x127): undefined reference to `tgetent'
Product: Gentoo Linux Reporter: Jan Paesmans <jan.paesmans>
Component: Current packagesAssignee: Thomas Dickey <dickey>
Status: RESOLVED UPSTREAM    
Severity: normal CC: jlec, travisghansen, x11
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 457530    

Description Jan Paesmans 2013-01-30 20:46:33 UTC
After upgrading ncurses, xterm-285 fails to link with ncurses. Same problem happens when enabling ncurses use flag with openrc. During linking of xterm executable, no library ncurses is seen. In the config.log, I saw that a testlink of ncurses failed. This is due to the libraries for ncurses being wrong, pkg-config --libs ncurses gives -lncurses -ltinfo. Whoever in the gcc command line, only -lncurses is given. config.log attached after emerge --info

Reproducible: Always

Steps to Reproduce:
1. update sys-libs/ncurses
2. re-emerge xterm
3.
Actual Results:  
/bin/sh ./plink.sh x86_64-pc-linux-gnu-gcc -march=amdfam10 -O3 -pipe -fomit-frame-pointer -W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wundef -Wdeclaration-after-statement -Wextra -Wno-unknown-pragmas -Wswitch-enum -Wl,-O1 -Wl,--as-needed  -o resize resize.o xstrings.o -lfontconfig -lXft -lXaw3d -lXmu -lXt -lX11 -lXext -lXpm -lSM -lICE -lXt -lX11 -lutempter
testing if -lfontconfig is needed
...yes
testing if -lXft is needed
...yes
testing if -lXaw3d is needed
...yes
testing if -lXmu is needed
...yes
testing if -lXt is needed
...yes
testing if -lX11 is needed
...yes
testing if -lXext is needed
...yes
testing if -lXpm is needed
...yes
testing if -lSM is needed
...yes
testing if -lICE is needed
...yes
testing if -lXt is needed
...yes
testing if -lX11 is needed
...yes
testing if -lutempter is needed
...yes
resize.o: In function `main':
resize.c:(.text.startup+0x127): undefined reference to `tgetent'
collect2: ld returned 1 exit status
make: *** [resize] Error 1
make: *** Waiting for unfinished jobs....
 * ERROR: x11-terms/xterm-285 failed (compile phase):
 *   emake failed


Expected Results:  
xterm successfully emerged

emerge --info:
Portage 2.1.11.31 (default/linux/amd64/10.0/desktop, gcc-4.6.3, glibc-2.15-r3, 3.7.4 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.7.4-x86_64-AMD_Phenom-tm-_II_X6_1090T_Processor-with-gentoo-2.1
Timestamp of tree: Sun, 27 Jan 2013 20:15:01 +0000
ld GNU ld (GNU Binutils) 2.22
distcc 3.1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.12-r1
dev-lang/python:          2.7.3-r2, 3.1.5, 3.2.3
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.6.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA AdobeFlash-10.3 Intel-SDP Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=amdfam10 -O3 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="${EPREFIX}/etc/gconf /etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=amdfam10 -O3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.inode.at/ ftp://gentoo.inode.at/source/ rsync://gentoo.lagis.at/gentoo-distfiles/ http://gentoo.lagis.at/ ftp://gentoo.lagis.at/ http://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://gd.tuwien.ac.at/opsys/linux/gentoo/ rsync://gd.tuwien.ac.at/opsys/linux/gentoo/ ftp://ftp.klid.dk/gentoo/ http://ftp.klid.dk/ftp/gentoo/ rsync://trumpetti.atm.tut.fi/gentoo/ ftp://trumpetti.atm.tut.fi/gentoo/ http://trumpetti.atm.tut.fi/gentoo/ ftp://de-mirror.org/gentoo/ http://de-mirror.org/gentoo/ rsync://de-mirror.org/gentoo/ ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo http://gentoo.mneisen.org/ http://mirror.netcologne.de/gentoo/ ftp://mirror.netcologne.de/gentoo/ rsync://mirror.netcologne.de/gentoo/ rsync://mirror.opteamax.de/gentoo/ http://mirror.opteamax.de/gentoo/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/ ftp://ftp.halifax.rwth-aachen.de/gentoo/ http://ftp.halifax.rwth-aachen.de/gentoo/ rsync://ftp.halifax.rwth-aachen.de/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/ ftp://ftp.tu-clausthal.de/pub/linux/gentoo/ ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo http://ftp.uni-erlangen.de/pub/mirrors/gentoo rsync://ftp.join.uni-muenster.de/gentoo/ ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ rsync://ftp-stud.hs-esslingen.de/gentoo/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo ftp://ftp6.uni-muenster.de/pub/linux/distributions/gentoo ftp://ftp.ipv6.uni-muenster.de/pub/linux/distributions/gentoo rsync://mirror.leaseweb.com/gentoo/ http://mirror.leaseweb.com/gentoo/ ftp://mirror.leaseweb.com/gentoo/ rsync://gentoo.tiscali.nl/gentoo/ ftp://gentoo.tiscali.nl/pub/mirror/gentoo/ http://gentoo.tiscali.nl/ ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo http://ftp.snt.utwente.nl/pub/os/linux/gentoo rsync://ftp.snt.utwente.nl/gentoo"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j7"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://192.168.1.103/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif gpm gtk iconv ipv6 jpeg lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt4 readline sdl session spell sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xml xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="adc65 agfa_cl20 aox ax203 barbie canon casio_qv clicksmart310 digigr8 digita dimagev dimera3500 directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 jl2005a jl2005c kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica konica_qm150 largan lg_gsm mars mustek panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 pccam300 pccam600 polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ptp2 ricoh ricoh_g3 samsung sierra sipix_blink sipix_blink2 sipix_web2 smal sonix sony_dscf1 sony_dscf55 soundvision spca50x sq905 st2205 stv0674 stv0680 sx330z template topfield toshiba_pdrm11 tp6801" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="nlpsolver pdfimport presenter-console presenter-minimizer scripting-beanshell scripting-javascript wiki-publisher" LINGUAS="en nl" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="radeon r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

x11-terms/xterm-285 was built with the following:
USE="Xaw3d (multilib) truetype unicode -toolbar"


relevant config.log section:


configure:5607: x86_64-pc-linux-gnu-gcc -o conftest -march=amdfam10 -O3 -pipe -fomit-frame-pointer  -D_GNU_SOURCE -Wl,-O1 -Wl,--as-needed conftest.c -lncurses  >&5
/var/tmp/portage/x11-terms/xterm-285/temp/ccWWxK2x.o: In function `main':
conftest.c:(.text.startup+0x16): undefined reference to `tgetent'
collect2: ld returned 1 exit status
configure:5610: $? = 1
configure: program exited with status 1
configure: failed program was:
#line 5592 "configure"
#include "confdefs.h"

/* terminfo implementations ignore the buffer argument, making it useless for
 * the xterm application, which uses this information to make a new TERMCAP
 * environment variable.
 */
int main()
{
        char buffer[1024];
        buffer[0] = 0;
        tgetent(buffer, "vt100");
        return (0); }
no, there is no termcap/tgetent in ncurses
configure:5607: x86_64-pc-linux-gnu-gcc -o conftest -march=amdfam10 -O3 -pipe -fomit-frame-pointer  -D_GNU_SOURCE -Wl,-O1 -Wl,--as-needed conftest.c -lcurses  >&5
/var/tmp/portage/x11-terms/xterm-285/temp/cc1fi6OK.o: In function `main':
conftest.c:(.text.startup+0x16): undefined reference to `tgetent'
collect2: ld returned 1 exit status
configure:5610: $? = 1
configure: program exited with status 1
configure: failed program was:
#line 5592 "configure"
Comment 1 Travis Hansen 2013-01-31 07:22:46 UTC
This little bug is causing me grief with all kinds of packages.  I have issues building:

readline
texinfo
lame
speech-tools
vim-core
procps

All of them build fine if I set:

LDFLAGS=" -L/lib -lncurses" emerge foo
Comment 2 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-01-31 10:30:09 UTC
Builds fine here.
# ncurses5-config --libs
-L/usr/lib64 -lncurses
Comment 3 Jan Paesmans 2013-01-31 19:50:12 UTC
This is the piece of c-code that is used by autoconf:

int main()
{
        char buffer[1024];
        buffer[0] = 0;
        tgetent(buffer, "vt100");
        return (0);
}

Autoconf tries to compile with the following cmd-line:

x86_64-pc-linux-gnu-gcc -o conftest -march=amdfam10 -O3 -pipe -fomit-frame-pointer  -D_GNU_SOURCE -Wl,-O1 -Wl,--as-needed conftest.c -lcurses

Resulting in the following error:

In function `main':
conftest.c:(.text.startup+0x16): undefined reference to `tgetent'
collect2: ld returned 1 exit status

To successfully compile I need to add -ltinfo. This is where the symbol 'tgetent' is located.

Autoconf script doesn't use ncurses5-config and running ncurses5-config gives the following:

ncurses5-config --libs
-L/usr/lib64 -lncurses -ltinfo

This means that adding -ltinfo is needed
Comment 4 Jan Paesmans 2013-01-31 20:07:05 UTC
Using the output of ncurses5-config and setting

LDFLAGS="-L/usr/lib64 -lncurses -ltinfo" emerge -v xterm 

works. A variant to what Travis Hansen suggests.
Comment 5 Travis Hansen 2013-01-31 20:12:00 UTC
I think there's a deeper issue here as well.  Look at the differnces in filesizes:

15z ~ # ls -l /lib64/libncurses.so.5.9 
-rwxr-xr-x 1 root root 142816 Jan 17 01:29 /lib64/libncurses.so.5.9
15z ~ # ls -l /usr/lib64/libncurses.so 
-rwxr-xr-x 1 root root 529 Jan 17 01:29 /usr/lib64/libncurses.so

And is it standard procedure to have libs with the same name in different dirs?
Comment 6 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-01-31 20:24:23 UTC
CC:'ing ncurses maintainers, maybe they can suggest what is the correct way to address this issue.
Comment 7 SpanKY gentoo-dev 2013-02-03 05:24:12 UTC
(In reply to comment #6)

use ncurses' .pc file rather than -lncurses to link.  the ncurses ebuild isn't broken here.
Comment 8 Jan Paesmans 2013-02-03 20:07:48 UTC
As indicated, there is something wrong with the configure script.

autoconf tries to check for termcap/curses/ncurses libraries. It does this by testing for each by trying to link the conftest.c file as mentioned after the emerge --info section. This is wrong, autoconf's check for termcap/curses/ncurses is wrong. If it wants to see if libncurses can be used by compiling and linking a test code, that at least for libncurses it must use the proper libraries. This can be done by using pkg-config.

If someone tells me that this is not a problem, again try compiling and linking the example code given with the ncurses5.9-r2, than you'll see that the test as preformed by autoconf is _wrong_!
Comment 9 Jan Paesmans 2013-02-04 21:04:44 UTC
Linking rc from openrc suffers from the same problem. Linking with the ncurses5.9-r2 fails. In mk/termcap.mk:2, if you want to link with this ncurses5.9-r2, you need -lncurses -ltinfo, not just -lncurses.
This is not automake, so in the future, it might be easier to use ncurses pkg-config there.
Comment 10 SpanKY gentoo-dev 2013-02-05 23:56:01 UTC
(In reply to comment #9)

file new bugs for new issues.  this bug is just for xterm.
Comment 11 Travis Hansen 2013-02-06 00:19:30 UTC
I think it's time a tracker bug be opened to deal with the packages affected by this issue.
Comment 12 Justin Lecher gentoo-dev 2013-02-14 13:42:47 UTC
+  14 Feb 2013; Justin Lecher <jlec@gentoo.org> xterm-285.ebuild,
+  xterm-288.ebuild, metadata.xml:
+  Add Workaround for ncurses[tinfo], #454736; correct HOMEPAGE; improve usage
+  of EAPI >=4; add missing die
+
Comment 13 Justin Lecher gentoo-dev 2013-02-14 13:44:44 UTC
Thomas, could you please make the buildsystem use pkg-config to detect ncurses libs? 
And while you are at it, I saw you are still using the long deprecated configure.in instead of .ac naming. This will become a problem with next automake release. A simple rename should do it.
Thanks
Comment 14 Travis Hansen 2013-02-14 16:32:59 UTC
Do we have a tracker bug yet for all the packages that have this issue?
Comment 15 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-02-14 16:34:31 UTC
(In reply to comment #14)
Yes, bug 457530 which is already blocked by this bug.