Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 583084 - sys-process/at: building flex w/LTO breaks the build: emake failed: lex.yy.c:(.text+0x10c9): undefined reference to `yywrap'
Summary: sys-process/at: building flex w/LTO breaks the build: emake failed: lex.yy.c:...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Lars Wendler (Polynomial-C)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2016-05-15 09:53 UTC by tokiclover
Modified: 2019-03-29 13:04 UTC (History)
4 users (show)

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


Attachments
build.log (build.log,44.07 KB, text/x-log)
2016-05-18 19:16 UTC, tokiclover
Details
at-yywrap-lex.yy.c.patch (at-3.1.20-yywrap-lex.yy.c.patch,354 bytes, patch)
2016-11-02 09:38 UTC, tokiclover
Details | Diff
output of readelf -sW /usr/lib*/libfl*.a (readelf.txt,5.12 KB, text/plain)
2017-03-19 13:55 UTC, Markus Oehme
Details
build log of flex (flex-2.6.3:20170318-174947.log,1.23 KB, text/x-log)
2017-03-19 13:56 UTC, Markus Oehme
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tokiclover 2016-05-15 09:53:53 UTC
Compilation failure due to an undefined reference to a function.

---
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o atd atd.o daemon.o   -lpam
x86_64-pc-linux-gnu-gcc -Wl,-O1 -Wl,--as-needed -o at at.o panic.o perm.o posixtm.o y.tab.o lex.yy.o
lex.yy.o: In function `yylex':
lex.yy.c:(.text+0x10c9): undefined reference to `yywrap'
collect2: error: ld returned 1 exit status
Makefile:74: recipe for target 'at' failed
---

Simple (?) linking issue. I have flex installed et al... but I don't remember what to do in type of case (compiled at hand a little parser wich has lex).

What to do? to provide?
Comment 1 Coacher 2016-05-18 10:37:21 UTC
Please attach complete build.log and the output of `emerge --info sys-process/at'
Comment 2 tokiclover 2016-05-18 19:12:55 UTC
emerge --info
---
Portage 2.2.28 (python 2.7.11-final-0, hardened/linux/amd64, gcc-4.9.3, glibc-2.22-r3, 4.4.6-git x86_64)
=================================================================
System uname: Linux-4.4.6-git-x86_64-Intel-R-_Core-TM-_i7-4700HQ_CPU_@_2.40GHz-with-gentoo-2.2
KiB Mem:    16375692 total,  13880808 free
KiB Swap:     524284 total,    147036 free
Timestamp of repository gentoo: Mon, 04 Apr 2016 09:23:36 +0000
sh bash 4.4_rc1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.4_rc1::gentoo
dev-lang/perl:            5.22.1::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo, 3.5.1-r2::gentoo
dev-util/cmake:           3.5.1::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r3::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: git://github.com/gentoo-mirror/gentoo.git
    priority: -1000

bar
    location: /var/db/repos/bar
    sync-type: git
    sync-uri: git://github.com/tokiclover/bar-overlay.git
    masters: gentoo

mpd
    location: /var/db/repos/mpd
    sync-type: git
    sync-uri: git://git.musicpd.org/master/mpd-gentoo-overlay.git
    masters: gentoo

multimedia
    location: /var/db/repos/multimedia
    sync-type: git
    sync-uri: git://github.org/gentoo/multimedia.git
    masters: gentoo

x11
    location: /var/db/repos/x11
    sync-type: git
    sync-uri: git://git.overlays.gentoo.org/proj/x11.git
    masters: gentoo

Installed sets: @Mail-Utils, @VapourSynth-Plugins, @X, @archive, @daw, @fonts, @gtk, @multimedia, @openbox, @portage, @sys, @the
mes, @vim
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize -flt
o=8 -fuse-linker-plugin"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release
/etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/te
xmf/web2c"
CXXFLAGS="-O2 -march=native -pipe -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize -f
lto=8 -fuse-linker-plugin"
DISTDIR="/var/src"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg cgroup config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync new
s parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch
 userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ ftp://mirror.ovh.net/gentoo-distfiles/ http://gentoo.mneisen.org/ ftp:
//mirror.mdfnet.se/gentoo"
INSTALL_MASK="/etc/systemd /lib*/systemd /usr/lib*/systemd"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -flto=8 -fuse-linker-plugin"
MAKEOPTS="-j8"
PKGDIR="/var/pkg"
PORTAGE_CONFIGROOT="/"
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"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 atlas audiofile avi berkdb blas bzip2 cairo caps cdda cddb cdio cdr cjk clang cleartype cli cracklib crypt css cups curl cxx dbus device-mapper directfb djvu dri dv dvd dvdr egl exif expat fbcon ffmpeg fftw flac fltk fontconfig fontforge ftp gd gdbm gif git glamor gles2 glut gpm graphite graphviz gtk gtk2 gzip hardened hddtemp iconv icu idn ieee1394 imagemagick imlib infinality ipv6 jack jbig jpeg jpeg2k justify kerberos ladspa lame lapack lash lcms libass libnotify libsamplerate lm_sensors lto lua luajit lz4 lzma lzo lzop mad matroska mbox mmx mmxext mng modplug modules mp3 mp4 mpeg multilib musepack ncurses nls nptl nsplugin ntp ogg opengl openldap openmp openssl oss pam pax_kernel pcre pdf perl pie png postscript python raw readline sasl savedconfig seccomp session smp sndfile snmp sockets sqlite sse sse2 ssl ssp startup-notification svg symlink tcpd theora threads tiff truetype udev unicode urandom usb vaapi vdpau vim vim-syntax vorbis wavpack wayland wifi x264 xattr xft xinerama xinetd xml xorg xtpax xv xvid xvmc xz zip zlib" ABI_X86="64" ALSA_CARDS="cmipci hda-intel usb-audio" 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="avx avx2 mmx mmxext sse sse2 sse3 ssse3 sse4_1 sse4_2" 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" GRUB_PLATFORMS="emu efi-32 efi-64 qemu pc" INPUT_DEVICES="evdev mouse keyboard synaptics vmmouse" KERNEL="linux" LCD_DEVICES="lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en fr" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_SOFTMMU_TARGETS="aarch64 arm i386 ppc ppc64 sparc sparc64 s390x x86_64" QEMU_USER_TARGETS="aarch64 arm i386 ppc ppc64 sparc sparc64 s390x x86_64" RUBY_TARGETS="ruby22" SANE_BACKENDS="canon canon630u canon_pp canon_dr genesys net pixma" USERLAND="GNU" VIDEO_CARDS="intel i915 i965 nouveau vesa vmware" XTABLES_ADDONS="ipv4options ipset iface ipmark dhcpmac"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
---
Comment 3 tokiclover 2016-05-18 19:16:44 UTC
Created attachment 434638 [details]
build.log
Comment 4 tokiclover 2016-05-18 19:32:23 UTC
emerge --info sys-process/at has some interesting lines at the end:
---
sys-process/at-3.1.16::gentoo was built with the following:
USE="pam (-selinux)" ABI_X86="64"
CFLAGS="-O2 -march=native -pipe -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize"
CXXFLAGS="-O2 -march=native -pipe -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -ftree-vectorize"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-fuse-ld=bfd"
---
No LTO related flags compared to default FLAGS.
Comment 5 Jiří Moravec 2016-08-11 14:20:50 UTC
I encountered identical problem. My solution was emerge 'sys-devel/flex' package with '-fno-lto -fno-use-linker-plugin' flags. Then problem disappeared even when 'sys-process/at' was merged with '-flto -fno-fat-lto-objects' flags.
Comment 6 tokiclover 2016-11-02 09:36:00 UTC
(In reply to Jiří Moravec from comment #5)
> I encountered identical problem. My solution was emerge 'sys-devel/flex'
> package with '-fno-lto -fno-use-linker-plugin' flags. Then problem
> disappeared even when 'sys-process/at' was merged with '-flto
> -fno-fat-lto-objects' flags.

That's annoying because flex is built with LTO... however flex has only /usr/lib/libfl{,_pic}.a--archive the and DSO (dynamically shared object). So, it should work? yes it should!

I've just investigated this and the following patch resolve the issue even when compiling at with LTO flags.
Comment 7 tokiclover 2016-11-02 09:38:22 UTC
Created attachment 452152 [details, diff]
at-yywrap-lex.yy.c.patch

Compile fine when flex is copiled with LTO flags... and even at.
Comment 8 SpanKY gentoo-dev 2016-11-15 04:38:40 UTC
Comment on attachment 452152 [details, diff]
at-yywrap-lex.yy.c.patch

this isn't the right route to go.  libfl.a should have a libyywrap.o, and it should be exporting a yywrap symbol.  if it's not, then focus on that rather than the at package.

please attach the build log for flex and the output of:
  readelf -sW /usr/lib*/libfl*.a
Comment 9 Markus Oehme 2017-03-19 13:55:12 UTC
Created attachment 467560 [details]
output of readelf -sW /usr/lib*/libfl*.a

I have the same problem on an ~amd64 machine with gcc-6.3.0.
Comment 10 Markus Oehme 2017-03-19 13:56:34 UTC
Created attachment 467562 [details]
build log of flex

Here are the requested pieces of information.

For me rebuilding flex without lto also solved the problem.