Unable to build tag v18.06.1 (fseterr.c)

I'm able to build master and HEAD from the 18.06 branch, but if I try to checkout the v18.06.1 tag and build it I'm getting the following errors:

make[3] -C tools/mpc compile
make -r world: build failed. Please re-run make with -j1 V=s to see what's going on
make: *** [/home/algebro/software/openwrt/include/toplevel.mk:218: world] Error 1

with make -j1 V=s:

make[3]: Entering directory '/home/algebro/software/openwrt/tools/bison'
. /home/algebro/software/openwrt/include/shell.sh; xzcat /home/algebro/software/openwrt/dl/bison-3.0.5.tar.xz | tar -C /home/algebro/software/openwrt/build_dir/host/bison-3.0.5/.. -xf - 
[ ! -d ./src/ ] || cp -fpR ./src/* /home/algebro/software/openwrt/build_dir/host/bison-3.0.5

Applying ./patches/001-fix-macos-vasnprintf.patch using plaintext: 
patching file lib/vasnprintf.c
Hunk #1 FAILED at 4858.
Hunk #2 FAILED at 4872.
2 out of 2 hunks FAILED -- saving rejects to file lib/vasnprintf.c.rej
Patch failed!  Please fix ./patches/001-fix-macos-vasnprintf.patch!
make[3]: *** [Makefile:36: /home/algebro/software/openwrt/build_dir/host/bison-3.0.5/.prepared103cbc3459a5a50171d309d1b2750360_6664517399ebbbc92a37c5bb081b5c53] Error 1
make[3]: Leaving directory '/home/algebro/software/openwrt/tools/bison'
Command exited with non-zero status 2
time: tools/bison/compile#0.15#0.07#0.17
make[2]: *** [tools/Makefile:154: tools/bison/compile] Error 2
make[2]: Leaving directory '/home/algebro/software/openwrt'
make[1]: *** [tools/Makefile:150: /home/algebro/software/openwrt/staging_dir/target-arm_cortex-a9+vfpv3_musl_eabi/stamp/.tools_compile_yynyyyyynyyyyynyynnyyyynyyyyyyyyyyyyyyynyynynnyyynnyy] Error 2
make[1]: Leaving directory '/home/algebro/software/openwrt'
make: *** [/home/algebro/software/openwrt/include/toplevel.mk:218: world] Error 2

Anyone have any ideas what could be the problem? I've seen various people reporting errors with toplevel.mk but the issues seem to be different.

v18.06.1 does not have bison 3.0.5
You have a dirty source tree.

If you look at the 18.06 branch commit log, you can easily notice that bison was update to 3.0.5 five days after v18.06.1 and 001-fix-macos-vasnprintf.patch was removed at the same time.
https://git.openwrt.org/?p=openwrt/openwrt.git;a=shortlog;h=24984b07e8ef189e311063ad78a2a9afb725fd9c

Possibly you have tried to update bison manually to 3.0.5 but have not updated the patches (removed the one that has been applied upstream)
See 3.0.5 bump here: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=24984b07e8ef189e311063ad78a2a9afb725fd9c

Thanks, I was thinking it might be something like this (although I tried cleaning it yesterday with make distclean etc). I've wiped out the source tree and checked out a fresh copy and it's currently building--I'll update with the results.

You can easily check the version from tools/bison/Makefile (and contents of tools/bison/patches directory).

Ok, it failed again at the same spot (toplevel.mk:218) but this is the error I was seeing yesterday after cleaning the source tree with make distclean:

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 '/home/algebro/software/openwrt/build_dir/host/bison-3.0.4'
make[5]: *** [Makefile:4522: all-recursive] Error 1
make[5]: Leaving directory '/home/algebro/software/openwrt/build_dir/host/bison-3.0.4'
make[4]: *** [Makefile:2625: all] Error 2
make[4]: Leaving directory '/home/algebro/software/openwrt/build_dir/host/bison-3.0.4'
make[3]: *** [Makefile:31: /home/algebro/software/openwrt/build_dir/host/bison-3.0.4/.built] Error 2
make[3]: Leaving directory '/home/algebro/software/openwrt/tools/bison'
Command exited with non-zero status 2
time: tools/bison/compile#8.25#1.16#9.42
make[2]: *** [tools/Makefile:154: tools/bison/compile] Error 2
make[2]: Leaving directory '/home/algebro/software/openwrt'
make[1]: *** [tools/Makefile:150: /home/algebro/software/openwrt/staging_dir/target-arm_cortex-a9+vfpv3_musl_eabi/stamp/.tools_compile_yynyyyyynyyyyynyynnyyyynyyyyyyyyyyyyyyynyynynnyyynnyy] Error 2
make[1]: Leaving directory '/home/algebro/software/openwrt'
make: *** [/home/algebro/software/openwrt/include/toplevel.mk:218: world] Error 2

I think I remember reading about issues with glibc 2.28 somewhere in the past, could that be related?

Looks like there is a patch here: https://github.com/openwrt/openwrt/pull/1290

Its kind of annoying this bug made it into the 18.06.1 release though, as I was hoping to switch from a snapshot/patched build to an official stable version. Would you recommend applying the patch so I can stay as close as possible to 18.06.1 or just run 18.06 HEAD until 18.06.2?

So, you are using non-standard clibc ?????? (not musl)
you might have mentioned that.

If you are building your personal firmware, there is absolutely no reason to build "old" v18.06.1 tag, instead you should always build from 18.06 HEAD taking in all the possible fixes & compatibility fixes etc..

Ps. not sure if that glibc bug is visible in 2.26 that is in 18.06, but you may try the patch in any case. I assume that you have not tried to update glibc manually to 2.28...

1 Like

So, you are using non-standard clibc ?????? (not musl)
you might have mentioned that.

I dont know? I'm just following the build instructions on Arch Linux. My process for building the firmware is:

  1. clone repo
  2. Update and install feeds
  3. copy custom config from out-of-tree to .config
  4. make defconfig; make oldconfig
  5. make -j8

This process has been working fine for me for a year but I'm just now running into issues with 18.06.

If you are building your personal firmware, there is absolutely no reason to build "old" v18.06.1 tag, instead you should always build from 18.06 HEAD taking in all the possible fixes & compatibility fixes etc..

Yeah, this has been my approach in the past, I'm just trying to heed warnings I see and follow best practices by running a "stable" build for day-to-day usage. In the past I've always just built from the master branch and been fine but I'm seeing a lot of arguments saying that isn't really what master is for and you shouldn't be using it unless you're actively developing packages.

Would the 18.06 HEAD be considered "more stable" than OpenWRT master branch?

Yes. 18.06 branch is stable. Only bug fixes & similar stuff. Its HEAD is more advanced than the release tags in the history (like v18.06.1).

But master branch is quite another thing. Master is the development branch that can be unstable.

ps. Sounds strange that the glibc related buison incompatibility would surface if you have not tried to change to glibc in menuconfig. It might also be something relatd to your buildhost. There has been no similar reports on 18.06 in large scale, I think, so it sounds like something pretty rare. Is your buildhost a typical common Linux, like Ubuntu etc. ?

Is your buildhost a typical common Linux, like Ubuntu etc. ?

Yes, it's pretty much a stock Arch Linux system...I have made no manual changes to things like glibc or the build environment. I believe the issue is relatively rare because only a few bleeding edge distros (Arch, Fedora rawhide, etc) currently use glibc 2.28, and I remember when that version bump came it broke a lot of stuff.

Yes. 18.06 branch is stable. Only bug fixes & similar stuff. Its HEAD is more advanced than the release tags in the history (like v18.06.1).

But master branch is quite another thing. Master is the development branch that can be unstable.

Thank you very much for this clarification--I'll stick to the stable branch HEAD for future builds.

Yeah, it may be Arch Linux if it uses natively glibc 2.28 natively.

You might also need to apply the other glibc 2.28 patches for host tools (m4 and findutils):
https://github.com/openwrt/openwrt/search?q=glibc+2.28&type=Commits

EDIT:
my bad. those have been backported to 18.06

No problem--I'm actually able to compile 18.06 HEAD just fine, so I'll stick with that for the time being.

The problems here are not with the target libc, but induce problems is glibc on the build host is >=2.28. Your problems only showed once your host was updated to glibc 2.28, the version of openwrt (before the fixes went in) doesn't matter here - even the lede/ openwrt versions you successfully built in the past won't complete anymore, without applying the according fixes.

Bleeding edge distros come with bleeding edge problems. Debian or Ubuntu are the best candidates if you want to build OpenWrt, especially the stable branches.

I'm building regularly for multiple targets (ath79, ipq806x, lantiq) on daily updated Debian/ unstable (still on glibc 2.27) and rarely hit build issues because of too new host packages (it happens, but not very often - and if it happens, it will happen to stable users in the future as well).

1 Like