Build against current master for starfive visionfive2 failing

Cloned master from openwrt git, then did make menuconfig and only selected target device:


The build fails at package/utils/util-linux:

make[3] -C package/utils/util-linux compile
    ERROR: package/utils/util-linux failed to build.
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
make: *** [/openwrt/include/ world] Error 1

make V=sc:

FAILED: more
riscv64-openwrt-linux-musl-gcc  -o more more.p/text-utils_more.c.o -L/openwrt/staging_dir/toolchain-riscv64_riscv64_gcc-12.3.0_musl/usr/lib -L/openwrt/staging_dir/toolchain-riscv64_riscv64_gcc-12.3.0_musl/lib -Wl,--as-needed -Wl,--no-undefined -fuse-ld=bfd -fuse-ld=bfd -znow -zrelro -Wl,--start-group lib/libcommon.a -fuse-ld=bfd -znow -zrelro /lib/ -Wl,--end-group
/openwrt/staging_dir/toolchain-riscv64_riscv64_gcc-12.3.0_musl/lib/gcc/riscv64-openwrt-linux-musl/12.3.0/../../../../riscv64-openwrt-linux-musl/bin/ld.bfd: /lib/ error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
make[3]: *** [Makefile:908: /openwrt/build_dir/target-riscv64_riscv64_musl/util-linux-2.39.3/.built] Error 1
make[3]: Leaving directory '/openwrt/package/utils/util-linux'
time: package/utils/util-linux/compile#0.24#0.07#0.30
    ERROR: package/utils/util-linux failed to build.
make[2]: *** [package/Makefile:129: package/utils/util-linux/compile] Error 1

Any ideas? Seems like it's linking against a library on my build host, and not from it's own build/staging directory?

Just a quick update on this.

The util-linux build error is occurring when I attempt a build on my arch linux build host. Earlier tonight I ran the same build on my debian build host, and the build goes fine, no issues (yay).

Now I just need to figure out what is wrong on my arch build host. Anyone have experience with similar single package build errors in the past? Some sort of environment variable problem, maybe?

Hmm. Further investigation reveals that this sort of thing just somehow "happens" from time to time?

Long-standing bug opened at FSF/GNU with extremely similar reports here:

here is a dirty workaround:

for musl

sed -i 's/ \/lib\/ ..\/lib\/' build_dir/target-riscv64_riscv64_musl/util-linux-2.39.3/openwrt-build/

cp build_dir/target-riscv64_riscv64_musl/ncurses-6.4/lib/ build_dir/target-riscv64_riscv64_musl/util-linux-2.39.3/lib

for glibc:

sed -i 's/ \/lib\/ ..\/lib\/' build_dir/target-riscv64_riscv64_glibc/util-linux-2.39.3/openwrt-build/

cp build_dir/target-riscv64_riscv64_glibc/ncurses-6.4/lib/ build_dir/target-riscv64_riscv64_glibc/util-linux-2.39.3/lib

the build has to fail first, then do above, then make again


Thank you for this - the dirty workaround worked perfectly:

BusyBox v1.36.1 (2024-03-18 12:25:11 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 OpenWrt SNAPSHOT, r0-85ad6b9
[root@visionfive2 ~]# lscpu
Architecture:          riscv64
  Byte Order:          Little Endian
CPU(s):                4
  On-line CPU(s) list: 0-3
[root@visionfive2 ~]# head /proc/cpuinfo
processor       : 0
hart            : 1
isa             : rv64imafdc
mmu             : sv39
uarch           : sifive,u74-mc
mvendorid       : 0x489
marchid         : 0x8000000000000007
mimpid          : 0x4210427

processor       : 1
[root@visionfive2 ~]#

Do you have any insight on why just this one package and/or particular library failed to build? Very strange, I had no other problems... only util-linux.

No sorry

There was an error for me compiling the nfs utilities.

In function 'write_table',
    inlined from 'write_tables' at rpc_tblout.c:73:4,
    inlined from 't_output.constprop' at rpc_main.c:841:3:
rpc_tblout.c:91:26: error: '%s' directive writing likely 1 or more bytes into a region of size between 0 and 99 [-Werror=format-overflow=]
   91 |       s_print (progvers, "%s_%s",
      |                          ^
rpc_tblout.c:91:26: note: assuming directive output of 1 byte
In function 'sprintf',
    inlined from 'write_table' at rpc_tblout.c:91:7,
    inlined from 'write_tables' at rpc_tblout.c:73:4,
    inlined from 't_output.constprop' at rpc_main.c:841:3:
/storage/drive3/source/openwrt-vf2/staging_dir/toolchain-riscv64_riscv64_gcc-13.2.0_glibc/include/bits/stdio2.h:30:10: note: '__builtin___sprintf_chk' output 2 or more bytes (assuming 102) into a destination of size 100
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^
lto1: some warnings being treated as errors
make[7]: *** [/storage/drive3/source/openwrt-vf2/tmp/ /storage/drive3/source/openwrt-vf2/tmp/cc8bPFiL.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.

I appear to have got around that by editing a line in rpc_tblout.c

s_print (progvers, "%s_%s",

snprintf (progvers, sizeof(progvers), "%s_%s",

xdplib also won't compile but I haven't figured out that one

Ah; I'll double check my packages list but am pretty sure I don't have either of those selected for building. Thanks again for the tip on util-linux package. Still not sure why fine on debian and not on archlinux.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.