Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 604848 - dev-lang/c-intercal-30.0 with sys-devel/flex-2.6.3: lexer.c:(.text+<snip>): undefined reference to `yywrap'
Summary: dev-lang/c-intercal-30.0 with sys-devel/flex-2.6.3: lexer.c:(.text+<snip>): u...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ulrich Müller
URL:
Whiteboard:
Keywords: PATCH, UPSTREAM
Depends on:
Blocks: flex-2.6.2
  Show dependency tree
 
Reported: 2017-01-06 16:55 UTC by Toralf Förster
Modified: 2017-11-14 02:28 UTC (History)
3 users (show)

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


Attachments
config.log (config.log,86.36 KB, text/plain)
2017-01-06 16:55 UTC, Toralf Förster
Details
dev-lang:c-intercal-30.0:20170106-160518.log (dev-lang:c-intercal-30.0:20170106-160518.log,21.33 KB, text/plain)
2017-01-06 16:55 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,344.08 KB, text/plain)
2017-01-06 16:55 UTC, Toralf Förster
Details
environment (environment,75.86 KB, text/plain)
2017-01-06 16:55 UTC, Toralf Förster
Details
etc.portage.tbz2 (etc.portage.tbz2,22.17 KB, application/x-bzip)
2017-01-06 16:55 UTC, Toralf Förster
Details
Partially revert flex commit 347652c32b4614995acd4ee0d686499da2070d9e (347652c32b4614995acd4ee0d686499da2070d9e.patch,462 bytes, patch)
2017-01-07 16:20 UTC, Ulrich Müller
Details | Diff
c-intercal-0.30-flex-2.6.3-compatibility-fix.patch (c-intercal-fix.patch,1.69 KB, patch)
2017-01-08 15:08 UTC, nvinson234
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2017-01-06 16:55:12 UTC
x86_64-pc-linux-gnu-gcc '-DICKINCLUDEDIR="/usr/include/ick-0.30"' '-DICKDATADIR="/usr/share/ick-0.30"' '-DICKBINDIR="/usr/bin"' '-DICKLIBDIR="/usr/lib64"' -DYYDEBUG -DICK_HAVE_STDINT_H=1 -O2 -pipe -march=native -Wall  -Wl,-O1 -Wl,--as-needed -o ick src/feh2.o src/dekludge.o src/ick_lose.o src/fiddle.o src/perpet.o src/uncommon.o parser.o lexer.o libidiot.a 
lexer.o: In function `yylex':
lexer.c:(.text+0x14aa): undefined reference to `yywrap'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:740: ick] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-lang/c-intercal-30.0/work/intercal-0.30'

  -----------------------------------------------------------------

  This is an unstable amd64 chroot image (named desktop-libressl-unstable_20161230-194738) at a hardened host acting as a tinderbox.

  -----------------------------------------------------------------
  from make.conf:
USE="  -openssl -gnutls libressl pax_kernel xtpax -cdinstall -oci8 -bindist ssp avformat -bugzilla dvb -dvd eglfs -evdev ffmpeg fitz fluidsynth gles libinput logrotate -lvm melt mp3 mysql mysqli plasma -pypy secure-delete traceroute uxa vim x265 xvfb xvmc"

gcc-config -l:
 [1] x86_64-pc-linux-gnu-5.4.0 *
llvm-config --version:
3.9.1
Available Java Virtual Machines:
  [1]   icedtea-bin-7  system-vm
  [2]   icedtea-bin-8 
Available Python interpreters, in order of preference:
  [1]   python3.4
  [2]   python3.5 (fallback)
  [3]   python2.7 (fallback)
  [4]   jython2.7 (fallback)

java-config:
The following VMs are available for generation-2:
*)	IcedTea JDK 7.2.6.8 [icedtea-bin-7]
2)	IcedTea JDK 3.2.0 [icedtea-bin-8]
  -----------------------------------------------------------------



$ cat emerge-info.txt
Portage 2.3.3 (python 3.4.5-final-0, default/linux/amd64/13.0/desktop, gcc-5.4.0, glibc-2.24, 4.8.15-hardened x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.8.15-hardened-x86_64-Intel-R-_Core-TM-_i7-3930K_CPU_@_3.20GHz-with-gentoo-2.3
KiB Mem:    65285560 total,   6453080 free
KiB Swap:   67108860 total,  67087916 free
Timestamp of repository gentoo: Fri, 06 Jan 2017 13:42:55 +0000
sh bash 4.4_p5-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.4_p5-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo, 3.5.2::gentoo
dev-util/cmake:           3.7.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.23.1::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.9.6-r4::gentoo, 1.10.3-r2::gentoo, 1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo, 2.27::gentoo
sys-devel/gcc:            5.4.0-r2::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.9::gentoo (virtual/os-headers)
sys-libs/glibc:           2.24::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: 1

tinderbox
    location: /tmp/tb/data/portage
    masters: gentoo
    priority: 2

local
    location: /usr/local/portage
    masters: gentoo
    priority: 99

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -Wall"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/omega.conf /opt/openfire/resources/security/ /usr/lib64/fax /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.3/conf /var/lib/hsqldb /var/rancid/.cloginrc /var/spool/fax/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /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/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/var/tmp/distfiles"
EMERGE_DEFAULT_OPTS="--verbose --verbose-conflicts --color=n --nospinner --tree --quiet-build"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox parallel-fetch preserve-libs protect-owned sandbox sfperms strict test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.uni-erlangen.de/pub/mirrors/gentoo rsync://mirror.netcologne.de/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gor.bytemark.co.uk/gentoo/ rsync://ftp.snt.utwente.nl/gentoo"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j1"
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 avformat berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvb dvdr eglfs emboss encode exif fam ffmpeg firefox fitz flac fluidsynth fortran gdbm gif glamor gles gpm gtk iconv ipv6 jpeg lcms ldap libinput libnotify libressl logrotate mad melt mmx mmxext mng modules mp3 mp4 mpeg multilib mysql mysqli ncurses nls nptl ogg opengl openmp pam pango pax_kernel pcre pdf plasma png policykit ppds qt3support qt4 readline sdl seccomp secure-delete session spell sse sse2 ssl ssp startup-notification svg tcpd tiff traceroute truetype udev udisks unicode upower usb uxa vim vorbis wxwidgets x264 x265 xattr xcb xml xtpax xv xvfb xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="hda-intel" 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" CURL_SSL="libressl" 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="brx de-1901 pt-PT zh-TW" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="intel i965" 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
Comment 1 Toralf Förster gentoo-dev 2017-01-06 16:55:18 UTC
Created attachment 458958 [details]
config.log
Comment 2 Toralf Förster gentoo-dev 2017-01-06 16:55:20 UTC
Created attachment 458960 [details]
dev-lang:c-intercal-30.0:20170106-160518.log
Comment 3 Toralf Förster gentoo-dev 2017-01-06 16:55:25 UTC
Created attachment 458962 [details]
emerge-history.txt
Comment 4 Toralf Förster gentoo-dev 2017-01-06 16:55:28 UTC
Created attachment 458964 [details]
environment
Comment 5 Toralf Förster gentoo-dev 2017-01-06 16:55:31 UTC
Created attachment 458966 [details]
etc.portage.tbz2
Comment 6 Ulrich Müller gentoo-dev 2017-01-07 15:48:10 UTC
This is caused by flex-2.6.3 which now puts a bunch of redundant looking macros into the lexer:

    #define yy_create_buffer yy_create_buffer
    #define yy_delete_buffer yy_delete_buffer
    #define yy_scan_buffer yy_scan_buffer
    [...]
    #define yywrap yywrap
    [...]

This breaks definition of the yywrap() stub in c-intercal's src/lexer.l:

#ifndef yywrap
static int yywrap(void)
{
    return 1;
}
#endif /* yywrap */
Comment 7 George Diamantopoulos 2017-01-07 16:16:14 UTC
This also affects media-libs/nas. Downgrading flex to 2.6.1 works around this issue.
Comment 8 Ulrich Müller gentoo-dev 2017-01-07 16:20:11 UTC
Created attachment 459068 [details, diff]
Partially revert flex commit 347652c32b4614995acd4ee0d686499da2070d9e

Reverting the changes to flex.skl from upstream commit https://github.com/westes/flex/commit/347652c32b4614995acd4ee0d686499da2070d9e fixes the problem with c-intercal compilation.

See attached patch.
Comment 9 nvinson234 2017-01-07 21:20:26 UTC
(In reply to Ulrich Müller from comment #6)
> This is caused by flex-2.6.3 which now puts a bunch of redundant looking
> macros into the lexer:

Those macros exist to allow flex's prefix functionality to work without relying on m4_macros.  Apparently there was a security risk in using m4 macros for this purpose.


> This breaks definition of the yywrap() stub in c-intercal's src/lexer.l:
> 
> #ifndef yywrap
> static int yywrap(void)
> {
>     return 1;
> }
> #endif /* yywrap */

The changes in flex-2.6.3 actually bring it closer to standards compliance (i.e. it no longer uses the yymacro to control lexer behavior), so a simplistic change would be to remove the ifndef yywrap check.  That said, if flex is the only lexer supported by upstream, I would recommend updating the file to use the noyywrap flex option.

(In reply to Ulrich Müller from comment #8)
> Created attachment 459068 [details, diff] [edetails, diff]
> Partially revert flex commit 347652c32b4614995acd4ee0d686499da2070d9e
> 
> Reverting the changes to flex.skl from upstream commit
> https://github.com/westes/flex/commit/
> 347652c32b4614995acd4ee0d686499da2070d9e fixes the problem with c-intercal
> compilation.
> 
> See attached patch.

I'm not sure reverting the change in flex is a good idea.  This is mainly because I think flex upstream would reject the patch, so Gentoo would have to maintain this change, or fix packages such as this one in order to remove it.  That said, if flex upstream does accept that patch, this argument is moot.
Comment 10 nvinson234 2017-01-07 21:21:26 UTC
(In reply to George Diamantopoulos from comment #7)
> This also affects media-libs/nas. Downgrading flex to 2.6.1 works around
> this issue.

If one hasn't been filed already, could you file a separate bug for this and have it block bug 598186?
Comment 11 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2017-01-07 22:01:12 UTC
(In reply to Ulrich Müller from comment #8)
> Created attachment 459068 [details, diff] [details, diff]
> Partially revert flex commit 347652c32b4614995acd4ee0d686499da2070d9e
> 
> Reverting the changes to flex.skl from upstream commit
> https://github.com/westes/flex/commit/
> 347652c32b4614995acd4ee0d686499da2070d9e fixes the problem with c-intercal
> compilation.
> 
> See attached patch.

Not gonna happen. Either convince flex upstream to revert this or fix the broken package which should be preferred here.
Comment 12 Ulrich Müller gentoo-dev 2017-01-07 23:06:14 UTC
(In reply to nvinson234 from comment #9)
> (In reply to Ulrich Müller from comment #6)
> > This is caused by flex-2.6.3 which now puts a bunch of redundant looking
> > macros into the lexer:
> 
> Those macros exist to allow flex's prefix functionality to work without
> relying on m4_macros.

Please explain what would be the purpose of a line like this:

#define yywrap yywrap
Comment 13 Ulrich Müller gentoo-dev 2017-01-07 23:11:29 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #11)

I'm not saying that the revert should be necessarily applied, but just pinpointing the issue to a specific upstream commit.
Comment 14 nvinson234 2017-01-08 02:53:57 UTC
(In reply to Ulrich Müller from comment #12)
> (In reply to nvinson234 from comment #9)
> > (In reply to Ulrich Müller from comment #6)
> > > This is caused by flex-2.6.3 which now puts a bunch of redundant looking
> > > macros into the lexer:
> > 
> > Those macros exist to allow flex's prefix functionality to work without
> > relying on m4_macros.
> 
> Please explain what would be the purpose of a line like this:
> 
> #define yywrap yywrap

It's how flex implemented its multiple parser feature in 2.6.3.  With flex (and bison) you can specify your own prefix to replace the standard yy one.  If you do that in 2.6.3, those macros should change so that the second yywrap is replaced with the chosen prefix instead.  For example, tell flex-2.6.3 you want the prefix to be zz and you should see:

#define yywrap zzwrap

versions prior to 2.6.2 used m4 macros instead of CPP macros to do the job.  The rationale for doing it this way is that it lets you use the standard yy prefix in flex and bison files unconditionally. I.E. regardless of what the real prefix is, yywrap() is yywrap() inside the flex and bison files.

In the specific case of

#define yywrap yywrap

there's no real purpose for it.  It looks like flex doesn't check what the prefix is before emitting those macros.  Otherwise, it could skip creating them when the desired prefix is 'yy'.
Comment 15 nvinson234 2017-01-08 15:08:14 UTC
Created attachment 459172 [details, diff]
c-intercal-0.30-flex-2.6.3-compatibility-fix.patch

A proposed fix for c-intercal.  Please note that this has not been submitted upstream.
Comment 16 Ulrich Müller gentoo-dev 2017-01-08 17:20:29 UTC
(In reply to nvinson234 from comment #15)
> Please note that this has not been submitted upstream.

Please do so, since the problem isn't specific to Gentoo.
Comment 17 nvinson234 2017-01-08 22:06:58 UTC
merge requested: https://gitlab.com/esr/intercal/merge_requests/2
Comment 18 Matt Turner gentoo-dev 2017-10-24 04:17:53 UTC
The patch was accepted upstream 9 months ago. Hope we're not waiting on a release...
Comment 19 Ulrich Müller gentoo-dev 2017-10-24 07:05:02 UTC
(In reply to Matt Turner from comment #18)
> The patch was accepted upstream 9 months ago. Hope we're not waiting on a
> release...

In fact, I am. What is the problem with keeping this bug open until then?
Comment 20 Matt Turner gentoo-dev 2017-10-24 07:51:32 UTC
(In reply to Ulrich Müller from comment #19)
> (In reply to Matt Turner from comment #18)
> > The patch was accepted upstream 9 months ago. Hope we're not waiting on a
> > release...
> 
> In fact, I am. What is the problem with keeping this bug open until then?

flex-2.6.4 is being stabilized in bug 632523, which will not work with c-intercal. Since the patch was accepted upstream 9 months ago, there has been no further activity so it seems unlikely that without some prompting a release will appear -- especially so when the flex fix is the only meaningful commit on the master branch since v0.30.
Comment 21 Ulrich Müller gentoo-dev 2017-10-24 09:56:39 UTC
(In reply to Matt Turner from comment #20)
> > In fact, I am. What is the problem with keeping this bug open until then?
> 
> flex-2.6.4 is being stabilized in bug 632523, which will not work with
> c-intercal.

But it does work (is does so here, at least). A local workaround is in place, of course: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a3bea69c7abcaf29a587df887d7d78e43cb8cc4

> Since the patch was accepted upstream 9 months ago, there has been no
> further activity so it seems unlikely that without some prompting a
> release will appear -- especially so when the flex fix is the only
> meaningful commit on the master branch since v0.30.

Feel free to resolve as UPST then.