Closed michaeljclark closed 1 year ago
Looks like copy_file_range is a relatively new system call. In the glibc release notes I see Version 2.27 ...
Ubuntu 17.10 is still using glibc-2.26, so we haven't seen this conflict yet. Looks like a qemu internal function will have to be renamed to avoid the conflict.
Oops, that is e2fsprogs that needs to be fixed. Looking at e2fsprogs release notes http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.44.1 I see E2fsprogs 1.43.8 (January 1, 2018) ... Fix compatibility problems with glibc 2.27 casued by a collision with copy_file_range().
Buildroot is using 1.43.1, see buildroot/package/e2fsprogs/e2fsprogs.*. There may be a buildroot patch for that somewhere.
Ya. I've set up an Ubuntu 16.04 LTS amd64 VM and am trying to build again now...
I updated my Debian back to Buster and now I'm getting a new error building libtirpc:
$ make qemu
make -C /home/mclark/src/sifive/freedom-u-sdk/buildroot RISCV=/home/mclark/src/sifive/freedom-u-sdk/toolchain PATH=/home/mclark/src/sifive/freedom-u-sdk/toolchain/bin:/home/mclark/bin:/home/mclark/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/riscv/toolchain/bin:/opt/riscv/qemu/bin:/opt/riscv/musl-riscv-toolchain-7.2.0-7/bin O=/home/mclark/src/sifive/freedom-u-sdk/work/buildroot_initramfs
make[1]: Entering directory '/home/mclark/src/sifive/freedom-u-sdk/buildroot'
>>> libtirpc 1.0.1 Configuring
>>> libtirpc 1.0.1 Autoreconfiguring
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /home/mclark/src/sifive/freedom-u-sdk/work/buildroot_initramfs/host/usr/bin/automake line 3936.
autoreconf: /home/mclark/src/sifive/freedom-u-sdk/work/buildroot_initramfs/host/usr/bin/automake failed with exit status: 255
package/pkg-generic.mk:185: recipe for target '/home/mclark/src/sifive/freedom-u-sdk/work/buildroot_initramfs/build/libtirpc-1.0.1/.stamp_configured' failed
make[1]: *** [/home/mclark/src/sifive/freedom-u-sdk/work/buildroot_initramfs/build/libtirpc-1.0.1/.stamp_configured] Error 1
make[1]: Leaving directory '/home/mclark/src/sifive/freedom-u-sdk/buildroot'
Makefile:90: recipe for target '/home/mclark/src/sifive/freedom-u-sdk/work/buildroot_initramfs/images/rootfs.tar' failed
make: *** [/home/mclark/src/sifive/freedom-u-sdk/work/buildroot_initramfs/images/rootfs.tar] Error 2
It's a warning that has become an error in perl 5.26
$ perl --version
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 62 registered patches, see perl -V for more detail)
Copyright 1987-2017, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Appears to be broken on Ubuntu 18.04 LTS also
Ah. I followed the advice on that bug, by manually editing automake and it now works. It seems there must be a new automake dependency that is needed by buildroot to work on latest perl (5.26).
$ vi work/buildroot_initramfs/host/usr/bin/automake
goto line :3936 and change
$text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
to
$text =~ s/\$\{([^ \t=:+\{\}]+)\}/substitute_ac_subst_variables_worker ($1)/ge;
I ran into the automake problem once building on my laptop. I guess I forgot to submit a patch for it before deleting the build tree. Editing the automake script isn't a good solution as it can be overwritten on a rebuild. A better fix is to drop a small patch file into buildroot/package/automake There is already a 0001-noman.patch file there. Add a 0002-whatever.patch file that fixes automake and it will be used on the next build.
Okay I have fixed both issues. I have apull is against the sifive buildroot repo. It is parented on the commit: https://github.com/sifive/buildroot/commit/dfc15319 which is where the freedom-u-sdk submodule is pointing. We probably need to check whether these issues have been fixed in upstream buildroot.
See: https://github.com/sifive/buildroot/pull/5
Bump e2fsprogs to 1.44.1 to fix issue with glibc 2.27
glibc 2.27 introduces a copy_file_range function that clashes with a static function in e2fsprogs 1.43.1 causing a compile error. It This has been fixed in e2fsprogs 1.43.8. Bump to latest e2fsprogs 1.44.1
Bump automake to 1.16.1 to fix issue with perl 5.26
Fixes "Unescaped left brace in regex is deprecated, passed through in regex" error message when using perl 5.26
This is on a glib-2.27 system with perl-5.26. Two separate issues 😀
$make qemu
[snip]
/home/mclark/src/sifive/freedom-u-sdk/work/riscv-qemu/prefix/bin/qemu-system-riscv64 -nographic -machine virt -kernel /home/mclark/src/sifive/freedom-u-sdk/work/riscv-pk/bbl \
-drive file=/home/mclark/src/sifive/freedom-u-sdk/work/rootfs.bin,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \
-netdev user,id=net0 -device virtio-net-device,netdev=net0
bbl loader
SIFIVE, INC.
5555555555555555555555555
5555 5555
5555 5555
5555 5555
5555 5555555555555555555555
5555 555555555555555555555555
5555 5555
5555 5555
5555 5555
5555555555555555555555555555 55555
55555 555555555 55555
55555 55555 55555
55555 5 55555
55555 55555
55555 55555
55555 55555
55555 55555
55555 55555
555555555
55555
5
SiFive RISC-V Coreplex
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 4.15.0-00044-g2b0aa1de45f6 (mclark@minty) (gcc version 7.2.0 (GCC)) #1 SMP Sat Apr 21 16:18:58 NZST 2018
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] Initial ramdisk at: 0x (ptrval) (9457664 bytes)
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] Normal [mem 0x0000000088000000-0x0000087fffffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x0000000087ffffff]
[ 0.000000] software IO TLB [mem 0x83e3d000-0x87e3d000] (64MB) mapped at [ (ptrval)- (ptrval)]
[ 0.000000] elf_hwcap is 0x112d
[ 0.000000] percpu: Embedded 14 pages/cpu @ (ptrval) s28632 r0 d28712 u57344
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 31815
[ 0.000000] Kernel command line: earlyprintk
[ 0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.000000] Sorting __ex_table...
[ 0.000000] Memory: 46628K/129024K available (3073K kernel code, 214K rwdata, 842K rodata, 9399K init, 780K bss, 82396K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU event tracing is enabled.
[ 0.000000] RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[ 0.000000] riscv,cpu_intc,0: 64 local interrupts mapped
[ 0.000000] riscv,plic0,c000000: mapped 10 interrupts to 1/2 handlers
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[ 0.000145] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps every 4398046511100ns
[ 0.003237] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=100000)
[ 0.005254] pid_max: default: 32768 minimum: 301
[ 0.006899] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.008167] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[ 0.026616] Hierarchical SRCU implementation.
[ 0.032772] smp: Bringing up secondary CPUs ...
[ 0.033696] smp: Brought up 1 node, 1 CPU
[ 0.064546] devtmpfs: initialized
[ 0.070755] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.072290] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.077094] random: get_random_u32 called from bucket_table_alloc+0xe6/0x276 with crng_init=0
[ 0.078839] NET: Registered protocol family 16
[ 0.099457] vgaarb: loaded
[ 0.100542] SCSI subsystem initialized
[ 0.104239] usbcore: registered new interface driver usbfs
[ 0.105244] usbcore: registered new interface driver hub
[ 0.106490] usbcore: registered new device driver usb
[ 0.107464] pps_core: LinuxPPS API ver. 1 registered
[ 0.108147] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.109388] PTP clock support registered
[ 0.115406] clocksource: Switched to clocksource riscv_clocksource
[ 0.120919] NET: Registered protocol family 2
[ 0.124078] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[ 0.125126] TCP bind hash table entries: 1024 (order: 2, 16384 bytes)
[ 0.126115] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.128288] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.129262] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.131024] NET: Registered protocol family 1
[ 0.462821] Unpacking initramfs...
[ 0.822237] Initialise system trusted keyrings
[ 0.824156] workingset: timestamp_bits=62 max_order=14 bucket_order=0
[ 0.839597] random: fast init done
[ 0.864301] Key type asymmetric registered
[ 0.865421] Asymmetric key parser 'x509' registered
[ 0.866268] io scheduler noop registered
[ 0.867302] io scheduler cfq registered (default)
[ 0.867997] io scheduler mq-deadline registered
[ 0.868603] io scheduler kyber registered
[ 1.006499] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 1.011646] console [ttyS0] disabled
[ 1.012865] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 1, base_baud = 230400) is a 16550A
[ 1.015119] console [ttyS0] enabled
[ 1.015119] console [ttyS0] enabled
[ 1.015951] bootconsole [early0] disabled
[ 1.015951] bootconsole [early0] disabled
[ 1.042291] libphy: Fixed MDIO Bus: probed
[ 1.045704] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.045980] ehci-pci: EHCI PCI platform driver
[ 1.046548] usbcore: registered new interface driver usb-storage
[ 1.047886] usbcore: registered new interface driver usbhid
[ 1.048099] usbhid: USB HID core driver
[ 1.048776] NET: Registered protocol family 17
[ 1.050801] Loading compiled-in X.509 certificates
[ 1.065808] Freeing unused kernel memory: 9396K
[ 1.066064] This architecture does not have kernel memory protection.
Starting logging: OK
Starting mdev...
sort: /sys/devices/platform/Fixed: No such file or directory
modprobe: can't change directory to '/lib/modules': No such file or directory
Initializing random number generator... done.
Starting network...
udhcpc (v1.24.2) started
Sending discover...
Sending select for 10.0.2.15...
Lease of 10.0.2.15 obtained, lease time 86400
deleting routers
adding dns 10.0.2.3
Starting dropbear sshd: OK
Welcome to Buildroot
buildroot login:
This has been bothering me for some time because I was not able to test riscv-qemu in freedom-u-sdk on my build machine which is Debian 10 (Buster):
$ gcc --version
gcc (Debian 7.3.0-16) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
and
$ /lib/x86_64-linux-gnu/libc.so.6 --version
GNU C Library (Debian GLIBC 2.27-3) stable release version 2.27.
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 7.3.0.
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.
https://github.com/buildroot/buildroot/tree/master/package/e2fsprogs is at 1.44.1 and https://github.com/buildroot/buildroot/tree/master/package/automake is at 1.15.1
So e2fsprogs is already fixed upstream, but maybe not automake depending on when exactly the patch to fix the perl portability issue was fixed.
So from the timeline it looks like automake 1.15.1 might have the perl fix.
I am facing same issue on ubuntu 18.04. After applying the fixes @michaeljclark suggested I am getting this error.
Makefile.legacy:9: *** "You have legacy configuration in your .config! Please check your configuration.". Stop.
I just did a build on Ubuntu 18.04. The only extra step I did was to cd into buildroot, and checkout the sifive branch, to get the fixes that Michael Clark checked in, along with some other misc fixes.
If you have the necessary patches, maybe your build failed because of corruption in the buildroot build tree. I'd suggest deleting the buildroot build tree that failed to try building it again from scratch. If you tried manually patching buildroot, try checking out the sifive branch instead.
That worked. @jim-wilson : Thanks!!
I am having a problem building buildroot when running
make qemu
with top-of-tree on Debian Linux x86_64 (Note I have doneunset RISCV
so that I use the toolchain bundled withfreedom-u-sdk
):I have done a
make clean
andgit fetch
,git reset origin/master
and recursively reset submodules. Below is the output excluding riscv-qemu.I tried to bump buildroot to the
sifive-next
and get this:I tried to bump buildroot to the
sifive
and get this:The buildroot submodule in
freedom-u-sdk
points here: https://github.com/sifive/buildroot/commit/dfc15319532373fb8cea6b67edfd7f16c366d188The builtroot
sifive
branch points here: https://github.com/sifive/buildroot/commit/9fa9c297da7f5b1e93ca6d103f90d9ff5bed2d95It seems
e2fsprogs
is not compiling due to a conflict between aunistd.h
definition ofcopy_file_range
and a statically defined version ofcopy_file_range
ine2fsprogs-1.43.1/misc/create_inode.c
Okay. The error is buildroot trying to build a host
e2fsprogs
and it the conflict is with my debian system headers in/usr/include/unistd.h:1110
This is from this debian package which is from "buster" (Debian testing):
Okay. Let's try a downgrade to "stretch" (Debian stable):
We've downgraded the host compiler from gcc-7.3 (buster) to gcc-6.3 (stretch). More problems. Compiler doesn't support the Stack Smashing Protector:
Maybe I can modify one of these:
Okay lets try this:
Hmmm. Frustrating. Let's get back onto the new gcc-7.3 compiler and glibc-2.27 in Debian Buster.
To be continued...