Tools/bison/lib/fseterr.c build problems on 18.06.0 due to glibc 2.28 changes

I'm building my own firmware, but starting from 18.06.0 I get errors.
Building for 18.06.rc1 with similar configuration was ok (the same host was building).
After git pull to newest 18.06 branch ( remotes/upstream/openwrt-18.06 1fe7a17aed ath25: Do not build images for ubnt2 and ubnt5) I get compilation errors as below. I did make dirclean, make defconfig, feeds update -a before, but no success.

Any suggestions?

gcc    -I. -I./lib -I. -I./lib -I/flower/openwrt.git/staging_dir/host/include   -O2 -I/flower/openwrt.git/staging_dir/host/include  -MT lib/fseterr.o -MD -MP -MF $depbase.Tpo -c -o lib/fseterr.o lib/fseterr.c &&\
mv -f $depbase.Tpo $depbase.Po
lib/fseterr.c: In function 'fseterr':
lib/fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
  #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
make[6]: *** [Makefile:3461: lib/fseterr.o] Error 1
make[6]: Leaving directory '/flower/openwrt.git/build_dir/host/bison-3.0.4'
make[5]: *** [Makefile:4522: all-recursive] Error 1
make[5]: Leaving directory '/flower/openwrt.git/build_dir/host/bison-3.0.4'
make[4]: *** [Makefile:2625: all] Error 2
make[4]: Leaving directory '/flower/openwrt.git/build_dir/host/bison-3.0.4'
make[3]: *** [Makefile:31: /flower/openwrt.git/build_dir/host/bison-3.0.4/.built] Error 2
make[3]: Leaving directory '/flower/openwrt.git/tools/bison'
Command exited with non-zero status 2
time: tools/bison/compile#10.81#1.10#11.93
make[2]: *** [tools/Makefile:154: tools/bison/compile] Error 2
make[2]: Leaving directory '/flower/openwrt.git'
make[1]: *** [tools/Makefile:150: /flower/openwrt.git/staging_dir/target-mipsel_24kc_musl/stamp/.tools_compile_yynyyyyynyyyyynyynyyyyynyyyyyyyyyyyyyyynyynynnyyynnyy] Error 2
make[1]: Leaving directory '/flower/openwrt.git'
make: *** [/flower/openwrt.git/include/ world] Error 2```
1 Like

We need to patch bison with below patch to allow it compile on glibc 2.28 systems.

What would be best/easiest way to submit this fix?

(rdslw@black) (beewrt-18.06) /flower/openwrt.git :) cat tools/bison/patches/110-glibc-change-work-around.patch
Subject: Workaround change in glibc

Temporary workaround to compile with glibc 2.28, which
deprecated some constants

Based on the workaround made for the tools/m4 package

--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -18,6 +18,12 @@
    the same implementation of stdio extension API, except that some fields
    have different naming conventions, or their access requires some casts.  */

+/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
+   problem by defining it ourselves.  FIXME: Do not rely on glibc
+   internals.  */
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
+# define _IO_IN_BACKUP 0x100

 /* BSD stdio derived implementations.  */

--- a/lib/fseterr.c
+++ b/lib/fseterr.c
@@ -29,7 +29,7 @@
   /* Most systems provide FILE as a struct and the necessary bitmask in
      <stdio.h>, because they need it for implementing getc() and putc() as
      fast macros.  */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
   fp->_flags |= _IO_ERR_SEEN;
 #elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
   fp_->_flags |= __SERR;

Patches can be submitted as a pull request on Github or via the mailing list.

1 Like

Submitted (my first openwrt :slight_smile: ) pull request at:

I consider it important as this bug stops openwrt builds on any rolling release distro using glibc 2.28 (archlinux, fedora, gentoo ~x86 and others).

I tested it also on openwrt-18.06 branch, as this is simple patch based on already committed caebb77b4570445f0172edf1a14dbe780c9dd44d or 8ae84899865ea14ce9d55cffa5de5ddd7167c680

1 Like

I there a way to patch the 18.06 branch? Getting this error on latest Ubuntu too (for some weeks).

If you compile your openwrt than yes, you should be able to use patch from pull request.

Patch currently is for older version of bison.

Master has already bison 3.1, so you might also test simply copying the current tools/bison Makefile and patches from master to your 18.06. It may work.

bison 3.1 should include gnulib 2018-08-23 that already contains a fix from March 2018 for that glibc 2.28 change.

Not sure if it works for you, but you might test it.

Actually, editing will be easy, as the only actual change in the 3.1 version bump is in Makefile to PKG_VERSION and PKG_HASH lines. There are also cosmetic changes to the patches, but you can ignore those.

Ps. I have been compiling my 18.06 builds with Ubuntu 18.10 and I have not seen those errors. (I naturally build from the current 18.06 HEAD instead of the old v18.06.0 or 18.06.1 tags.)

I see, you skip

  git fetch --tags
  git checkout v18.06.1

I will give it a try. Never thought to build the latest version of the branch being developed.


Master is the development branch.

18.06 is not being developed.

18.06 is the stable branch that only gets bug fixes etc. Its head is usually quite stable and safe.

18.06.1 is the already old release and 18.06 branch head contains the later fixes.

yeah, I now try to build with git clone -b openwrt-18.06 --single-branch and no checkout of any tags.
Does this contain the bison fix mentioned above?

Look for yourself from the 18.06 source, in the tools directory:;a=history;f=tools;hb=refs/heads/openwrt-18.06

18.06.1 was tagged on Aug 16th, while bison 3.0.5 was backported to 18.06 a few days later, on Aug 21st.
Currently 18.06 branch still has bison 3.0.5 (that I have compiled ok in Ubuntu 18.10 buildhost).

So, possibly 18.06 head will work for you, too.

If it doesn't, manually pick up the more recent version bumps from master and backport that to your own personal 18.06 repo.

(master has had already bison 3.1 and yesterday my patch to bump it into 3.2 was accepted and now master has already bison 3.2)

yes, building the latest openwrt-18.06 --single-branch works. Good hint, thanks!
But is this one more stable than the Master? Maybe a bit more...?


gh pr checkout 1290

help me alot