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

Bug 592868

Summary: x11-libs/motif-2.3.6 unable to emerge: undefined reference to main
Product: Gentoo Linux Reporter: Fabio Coatti <fabio.coatti>
Component: Current packagesAssignee: Ulrich Müller <ulm>
Severity: normal CC: c.runge, petross404
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Attachments: build.log

Description Fabio Coatti 2016-09-04 14:00:48 UTC
Trying to emerge x11-libs/motif-2.3.6, I get the following error:
libtool: link: x86_64-pc-linux-gnu-gcc -O2 -fpie -fpic -pipe -march=native -fstack-protector-strong -flto=4 -fuse-linker-plugin -fno-strict-aliasing -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment -I/usr/include/freetype2 -Wl,-O1 -O2 -fpie -fpic -pipe -march=native -fstack-protector-strong -flto=4 -fuse-linker-plugin -o wmluiltok wmluiltok.o  -Wl,--as-needed -lfl
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [Makefile:495: wmluiltok] Error 1
make: Leaving directory '/var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6-abi_x86_32.x86/tools/wml'
 * ERROR: x11-libs/motif-2.3.6::gentoo failed (compile phase):
 *   emake failed

Note: I'm using LTO flag, however the error is the same also with that flag turned off.

Reproducible: Always
Comment 1 Fabio Coatti 2016-09-04 14:01:26 UTC
calvin ~ # emerge --info
Portage 2.3.0 (python 3.4.5-final-0, default/linux/amd64/13.0/desktop/plasma/systemd, gcc-5.4.0, glibc-2.23-r2, 4.7.2-cova x86_64)
System uname: Linux-4.7.2-cova-x86_64-Intel-R-_Core-TM-_i5-3427U_CPU_@_1.80GHz-with-gentoo-2.3
KiB Mem:     8089200 total,   2483616 free
KiB Swap:    8386556 total,   8206860 free
Timestamp of repository gentoo: Sun, 04 Sep 2016 13:30:01 +0000
sh bash 4.3_p46
ld ld di GNU (Gentoo 2.26.1 p1.0) 2.26.1
distcc[643] (dcc_mkdir) ERROR: mkdir '/var/tmp/portage/.distcc//state' failed: No such file or directory [disabled]
app-shells/bash:          4.3_p46::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.0-r1::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo, 3.5.2::gentoo
dev-util/cmake:           3.6.1-r1::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.21.7::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo, 2.26.1::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.4.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.7::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000

    location: /var/lib/layman/hacking-gentoo
    sync-type: laymansync
    sync-uri: rsync://
    masters: gentoo
    priority: 50

    location: /var/lib/layman/kde
    sync-type: laymansync
    sync-uri: git://
    masters: gentoo
    priority: 50

    location: /var/lib/layman/mv
    sync-type: laymansync
    sync-uri: git://
    masters: gentoo
    priority: 50

    location: /var/lib/layman/torbrowser
    sync-type: laymansync
    sync-uri: git://
    masters: gentoo
    priority: 50

    location: /usr/overlay
    masters: gentoo
    priority: 51

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -fpie -fpic -pipe -march=native -fstack-protector-strong -flto=4 -fuse-linker-plugin"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/apache2-php7.0/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/php/cli-php7.0/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="-O2 -fpie -fpic -pipe -march=native -fstack-protector-strong -flto=4 -fuse-linker-plugin"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -O2 -fpie -fpic -pipe -march=native -fstack-protector-strong -flto=4 -fuse-linker-plugin"
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 --exclude=/.git"
USE="3dnow 3dnowext 3dnowprefetch X \ a52 aac aalib acl acpi aim alsa amd64 apng ares asf ati audio audiofile avahi bash-completion berkdb bidi bl branding bri bzip2 cairo caps ccdda cdda cdr cjk cli cracklib crypt cups curl cxx dba dbus declarative device-mapper dga divx divx4linux dparanoia dri dts dv dvb dvd dvdr dvdread eap-sim edl egl emboss encode ethereal evdev exif expat faad fam fame fbcon ffmpeg fftw firefox flac force-cgi-redirect fortran ftp gallium garmin gd gdbm gif gimp glamor gles2 gmedia gmp gnutls gphoto2 gpm gps gsm gtk h264 h323 iconv icq icu idn ifp ilbc imagemagick imap innodb ipod iproute2 ipv6 ithreads jabber java javascript joystick jpeg kde kipi kontact kvm lastfm lcms ldap libcaca libnotify libvirtd live lm_sensors lua lvm lxc lzma lzo mad maildir matroska mbox mdnsresponder-compat mhash mime mjpeg mmap mmx mmxext mng modules mozdevelop mozilla mp3 mp4 mpeg msn mtp multilib mysql ncurses network networkmanager new-hpcups nfsv4 njb nls nptl nptlonly nsplugin offensive ofx ogg oggvorbis ogm openal openexr opengl openmp oscar pam pango parted pcap pcre pdf phonon php plasma plotutils png policykit ppds pulseaudio qemu qml qt3support qt4 qt5 readline real rtc ruby samba sasl sdl seccomp semantic-desktop semantic-destkop session sha512 sip slang slp smartcard sndfile snmp sox speex spell srt sse sse2 ssh ssl ssse3 startup-notification svg symlink systemd tcltk tcpd telepathy theora threads tiff tk tremor truetype udev udisks unicode upower usb utempter v4l v4l2 vaapi vcd vde vhosts video videos vim-syntax virt-network virtualbox vorbis wav webkit widgets wifi wimax wmf wmp wps wxwidgets wxwindows x264 xanim xattr xcb xcomposite xface xft xine xinerama xml xosd xpm xscreensaver xsl xulrunner xv xvid zeroconf zlib zpm" ABI_X86="64 32" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" DRACUT_MODULES="btrfs crypt crypt-gpg crypt-loop lvm plymouth systemd" 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 synaptics" KERNEL="linux" L10N="it en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="it en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4 python3_5" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby20 ruby21 ruby22 ruby23" USERLAND="GNU" VIDEO_CARDS="v4l" 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"
USE_PYTHON="2.7 3.4"
Comment 2 Fabio Coatti 2016-09-04 14:08:39 UTC
Created attachment 444954 [details]
Comment 3 Ulrich Müller gentoo-dev 2016-09-06 09:06:35 UTC
(In reply to Fabio Coatti from comment #1)
> CFLAGS="-O2 -fpie -fpic -pipe -march=native -fstack-protector-strong -flto=4
> -fuse-linker-plugin"

Try again with saner CFLAGS. I suspect the -flto causing the problems here.

*** This bug has been marked as a duplicate of bug 20600 ***
Comment 4 Fabio Coatti 2016-09-06 09:27:05 UTC
I'm not really sure that this is the explanation. Maybe you overlooked the bug report where I stated that without LTO the behaviour is the same.
However, I tried again with the following cflags:

CFLAGS="-O2 -pipe -march=native"                      
LDFLAGS="-Wl,--as-needed -O2 -pipe -march=native"

and the error is the same:

>>> Compiling source in /var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6 ...
 * abi_x86_32.x86: running multilib-minimal_abi_src_compile
make -j4 -C tools/wml CC=x86_64-pc-linux-gnu-gcc LIBS=-lfl wmluiltok 
make: Entering directory '/var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6-abi_x86_32.x86/tools/wml'
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6/tools/wml -I../../include -I../../lib/Xm -I../../lib -I/var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6/tools/wml/../../lib -I/var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6/tools/wml/../../include    -I/usr/include/freetype2  -O2 -pipe -march=native -fno-strict-aliasing -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment -I/usr/include/freetype2   -c -o wmluiltok.o /var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6/tools/wml/wmluiltok.c
/bin/sh ../../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc  -O2 -pipe -march=native -fno-strict-aliasing -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment -I/usr/include/freetype2    -Wl,--as-needed -O2 -pipe -march=native -o wmluiltok wmluiltok.o  -lfl
libtool: link: x86_64-pc-linux-gnu-gcc -O2 -pipe -march=native -fno-strict-aliasing -Wall -g -fno-strict-aliasing -Wno-unused -Wno-comment -I/usr/include/freetype2 -O2 -pipe -march=native -o wmluiltok wmluiltok.o  -Wl,--as-needed -lfl
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [Makefile:495: wmluiltok] Error 1
make: Leaving directory '/var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6-abi_x86_32.x86/tools/wml'
 * ERROR: x11-libs/motif-2.3.6::gentoo failed (compile phase):
 *   emake failed
 * If you need support, post the output of `emerge --info '=x11-libs/motif-2.3.6::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=x11-libs/motif-2.3.6::gentoo'`.
 * The complete build log is located at '/var/log/portage/x11-libs:motif-2.3.6:20160906-092022.log'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/x11-libs/motif-2.3.6/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/x11-libs/motif-2.3.6/temp/environment'.
 * Working directory: '/var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6-abi_x86_32.x86'
 * S: '/var/tmp/portage/x11-libs/motif-2.3.6/work/motif-2.3.6'

That said, I'm not really sure that the issue can be considered a duplicate of 20600
Comment 5 Ulrich Müller gentoo-dev 2016-09-06 09:47:44 UTC
(In reply to Fabio Coatti from comment #4)
> However, I tried again with the following cflags:
> CFLAGS="-O2 -pipe -march=native"                      
> CXXFLAGS="${CFLAGS}"                                                        
> LDFLAGS="-Wl,--as-needed -O2 -pipe -march=native"

Was sys-devel/flex compiled with these flags, too? Note that wmluiltok takes its main() from libfl.a.
Comment 6 Fabio Coatti 2016-09-06 10:34:06 UTC
You're perfectly right, I didn't looked at flex! Adding a simple -ffat-lto-objects to flex compilation flags fixed the issue, allwoing to use lto also on motif.

Many thanks for the suggestion!
Comment 7 Ulrich Müller gentoo-dev 2016-09-06 10:48:23 UTC
On the long term, we probably should have better LTO support, so this may be a valid issue.

However, I think there is nothing that can be fixed in the x11-libs/motif package, therefore resolving as CANTFIX.
Comment 8 Ulrich Müller gentoo-dev 2017-04-25 10:57:02 UTC
*** Bug 616106 has been marked as a duplicate of this bug. ***
Comment 9 Ulrich Müller gentoo-dev 2019-02-28 16:54:13 UTC
*** Bug 678938 has been marked as a duplicate of this bug. ***