proot
proot copied to clipboard
Cannot compile software inside a proot environment
Expected Behavior
Can compile software inside a proot environment
Actual Behavior
Cannot compile software inside a proot environment; build fails with error message
Steps to Reproduce the Problem
1. Build with chroot (not proot) to verify that compiling works in general
wget -c http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/x86_64/alpine-minirootfs-3.10.2-x86_64.tar.gz
mkdir miniroot
( cd miniroot ; sudo tar xf ../alpine-minirootfs-3.10.2-x86_64.tar.gz )
cd miniroot
sudo mount -o bind /dev ./dev
sudo mount -t proc none ./proc
sudo mount -t sysfs none ./sys
sudo cp -p /etc/resolv.conf etc/
sudo chroot . /bin/sh -l
# Now inside chroot
apk update
apk add alpine-sdk bash util-linux strace file zlib-dev # OK: 198 MiB in 66 packages
# Build static bsdtar
wget https://www.libarchive.org/downloads/libarchive-3.3.2.tar.gz
tar xf libarchive-3.3.2.tar.gz
cd libarchive-3.3.2
./configure LDFLAGS='--static' --enable-bsdtar=static --disable-shared --with-zlib
make -j$(nproc)
ld -static -o bsdtar tar/bsdtar-bsdtar.o tar/bsdtar-cmdline.o tar/bsdtar-creation_set.o tar/bsdtar-read.o tar/bsdtar-subst.o tar/bsdtar-util.o tar/bsdtar-write.o /usr/lib/crt1.o .libs/libarchive.a .libs/libarchive_fe.a /usr/lib/libc.a /lib/libz.a
strip bsdtar
cd ..
# Exit chroot
exit
sudo umount proc sys dev
sudo rm -rf libarchive-3.3.2
cd ..
2. Now build with proot and see it fail
wget -c https://github.com/just-containers/PRoot/releases/download/v5.1.0-4/proot-5.1.0-amd64.tar.xz
tar xf proot-5.1.0-amd64.tar.xz
./bin/proot -S ./miniroot -w / /bin/sh
# Now inside proot
apk update
apk add alpine-sdk bash util-linux strace file zlib-dev # OK: 198 MiB in 66 packages
# Build static bsdtar
wget https://www.libarchive.org/downloads/libarchive-3.3.2.tar.gz
tar xf libarchive-3.3.2.tar.gz
cd libarchive-3.3.2
./configure LDFLAGS='--static' --enable-bsdtar=static --disable-shared --with-zlib
make -j$(nproc)
ld -static -o bsdtar tar/bsdtar-bsdtar.o tar/bsdtar-cmdline.o tar/bsdtar-creation_set.o tar/bsdtar-read.o tar/bsdtar-subst.o tar/bsdtar-util.o tar/bsdtar-write.o /usr/lib/crt1.o .libs/libarchive.a .libs/libarchive_fe.a /usr/lib/libc.a /lib/libz.a
strip bsdtar
cd ..
# Exit proot
exit
Specifications
- Proot/Care version: v5.1.0-4
- Kernel version: 4.18.0-15-generic/
- Host distribution: Ubuntu 18.04.2 LTS
- Guest distribution: alpine-minirootfs-3.10.2-x86_64
Command Output
This only appears when using proot, not when using chroot:
checking sys/sysmacros.h presence... yes
configure: WARNING: sys/sysmacros.h: present but cannot be compiled
configure: WARNING: sys/sysmacros.h: check for missing prerequisite headers?
configure: WARNING: sys/sysmacros.h: see the Autoconf documentation
configure: WARNING: sys/sysmacros.h: section "Present But Cannot Be Compiled"
configure: WARNING: sys/sysmacros.h: proceeding with the compiler's result
configure: WARNING: ## -------------------------------------------------- ##
configure: WARNING: ## Report this to [email protected] ##
configure: WARNING: ## -------------------------------------------------- ##
checking for sys/sysmacros.h... no
This is not libarchive specific as I am running into similar issues then trying to compile other software.
Regarding other software, do they also depend upon that particular header as well?
Yes, I am also running into this when trying to compile other software inside a proot environment.
In the build log I see:
https://travis-ci.com/probonopd/static-tools/builds/133127035#L511-L513
Executing busybox-1.30.1-r2.trigger
ERROR: busybox-1.30.1-r2.trigger: script exited with error 127
Executing ca-certificates-20190108-r0.trigger
ERROR: ca-certificates-20190108-r0.trigger: script exited with error 127
2 errors; 198 MiB in 66 packages
Could this be related to https://github.com/Hax4us/TermuxAlpine/issues/1?
Also see https://github.com/termux/proot/pull/17.
Full build log: https://api.travis-ci.com/v3/job/248569691/log.txt
My Travis CI setup:
- https://github.com/probonopd/static-tools/blob/54072bfd3afc9763498e0269da16f8e781702ece/.travis.yml
- https://github.com/probonopd/static-tools/blob/54072bfd3afc9763498e0269da16f8e781702ece/build.sh
Reference:
-
https://git.alpinelinux.org/aports/tree/main/busybox/busybox.trigger
-
https://git.alpinelinux.org/aports/tree/main/ca-certificates/ca-certificates.trigger
@probonopd can you test again with the latest tagged release?
Also, I would not recommend using any other source besides this repository, since many of the forks have diverged a bit in the last few years. The exception being termux/proot, which has been maintained very well; however, even it contains many Android-specific patches.
@probonopd can you test again with the latest tagged release?
Is there a binary available for x86_64? Thanks.
@probonopd can you test again with the latest tagged release?
Is there a binary available for x86_64? Thanks.
@probonopd please test again with the latest v5.3.0 release.