duckdb: Build fails on Pi Zero
I was trying to build on a Raspberry Pi Zero M, and it took a very long time at 11% (hours) and eventually failed; make:
mkdir -p build/release && \
cd build/release && \
cmake -DBUILD_PARQUET_EXTENSION=TRUE -DCMAKE_BUILD_TYPE=Release ../.. && \
cmake --build .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/git/duckdb/build/release
make[1]: Entering directory '/home/pi/git/duckdb/build/release'
make[2]: Entering directory '/home/pi/git/duckdb/build/release'
make[3]: Entering directory '/home/pi/git/duckdb/build/release'
make[3]: Leaving directory '/home/pi/git/duckdb/build/release'
[ 9%] Built target parquet_extension
make[3]: Entering directory '/home/pi/git/duckdb/build/release'
make[3]: Leaving directory '/home/pi/git/duckdb/build/release'
[ 11%] Built target utf8proc
make[3]: Entering directory '/home/pi/git/duckdb/build/release'
make[3]: Leaving directory '/home/pi/git/duckdb/build/release'
make[3]: Entering directory '/home/pi/git/duckdb/build/release'
make[3]: Leaving directory '/home/pi/git/duckdb/build/release'
make[3]: Entering directory '/home/pi/git/duckdb/build/release'
[ 11%] Building CXX object src/optimizer/CMakeFiles/duckdb_optimizer.dir/ub_duckdb_optimizer.cpp.o
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make[3]: *** [src/optimizer/CMakeFiles/duckdb_optimizer.dir/build.make:63: src/optimizer/CMakeFiles/duckdb_optimizer.dir/ub_duckdb_optimizer.cpp.o] Error 1
make[3]: Leaving directory '/home/pi/git/duckdb/build/release'
make[2]: *** [CMakeFiles/Makefile2:467: src/optimizer/CMakeFiles/duckdb_optimizer.dir/all] Error 2
make[2]: Leaving directory '/home/pi/git/duckdb/build/release'
make[1]: *** [Makefile:130: all] Error 2
make[1]: Leaving directory '/home/pi/git/duckdb/build/release'
make: *** [Makefile:103: release] Error 2
Anything that can be done here?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (7 by maintainers)
CLI build is here: https://github.com/cwida/duckdb/releases/download/master-builds/duckdb_cli-linux-rpi.zip
Just for you people I got a Raspberry Pi to get DuckDB to work here ^^
The Hypriot OS is a minimal Debian OS with a kernel optimized for Docker, for ARM units. The HypriotOS also runs on many other boards besides the Raspberry Pi variants, such as ODROIDs, NVIDIA ShieldTV. Its base is smaller than Rasbian Lite, and not overkill in that sense. I think the overhead is quite small. The stock OS for rpi0, say Raspbian Lite, could also install Docker of course, but it doesn’t come included there.
This demo at https://github.com/hypriot/rpi-nano-httpd shows an example with hundreds of containerized instances of lightweight web servers running on one of these units. That tiny application is “statically linked” when built. For those that prefer a as-much-as-possible portable binary over using containers/lightweight virtualization, would it be possible to statically link to the libstdc++ of the correct version and bundle it in the duckdb cli binary that gets built, perhaps through some switches to the make command (
-static-libstdc++)?Confirmed to work on the Pi Zero (W) as well!
We now build and provide binaries for Raspberry Pi as part of our nightly builds and releases.
You could try this cloud build of duckdb CLI to get a arm/v6 binary (see build logs here), but it needs to be extracted from the docker image first, which can be done like this:
Caveat if you are not running Alpine on the rpi0 is that you probably need musl-armhf support:
This seems to be an error in building one of the tests. Try skipping the build of those as well by setting the
BUILD_UNITTESTSflag to 0 in CMake, e.g. as follows:Installing Docker on a Pi Zero seems like serious overkill to me.
I tried cross-compiling on my laptop with this multistage Dockerfile:
For this you need docker and a cli-plugin (that comes with Docker Desktop) called buildx. I didn’t have Docker Desktop (needed only if you’re on MacOS or Windows), I had just the docker Community Edition. So I did these commands to set up the required tools for the crossbuild on my laptop:
The buildx setup above gave support for building for these archs:
Platforms: linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6I was then able to do do the crossbuild for arm/v6, arm/v7 (I think rpi0 uses that?) and amd64, which took more than one hour to complete, but is claimed to do good concurrent builds for the different architectures:
Once the build is complete you can copy out the binary from the resulting image and if the correct version of the libstdc++ is present on the host it should run there too (haven’t tried it on rpi0 though, but that is my understanding).
You should be able to run the container without that present, though. But you’d need Docker on the Zero… If you installed Hypriot OS on the Pi Zero (see https://blog.hypriot.com/post/releasing-HypriotOS-1-11/) you should be able to run it with
docker run --rm -it ${SLUG} duckdb --help, which would pull the relevant slug from Docker Hub if not already available locally.The image generated from the build ended up being 25.7MB large (which includes the Alpine base OS with libstdc++ installed and duckdb otherwise pretty bare bones).
Another thing you could try is to disable unity builds like so:
DISABLE_UNITY=1 make. It could fix the running out of memory issue in the compiler but will also greatly increase your already massive compilation time ^^Your compiler runs out of memory there, which is not that surprising on a Raspberri Pi Zero. Try cross-compiling from a beefier box. In the future, we should also provide those binaries.