I don't know exactly what causes this issue, since I'm using a lot of unstable stuff in my toolchain, but I only noticed it when I switched to GCC 6.3.0. I've seen similar issues with other projects (such as Wine), but it's always pointed that it's about flex 2.6.3, and I have 2.6.1 installed. I wrote a patch that successfully builds the package, but I did not test if it functions properly. Reproducible: Always Actual Results: /bin/sh ../../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -I../../src/libipsec -include ../../src/include-glibc/glibc-bugs.h -I../../src/include-glibc -I../../src/include-glibc -march=ivybridge -O2 -pipe -flto=4 -fuse-linker-plugin -fno-fat-lto-objects -fgraphite-identity -floop-interchange -floop-strip-mine -floop-block -ftree-vectorize -Wall -Wno-unused ../libipsec/libipsec.la -Wl,-O1 -Wl,--as-needed -march=ivybridge -O2 -pipe -flto=4 -fuse-linker-plugin -fno-fat-lto-objects -fgraphite-identity -floop-interchange -floop-strip-mine -floop-block -ftree-vectorize -fno-delete-null-pointer-checks -flifetime-dse=1 -o setkey setkey.o parse.o token.o -lpam -lutil -lcrypto -lresolv -lreadline -lcrypt -lcrypt -L/lib -Wl,-R/lib -lpam libtool: link: x86_64-pc-linux-gnu-gcc -I../../src/libipsec -include ../../src/include-glibc/glibc-bugs.h -I../../src/include-glibc -I../../src/include-glibc -march=ivybridge -O2 -pipe -flto=4 -fuse-linker-plugin -fno-fat-lto-objects -fgraphite-identity -floop-interchange -floop-strip-mine -floop-block -ftree-vectorize -Wall -Wno-unused -Wl,-O1 -march=ivybridge -O2 -pipe -flto=4 -fuse-linker-plugin -fno-fat-lto-objects -fgraphite-identity -floop-interchange -floop-strip-mine -floop-block -ftree-vectorize -fno-delete-null-pointer-checks -flifetime-dse=1 -o setkey setkey.o parse.o token.o -Wl,-R/lib ../libipsec/.libs/libipsec.a -L/lib -Wl,--as-needed -lutil -lcrypto -lresolv -lreadline -lcrypt -lpam /var/tmp/portage/net-firewall/ipsec-tools-0.8.2-r5/temp/cc7E4I54.ltrans0.ltrans.o:<artificial>:function yyparse: error: undefined reference to 'yywrap' collect2: error: ld returned 1 exit status Makefile:465: recipe for target 'setkey' failed make[4]: *** [setkey] Error 1 make[4]: Leaving directory '/var/tmp/portage/net-firewall/ipsec-tools-0.8.2-r5/work/ipsec-tools-0.8.2/src/setkey' Makefile:378: recipe for target 'all' failed make[3]: *** [all] Error 2 make[3]: Leaving directory '/var/tmp/portage/net-firewall/ipsec-tools-0.8.2-r5/work/ipsec-tools-0.8.2/src/setkey' Makefile:363: recipe for target 'all-recursive' failed make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory '/var/tmp/portage/net-firewall/ipsec-tools-0.8.2-r5/work/ipsec-tools-0.8.2/src' Makefile:421: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/var/tmp/portage/net-firewall/ipsec-tools-0.8.2-r5/work/ipsec-tools-0.8.2' Makefile:347: recipe for target 'all' failed make: *** [all] Error 2 Portage 2.3.0 (python 2.7.12-final-0, !../../var/lib/layman/dantrell-gnome/profiles/default/amd64/3.22/extended, gcc-6.3.0, glibc-2.24, 4.8.17-gentoo x86_64) ================================================================= System uname: Linux-4.8.17-gentoo-x86_64-Intel-R-_Core-TM-_i7-3770K_CPU_@_3.50GHz-with-gentoo-2.3 KiB Mem: 16310124 total, 6768936 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Mon, 16 Jan 2017 12:02:18 +0000 sh bash 4.3_p48-r1 ld GNU gold (Gentoo 2.27 p1.0 2.27) 1.12 app-shells/bash: 4.3_p48-r1::gentoo dev-java/java-config: 2.2.0-r3::gentoo dev-lang/perl: 5.22.3_rc4::gentoo dev-lang/python: 2.7.12::gentoo, 3.4.5::gentoo dev-util/cmake: 3.6.3::gentoo dev-util/pkgconfig: 0.28-r2::gentoo sys-apps/baselayout: 2.3::gentoo sys-apps/openrc: 0.22.4::gentoo sys-apps/sandbox: 2.10-r1::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69::gentoo sys-devel/automake: 1.14.1::gentoo, 1.15::gentoo sys-devel/binutils: 2.27::gentoo sys-devel/gcc: 6.3.0::gentoo sys-devel/gcc-config: 1.7.3::gentoo sys-devel/libtool: 2.4.6-r2::gentoo sys-devel/make: 4.1-r1::gentoo sys-kernel/linux-headers: 4.8::gentoo (virtual/os-headers) sys-libs/glibc: 2.24::gentoo Repositories: gentoo location: /usr/portage sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo priority: -1000 saboya-overlay location: /usr/local/saboya-overlay sync-type: git sync-uri: https://github.com/saboya/saboya-overlay.git masters: gentoo hnaparst location: /var/lib/layman/hnaparst masters: gentoo priority: 50 steam-overlay location: /var/lib/layman/steam-overlay masters: gentoo priority: 50 sublime-text location: /var/lib/layman/sublime-text masters: gentoo priority: 50 dantrell-gnome-3-22 location: /var/lib/layman/dantrell-gnome-3-22 sync-type: laymansync sync-uri: https://github.com/dantrell/gentoo-overlay-dantrell-gnome-3-22.git masters: gentoo priority: 100 dantrell-gnome location: /var/lib/layman/dantrell-gnome sync-type: laymansync sync-uri: https://github.com/dantrell/gentoo-overlay-dantrell-gnome.git masters: gentoo priority: 150 Installed sets: @android, @basic-apps, @basic-apps-gui, @dev, @dev-gui, @dev-qogni, @eyecandy, @games, @gnome, @i3, @media, @requiredstuff, @systools ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=ivybridge -O2 -pipe -flto=4 -fuse-linker-plugin -fno-fat-lto-objects -fgraphite-identity -floop-interchange -floop-strip-mine -floop-block -ftree-vectorize" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/chromium/policies/managed/chrome-gnome-shell.json /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/opt/chrome/policies/managed/chrome-gnome-shell.json /etc/php/apache2-php7.1/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=ivybridge -O2 -pipe -flto=4 -fuse-linker-plugin -fno-fat-lto-objects -fgraphite-identity -floop-interchange -floop-strip-mine -floop-block -ftree-vectorize -fno-delete-null-pointer-checks -flifetime-dse=1" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--load-average=7" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-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" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -march=ivybridge -O2 -pipe -flto=4 -fuse-linker-plugin -fno-fat-lto-objects -fgraphite-identity -floop-interchange -floop-strip-mine -floop-block -ftree-vectorize -fno-delete-null-pointer-checks -flifetime-dse=1" MAKEOPTS="-j8" PKGDIR="/usr/portage/packages" 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 bash-completion berkdb bluetooth branding bzip2 cairo cdda cdr cli colord consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr eds encode evo exif fam flac fortran gdbm gif glamor gles gnome gnome-keyring gnome-online-accounts gpm gtk3 gtkstyle iconv infinality introspection ipv6 jpeg lcms libinput libnotify libsecret logrotate mad matroska mmx mmxext mng modules mp3 mp4 mpeg multilib nautilus ncurses nls nptl nvidia ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio readline sdl seccomp session spell sse sse2 ssl startup-notification svg tcpd theora tiff tracker truetype udev udisks unicode upower usb vdpau vorbis x264 xattr xcb xml xv xvid zlib" 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 avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" 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="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US pt_BR" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi spdy" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-0" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21" 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" Unset: CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Created attachment 460350 [details] build.log
Created attachment 460352 [details, diff] ipsec-tools-0.8.2-flex.patch
Other references to this issue: http://marc.info/?l=ipsec-tools-devel&m=139456539220987&w=2 https://patchwork.openembedded.org/patch/68177/
Created attachment 460642 [details, diff] ipsec-tools-0.8.2-no-libfl.patch
This usually happens because flex provides a function prototype for yywrap() but doesn't define it. So if the code doesn't provide a definition for yywrap() it fails to link. I'm not sure why you're hitting this though because yywrap() is defined in a couple of places. I wonder if gcc-6 is stricter in some way that it causes this. Do you have gcc-4 or -5 installed? If so, try leaving everything else the same and just switch between compilers and see if it makes a difference. I don't think this patch is right because, as I said, yywrap() is defined in a couple of places. Feeding flex %option noyywrap will kill the prototype and might fix the issue for you but break in genereal.
All of my toolchain is unstable, so it would be hard to isolate the problem I guess. GCC 6.3 + gold + glibc 2.24 + binutils 2.27 and using LTO / graphite. I don't have GCC4 / 5 anyway. Anyway, I just posted this patch because this issue surfaced for me when rebuilding with the aforementioned toolchain. I thought it might be indicative of something wrong and decided to dig around a bit, even found someone that wrote the same patches I did (for different reasons). But if you say the patch isn't correct, I believe you, just have no idea of what is actually wrong with my system :)
Hi, I also have this bug, with net-vpn/ipsec-tools-0.8.2-r7 and attached patch is resolving it. Here's a summary of my emerge --info : Portage 3.0.20 (python 3.9.5-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-11.1.0, glibc-2.33, 5.12.13-gentoo x86_64) ABI="amd64" ABI_X86="64" ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE" ACCEPT_PROPERTIES="*" ACCEPT_RESTRICT="*" CBUILD="x86_64-pc-linux-gnu" CCACHE_DIR="/var/cache/ccache" CFLAGS="-O2 -mtune=native -pipe -fomit-frame-pointer -ftree-vectorize -ftree-slp-vectorize -fno-semantic-interposition -falign-functions=32 -flto" CFLAGS_amd64="-m64" CFLAGS_x32="-mx32" CFLAGS_x86="-m32" CHOST="x86_64-pc-linux-gnu" CHOST_amd64="x86_64-pc-linux-gnu" CHOST_x32="x86_64-pc-linux-gnux32" CHOST_x86="i686-pc-linux-gnu" CXXFLAGS="-O2 -mtune=native -pipe -fomit-frame-pointer -ftree-vectorize -ftree-slp-vectorize -fno-semantic-interposition -falign-functions=32 -flto" GCC : 11.1.0-r1 Glibc : 2.33 sys-devel/flex : 2.6.4-r1
This package is masked for removal in 30 days.