badaix / snapcast

Synchronous multiroom audio player
GNU General Public License v3.0
6.22k stars 455 forks source link

Build on raspberry pi #1298

Closed YetAnotherLogon closed 2 days ago

YetAnotherLogon commented 2 weeks ago

Followed instructions from: https://github.com/badaix/snapcast/blob/develop/doc/build.md and cloned boost. Cmake configuration step fails complaining about a missing boost include.

Had noted that boost was available from the raspbian repository, and installed it that way instead. Purged source tree, ran the cmake configuration step, and 'cmake --build .' : [ 1%] Building CXX object common/CMakeFiles/common.dir/resampler.cpp.o [ 3%] Building CXX object common/CMakeFiles/common.dir/sample_format.cpp.o [ 5%] Building CXX object common/CMakeFiles/common.dir/daemon.cpp.o [ 7%] Linking CXX static library /home/pi/src/snapcast/bin/libcommon.a [ 7%] Built target common [ 8%] Building CXX object server/CMakeFiles/snapserver.dir/config.cpp.o [ 10%] Building CXX object server/CMakeFiles/snapserver.dir/control_server.cpp.o [ 12%] Building CXX object server/CMakeFiles/snapserver.dir/control_session_tcp.cpp.o [ 14%] Building CXX object server/CMakeFiles/snapserver.dir/control_session_http.cpp.o c++: fatal error: Killed signal terminated program cc1plus compilation terminated. gmake[2]: [server/CMakeFiles/snapserver.dir/build.make:118: server/CMakeFiles/snapserver.dir/control_session_http.cpp.o] Error 1 gmake[1]: [CMakeFiles/Makefile2:160: server/CMakeFiles/snapserver.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2

Tried some triage, but didn't get anything useful: $ /usr/bin/c++ -DBOOST_ASIO_NO_TS_EXECUTORS -DBOOST_ERROR_CODE_HEADER_ONLY -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON -DHAS_EXPAT -DHAS_FLAC -DHAS_OGG -DHAS_OPUS -DHAS_PULSE -DHAS_SOXR -DHAS_TREMOR -DHAS_VORBIS -DHAS_VORBIS_ENC -DVERSION=\"0.29.0\" -I/home/pi/src/snapcast -I/home/pi/src/snapcast/include -I/home/pi/src/snapcast/server -Wall -Wextra -pedantic -Wno-unused-function -std=gnu++17 -MD -MT server/CMakeFiles/snapserver.dir/control_session_http.cpp.o -MF CMakeFiles/snapserver.dir/control_session_http.cpp.o.d -o CMakeFiles/snapserver.dir/control_session_http.cpp.o -c /home/pi/src/snapcast/server/control_session_http.cpp c++: fatal error: Killed signal terminated program cc1plus compilation terminated.

Other info: $ uname -a Linux audio0 6.6.28+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux $ tail -3 /proc/cpuinfo Revision : a22082 Serial : 00000000eb12e014 Model : Raspberry Pi 3 Model B Rev 1. $ c++ --version c++ (Debian 12.2.0-14) 12.2.0

badaix commented 1 week ago

[killed](c++: fatal error: Killed signal terminated program cc1plus) looks like the compiler got killed by the out of memory killer. Please try to compile with less threads, e.g. "make/ninja -j 2"

YetAnotherLogon commented 1 week ago

I wondered if that was what was happening.

Is cmake/cppcheck.cmake the correct place to do this (bit rusty with cmake)? Tried both -j 2 and -j 1, and the compiler still gets killed.

badaix commented 1 week ago

Then you need a Pi with more physical RAM or a larger swap file.

YetAnotherLogon commented 1 week ago

Actually tried a board with more memory and less stuff running on it. Build hung and pretty much locked the board up solid. Gave up after ~6 hours and pulled the power...

badaix commented 1 week ago

A larger swap should help

FriendlyGecko commented 3 days ago

In case you hadn't tried the larger swap file. Here are some quick instructions I wrote for myself because I do this sort of regularly on raspberry pis. I doubt it is the best method, but I like jank and it works.

1) Get the path of your device ex: /dev/XXX (lsblk)

2) Now unmount your device by typing: sudo umount /dev/XXX

3) Format your USB stick as swap, e.g. by terminal (you may have to clear old partitions using fdisk and hitting d for each partion, then w to write)

sudo mkswap /dev/XXX

4) Now you have to edit your /etc/fstab file, so type

sudo su
vi /etc/fstab

and append the following

UUID="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" none swap sw,pri=5 0 0 (in place of Xs, use the UUID number you got from mkswap)

5) Now type

swapon -a
exit
YetAnotherLogon commented 2 days ago

Sounds like good suggestions. Probably should be included in the build instructions.

Unfortunately, I'm having other issues with bookworm, and have rolled everything back to an earlier working setup.

badaix commented 2 days ago

The Raspberry Pi OS uses a swap file, which can easily be resized. I usually follow these instructions: https://pimylifeup.com/raspberry-pi-swap-file/