Closed Hadatko closed 4 years ago
As far as I can tell the problem is due to rpm not having a definition for the _arch macro.
I managed to build 0.8.2 on my RPi 4 yesterday by modifying the Makefile so that the rpmbuild command also defined _arch (e.g. RPMBUILD = rpmbuild --target=armhf --define "_arch Rpi") and then running the make and dpkg commands again.
I doubt that setting _arch to 'RPi' is the correct value and I haven't testing the resulting binaries in anger (I've just run a couple of simple zpool commands). But this may help some one more knowledgeable identify the correct solution.
That's definitely the issue. The _arch
macro is expected to be defined in the /usr/lib/rpm/platform/<arch>/macros
file, normally at the very top. Is this file missing on the RPi 4 or _arch
or is it perhaps simply not defined?
@Hadatko Raspbian? I thought 32bit wasn't supported for zfs. Have you tried ubuntu 19.10 64bit?
Hi, the last version is still not working for me. I turned on arm64 in boot config. Also i run rpi-update and eeprom update... But i have stable version so not sure if the flag with arm64 is used or skipped.
@Hadatko turning on arch64 in the boot loader will still leave you with a 32bit kernel if I'm not mistaken. Not 100% on that. It just allows the system to execute 64bit code. ZOL is supposed to build on 32bit but it's strongly discouraged. It's possible that this is a build bug in zfs.
As far as solutions for you to use in the short term.... Here is some info I found about building a 64bit kernel. https://www.tal.org/tutorials/raspberry-pi3-build-64-bit-kernel
and enabling it. https://www.tal.org/tutorials/booting-64-bit-kernel-raspberry-pi-3
Or you could try the ubuntu arch64 sd card image. Much easier.
Hi @kenthinson i like the idea to put ubuntu on raspberry. Is there big difference in performance? Although i am not using gui (i am booting to cmd only) there shouldn't be big difference i guess.
@Hadatko seems to work fine for me. I run my personal website from it. I can't attest to ZFS performance as I've never tried on the pi.
That is ok. I thought OS performance. I am using samba, dlna, mydownloader.
@IainCollins262 I tried your workaround of manually adapting the RPMBUILD
variable in the Makefile
and the re-run make
but unfortunately for me it does not work. I am running Raspbian 8 on a Raspberry Pi 3 and would like to compile ZFS 0.7.12 from the release tarball on github.
It fails quite fast at the beginning of the make
and that would be the last output:
+ ./configure --host=arm-unknown-linux-gnueabihf --build=arm-unknown-linux-gnueabihf --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/lib/arm-linux-gnueabihf --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-config=user --with-udevdir=/lib/udev --with-udevruledir=/lib/udev/rules.d --with-dracutdir=/usr/share/dracut --disable-static --disable-debug --enable-sysvinit --disable-systemd
checking for gawk... gawk
checking metadata... META file
checking build system type... arm-unknown-linux-gnueabihf
checking host system type... arm-unknown-linux-gnueabihf
checking target system type... arm-unknown-linux-gnueabihf
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking whether make sets $(MAKE)... yes
checking for arm-unknown-linux-gnueabihf-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/zfs-build-pi-fRsgULVX/BUILD/zfs-0.7.12':
configure: error: C compiler cannot create executables
See `config.log' for more details
error: Bad exit status from /tmp/zfs-build-pi-fRsgULVX/TMP/rpm-tmp.Lgphsd (%build)
RPM build errors:
Bad exit status from /tmp/zfs-build-pi-fRsgULVX/TMP/rpm-tmp.Lgphsd (%build)
Makefile:1212: recipe for target 'rpm-common' failed
make[1]: *** [rpm-common] Error 1
make[1]: Leaving directory '/home/pi/src/zfs-0.7.12'
Makefile:1171: recipe for target 'rpm-utils' failed
make: *** [rpm-utils] Error 2
In the config.log I see the following which must be the relevant part:
configure:3604: $? = 4
configure:3624: checking whether the C compiler works
configure:3646: gcc -O2 -g -march=armv7 conftest.c >&5
conftest.c:1:0: error: target CPU does not support ARM mode
/* confdefs.h */
^
Any ideas anyone how I can make it compile?
Just wanted to let you all know that I finally managed to compile ZFS 0.7.12 by upgrading Raspbian jessie to stretch. On stretch compilation runs just fine.
The following works to build zfs on a Raspberry Pi 4 B
Type | Version/Name |
---|---|
Distribution Name | Rasbian |
Distribution Version | Buster |
Linux Kernel | 4.19.75 |
Architecture | arm |
ZFS Version | 0.8.2 |
SPL Version | ---- |
./autogen.sh
./configure --disable-pyzfs
# https://github.com/zfsonlinux/zfs/issues/9504
sed -E 's/(^RPMBUILD = rpmbuild.*)/\1 --define "_arch arm"/' -i Makefile
make deb-dkms deb-utils
This doesn't seem to be a ZFS specific issue, Debian's rpm
package ships its macros in a directory which is not in the canonical search paths:
root@linux:~# rpm -E '%{_arch}'
%{_arch}
root@linux:~# rpm -E '%{_target}'
armv7hnl-linux
root@linux:~# ls -l /usr/lib/rpm/platform/armv7hnl-linux
ls: cannot access '/usr/lib/rpm/platform/armv7hnl-linux': No such file or directory
root@linux:~# ls -l /usr/lib/rpm/platform/armv7hnl-linux-gnueabihf/
total 4
-rw-r--r-- 1 root root 3094 Feb 17 2019 macros
root@linux:~# rpm --macros /usr/lib/rpm/platform/armv7hnl-linux-gnueabihf/macros -E '%{_arch}'
arm
root@linux:~# lsb_release -a
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
root@linux:~#
A bug report on Debian's tracker seems more appropriate here.
@loli10K can you please post the link to the Debian bug report?
I frequently run into this issue when compiling ZFS on a helios4 running Armbian.
Hi, i cannot finish build on rasberry pi. I was using steps for rapsberry pi 3 but i am trying to build 0.8.2 version instead of 0.7.x
System information
Describe the problem you're observing
Describe how to reproduce the problem
download zfs 0.8.2 tar gz and unpack cd ../zfs-0.8.2/ autoreconf --install --force ./configure --with-config=srpm sed -E 's/(^RPMBUILD = rpmbuild.)/\1 --target=armhf/' -i Makefile make pkg-utils deb-dkms for deb in .deb; do sudo dpkg -i "$deb"; done