-
Notifications
You must be signed in to change notification settings - Fork 30
How to install Slic3r on RPi
On Raspbian 10 Buster, slic3r and slic3r-prusa are available in the apt repository and do not need to be built on the Pi. Continue below if you have older Raspbian or want to build from source anyway.
Follow these steps in order. Some steps will take a long time depending on how fast your RPi is. These steps assume that your RPi is connected to the network and you are logged in to it.
-
Increase swap size to 1000MB so that we have enough memory to compile.
- Edit
/etc/dphys-swapfile
and change the swap file size toCONF_SWAPSIZE=1000
.
sudo sed -i '/^CONF_SWAPSIZE.*/s//CONF_SWAPSIZE=1000/' /etc/dphys-swapfile
- Raspbian Stretch seems to require more memory to compile because of the different libraries and how our dependencies are satisfied. Try setting this to 2000 if the compile fails with errors like
internal compiler error: Killed (program cc1plus)
-
sudo reboot now
to reboot the system.
- Edit
-
Log in again. Use one of the configurations below as-is or modify. Copy and paste the text into the RPi command line.
- alexrj's slic3r, the original
SLIC3R_REPO="https://github.com/alexrj/Slic3r.git" SLIC3R_VERSION="master" SLIC3R_DIR=~/Slic3r
- prusa3d, version 1.33.8 (without Intel Threading Building Blocks)
SLIC3R_REPO="https://github.com/prusa3d/Slic3r.git" SLIC3R_VERSION="version_1.33.8" SLIC3R_DIR=~/Slic3r
- prusa3d, latest known working (with Intel Threading Building Blocks). (You don't have to adjust name or email.)
SLIC3R_REPO="https://github.com/prusa3d/Slic3r.git" SLIC3R_VERSION="version_1.39.2" SLIC3R_DIR=~/Slic3r-1.39.2 TBB_RELEASE="https://github.com/01org/tbb/archive/2018_U4.tar.gz" TBB_DIR=~/tbb-2018.4 TBB_VERSION="2018.4" YOUR_NAME="Your Name" YOUR_EMAIL="email address"
- prusa3d, latest (with Intel Threading Building Blocks). (You don't have to adjust name or email.)
SLIC3R_REPO="https://github.com/prusa3d/Slic3r.git" SLIC3R_VERSION="master" SLIC3R_DIR=~/Slic3r TBB_RELEASE="https://github.com/01org/tbb/archive/2017_U7.tar.gz" TBB_DIR=~/tbb TBB_VERSION="7" YOUR_NAME="Your Name" YOUR_EMAIL="email address"
- alexrj's slic3r, the original
-
Copy and paste all of this:
3.1. Install library
sudo apt-get update
sudo apt-get install -y git libboost-all-dev libboost-geometry-utils-perl libboost-system-dev libboost-thread-dev git-core build-essential libgtk2.0-dev libwxgtk2.8-dev libwx-perl libmodule-build-perl libnet-dbus-perl cpanminus libextutils-cbuilder-perl gcc-4.7 g++-4.7 libwx-perl libperl-dev libextutils-cppguess-perl libeigen3-dev libglew-dev libglewmx-dev cpanminus
3.1a. Raspbian Stretch requires a different list as of June 24th, 2018. This may change in future. An alternate list of libraries has been found to work, however it will be necessary to install some dependencies directly into Perl using CPAN
sudo apt-get update
sudo apt-get upgrade
sudo apt install -y git libboost-all-dev libboost-geometry-utils-perl libboost-system-dev libboost-thread-dev git-core build-essential libwxgtk3.0-dev libgtk-3-dev libwx-perl libmodule-build-perl libnet-dbus-perl cpanminus gcc-4.7 g++-4.7 libwx-perl libperl-dev libextutils-cppguess-perl libeigen3-dev libglew-dev cpanminus libcurl4-openssl-dev
Then
sudo cpan ExtUtils::CBuilder ExtUtils::CppGuess Alien::wxWidgets CPAN::Mini ExtUtils::XSpp::Cmd ExtUtils::Typemaps::Basic
3.2. compile TBB and create a package to install it in system
if [ ! -z "${TBB_DIR}" ]; then
sudo rm -rf ${TBB_DIR}
fi
mkdir -p ${TBB_DIR}
cd ${TBB_DIR}
wget ${TBB_RELEASE}
tar xzvf $(basename ${TBB_RELEASE})
cd tbb*
make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"
cd ${TBB_DIR}
mkdir libtbb-dev_${TBB_VERSION}_armhf
cd libtbb-dev_${TBB_VERSION}_armhf
mkdir -p usr/local/lib/pkgconfig
mkdir -p usr/local/include
mkdir DEBIAN
cd ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf/DEBIAN
cat > control << EOF
Package: libtbb-dev
Priority: extra
Section: universe/libdevel
Maintainer: ${YOUR_NAME} <${YOUR_EMAIL}>
Architecture: armhf
Version: ${TBB_VERSION}
Homepage: http://threadingbuildingblocks.org/
Description: parallelism library for C++ - development files
TBB is a library that helps you leverage multi-core processor
performance without having to be a threading expert. It represents a
higher-level, task-based parallelism that abstracts platform details
and threading mechanism for performance and scalability.
.
(Note: if you are a user of the i386 architecture, i.e., 32-bit Intel
or compatible hardware, this package only supports Pentium4-compatible
and higher processors.)
.
This package includes the TBB headers, libs and pkg-config
EOF
cd ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf/usr/local/lib
cp ${TBB_DIR}/tbb*/build/*_release/libtbb.so.2 .
ln -s libtbb.so.2 libtbb.so
cd ${TBB_DIR}/tbb*/include
cp -r serial tbb ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf/usr/local/include
cd ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf/usr/local/lib/pkgconfig
cat > tbb.pc << EOF
# Manually added pkg-config file for tbb - START
prefix=/usr/local
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include
Name: tbb
Description: thread building block
Version: ${TBB_VERSION}
Cflags: -I\${includedir} -DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0
Libs: -L\${libdir} -ltbb
# Manually added pkg-config file for tbb - END
EOF
cd ${TBB_DIR}
sudo chown -R root:staff libtbb-dev_${TBB_VERSION}_armhf
sudo dpkg-deb --build libtbb-dev_${TBB_VERSION}_armhf
sudo dpkg -i ${TBB_DIR}/libtbb-dev_${TBB_VERSION}_armhf.deb
sudo ldconfig
3.3. compile Slic3r or Prusa
sudo rm -rf ${SLIC3R_DIR}
git clone ${SLIC3R_REPO} ${SLIC3R_DIR}
cd ${SLIC3R_DIR}
git fetch ${SLIC3R_REPO}
git checkout ${SLIC3R_VERSION}
perl Build.PL --sudo
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release #-DSLIC3R_WX_STABLE=1 #maybe need to use this option by uncommenting
sudo make -j2
ctest --verbose
cd ..
./slic3r.pl --help
It will take a long time. On RPi3, maybe 1-2 hours. If you see slic3r's help page at the end, you have succeeded. On RPi3B+ with Raspbian Stretch, it can take even longer, and even with more swap space, stopping the Octoprint server while compiling may be required to free up enough memory to complete. If cmake fails, make sure to have it installed and you choose the folder in which the CMakeFile.txt is located. This file might be in the src/ directory.
Latest Slic3r PE version use the libboost version 1.64.xx.
libboost armhf today(2019.01.01) available only 1.62.0.1. Build unavailable on RPI platform.
NOTE: YOU CAN build the boost library from source. Uninstall your current library by doing the following:
dpkg -S /usr/include/boost/version.hpp # will let you know what package to remove
sudo apt-get autoremove libboost1.62-dev # this is what you are likely to have installed, but do above to be sure
wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2
tar xf boost_1_66_0.tar.bz2
cd boost_1_66_0
./bootstrap.sh
sudo ./b2 install # NOTE: THIS WILL TAKE A LONG TIME ON THE rPI!
Now you SHOULD be ready to build Slic3r. One final note: you will need to perform step 1 before you do this. So make sure you have increased your swap space.