Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 521860 - media-sound/moc with ncurses[tinfo] - ld: interface_elements.o: undefined reference to symbol 'cbreak'
Summary: media-sound/moc with ncurses[tinfo] - ld: interface_elements.o: undefined ref...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Sound Team
: 558716 (view as bug list)
Depends on:
Blocks: tinfo
  Show dependency tree
Reported: 2014-09-01 00:12 UTC by Quentin Minster
Modified: 2016-01-27 23:23 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

moc_build_log (moc.tar.bz2,17.76 KB, application/x-bzip)
2014-09-03 01:02 UTC, Zhu Sha Zang
moc-2.6_alpha1-detect-tinfo.patch (moc-2.6_alpha1-detect-tinfo.patch,1.43 KB, patch)
2015-11-21 10:18 UTC, Quentin Minster
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Quentin Minster 2014-09-01 00:12:07 UTC
Missing -ltinfo linking results in build failure (compile stage) with "undefined reference" error:

 /bin/sh ./libtool --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc  -pthread -march=core-avx-i -O2 -pipe -Wall -W -I/usr/include/alsa   -lasound  -lm -lmagic  -lncursesw -lcurl -lidn -lssh2 -lssh2 -lssl -lcrypto -lssl -lcrypto -lz  -export-dynamic -Wl,-O1 -Wl,--as-needed -o mocp log.o protocol.o server.o main.o common.o playlist.o fifo_buf.o out_buf.o audio.o decoder.o interface.o interface_elements.o menu.o files.o options.o player.o playlist_file.o themes.o keys.o io.o compat.o audio_conversion.o rbtree.o tags_cache.o utf8.o rcc.o softmixer.o lyrics.o lists.o equalizer.o alsa.o io_curl.o -lltdl -lm -ldl
 libtool: link: x86_64-pc-linux-gnu-gcc -pthread -march=core-avx-i -O2 -pipe -Wall -W -I/usr/include/alsa -Wl,-O1 -Wl,--as-needed -o mocp log.o protocol.o server.o main.o common.o playlist.o fifo_buf.o out_buf.o audio.o decoder.o interface.o interface_elements.o menu.o files.o options.o player.o playlist_file.o themes.o keys.o io.o compat.o audio_conversion.o rbtree.o tags_cache.o utf8.o rcc.o softmixer.o lyrics.o lists.o equalizer.o alsa.o io_curl.o -Wl,--export-dynamic  -lasound -lmagic -lncursesw -lcurl -lidn -lssh2 -lssl -lcrypto -lz /usr/lib64/ -lm -ldl -pthread
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../x86_64-pc-linux-gnu/bin/ld: interface_elements.o: undefined reference to symbol 'cbreak'
 /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.3/../../../../x86_64-pc-linux-gnu/bin/ld: note: 'cbreak' is defined in DSO /lib64/ so try adding it to the linker command line
 /lib64/ could not read symbols: Invalid operation
 collect2: error: ld returned 1 exit status
 make[2]: *** [mocp] Error 1
 make[2]: Leaving directory `/var/tmp/portage/media-sound/moc-2.5.0/work/moc-2.5.0'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory `/var/tmp/portage/media-sound/moc-2.5.0/work/moc-2.5.0'
 make: *** [all] Error 2
  * ERROR: media-sound/moc-2.5.0::gentoo failed (compile phase):
  *   emake failed
  * If you need support, post the output of `emerge --info '=media-sound/moc-2.5.0::gentoo'`,
  * the complete build log and the output of `emerge -pqv '=media-sound/moc-2.5.0::gentoo'`.
  * The complete build log is located at '/var/tmp/portage/media-sound/moc-2.5.0/temp/build.log'.
  * The ebuild environment file is located at '/var/tmp/portage/media-sound/moc-2.5.0/temp/environment'.
  * Working directory: '/var/tmp/portage/media-sound/moc-2.5.0/work/moc-2.5.0'
  * S: '/var/tmp/portage/media-sound/moc-2.5.0/work/moc-2.5.0'

Forcing "-ltinfo" into LDFLAGS makes it build ok.

I guess this should block tracker bug #457530.

Reproducible: Always

Portage 2.2.8-r1 (default/linux/amd64/13.0/desktop, gcc-4.8.3, glibc-2.19-r1, 3.14.14-gentoo x86_64)
System uname: Linux-3.14.14-gentoo-x86_64-Intel-R-_Core-TM-_i7-3770K_CPU_@_3.50GHz-with-gentoo-2.2
KiB Mem:     8060816 total,    973164 free
KiB Swap:    6246396 total,   3339236 free
Timestamp of tree: Sun, 31 Aug 2014 11:30:01 +0000
ld GNU ld (GNU Binutils) 2.23.2
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.7, 3.3.5-r1
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4::pentoo
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.4
sys-devel/binutils:       2.23.2
sys-devel/gcc:            4.6.4, 4.8.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.13 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo science sunrise steam-overlay pentoo laomaiweng-overlay x-portage
CFLAGS="-march=core-avx-i -O2 -pipe"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core-avx-i -O2 -pipe"
FCFLAGS="-march=core-avx-i -O2 -pipe"
FEATURES="assume-digests binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=core-avx-i -O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/science /var/lib/layman/sunrise /var/lib/layman/steam /var/lib/layman/pentoo /var/lib/layman/laomaiweng-dev /usr/local/portage"
USE="X a52 aac acl acpi alsa amd64 avx bash-completion berkdb blas branding bzip2 cairo caps cdda cdr cli consolekit cracklib crypt cscope cups cxx dbus dri dts dvd dvdr emboss encode exif fam ffmpeg firefox flac fortran gdbm gif git gmp gnutls gpm graphviz gtk iconv icu idn imagemagick ipv6 jit jpeg lame lapack lcms libffi libnotify lm_sensors lzma mad maildir mmx mng modules mp3 mp4 mpeg multilib mysql ncurses nls nptl ogg openal opengl openmp pam pango pcre pdf php png policykit posix ppds pulseaudio qt3support qt4 readline sdl session smp spell sse sse2 sse3 sse4_1 ssl ssse3 startup-notification subversion svg tcpd threads tiff truetype udev udisks unicode upower usb v4l vim-syntax vorbis wxwidgets x264 xattr xcb xinerama xml xmp xv xvid zeroconf zlib" ABI_X86="64" 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" 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 author" 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 ublox ubx" INPUT_DEVICES="evdev joystick wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-minimizer" LINGUAS="en en_US en_GB fr fr_FR" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="x86_64 alpha arm i386 mips mips64 sparc sparc64" QEMU_USER_TARGETS="alpha arm i386 mips mips64 sparc sparc64 x86_64" RUBY_TARGETS="ruby20 ruby19" SANE_BACKENDS="epson epson2" USERLAND="GNU" VIDEO_CARDS="nvidia" 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"
Comment 1 Zhu Sha Zang 2014-09-03 01:02:36 UTC
Created attachment 384142 [details]

media-sound/moc-2.5.0 failing to compile here too.
Comment 2 Tomasz Golinski 2014-09-10 18:34:34 UTC
I reported the problem upstream. It turns out that at the moment it is difficult to fully migrate MOC to pkgconfig, since it is still optional and older versions of ncurses don't support it. 

Since workaround is simple maybe flag "-ltinfo" could be added at ebuild level?
Comment 3 Tim Harder gentoo-dev 2015-08-29 04:04:59 UTC
*** Bug 558716 has been marked as a duplicate of this bug. ***
Comment 4 Quentin Minster 2015-11-21 10:18:31 UTC
Created attachment 417492 [details, diff]

Here is a patch that adds detection in for missing cbreak symbol and tries to find it in libtinfo. Applying this patch fixes the build for me.

This patch has been proposed upstream:
Comment 5 David Seifert gentoo-dev 2016-01-27 23:23:29 UTC
While I sympathize with upstream and the fact that ncurses isn't forcibly installing the .pc files and instead keeping them optional, we in Gentoo can depend on them unconditionally. I've chosen the path of least resistance and just use pkg-config, well aware that the patch will not be upstreamable. Thanks for all your efforts though. I guess having a pkg-config code path within AX_WITH_CURSES would be the proper solution for everyone.

commit 3f0f37a8631c9ed6b863bbfe3ac13d57eafb145b
Author: David Seifert <>
Date:   Thu Jan 28 00:15:44 2016 +0100

    media-sound/moc: Use pkgconfig to detect sys-libs/ncurses flags
    Gentoo-Bug: 521860
    * EAPI=6
    * Remove .la files unconditionally