Skip to content

Linux Compile Guide

Lane.Wei edited this page Oct 21, 2023 · 18 revisions

1. Environment setup

1.1 Ubuntu

Install Following tools before building:

sudo apt-get install cmake clang git g++ build-essential libgl1-mesa-dev m4 libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules pkgconf libglu1-mesa-dev libcairo2-dev libgtk-3-dev libsoup2.4-dev libwebkit2gtk-4.0-dev libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-bad libosmesa6-dev

gstreamer1.0-plugins-bad will provide the h264 decoder in gstreamer for liveview

1.2 Fedora

Install Following tools before building:
sudo dnf install gcc gcc-c++ cmake
sudo dnf install mesa-libGL-devel mesa-libGLU-devel
sudo dnf install m4
sudo dnf install perl
sudo dnf install extra-cmake-modules
sudo dnf install wayland-devel wayland-protocols-devel libxkbcommon-devel
sudo dnf install gtk3-devel webkit2gtk3-devel
sudo dnf install gstreamer1-devel gstreamer1-plugins-base-devel
sudo dnf install gstreamer1-plugin-openh264 #for linux liveview decoder requirement
sudo dnf install mesa-libOSMesa-devel

1.3 Solus

Install Following tool before building:
sudo eopkg it -c system.devel
sudo eopkg it git llvm-clang libglvnd-devel wayland-devel libxkbcommon-devel wayland-protocols-devel extra-cmake-modules libcairo-devel libgtk-3-devel libsoup-devel libwebkit-gtk-devel gstreamer-1.0-devel gstreamer-1.0-plugins-base-devel gstreamer-1.0-plugins-good gstreamer-1.0-plugins-bad gstreamer-1.0-plugins-bad-devel mesalib-devel libx11-devel glew-devel curl-devel

2. building the deps

You need to build the dependence of BambuStudio first. (Only needs for the first time)

Suppose you download the codes into /home/username/work/projects/BambuStudio
create a directory to store the dependence built: /home/username/work/projects/BambuStudio_dep
(Please make sure to replace the username with the one on your computer)

cd BambuStudio/deps
mkdir build;cd build

cmake ../ -DDESTDIR="/home/_username_/work/projects/BambuStudio_dep" -DCMAKE_BUILD_TYPE=Release -DDEP_WX_GTK3=1
make -jN (N can be a number between 1 and the max cpu number)

Note: this will use libjpeg with 80 by default, if your system's gstreamer has a different jpeg version, try to add -DJPEG_VERSION=N (N=6 or 7 or 8)
for example, if your gstreamer use libjpeg version 6, try to use following commands:
cmake ../ -DDESTDIR="/home/_username_/work/projects/BambuStudio_dep" -DCMAKE_BUILD_TYPE=Release -DDEP_WX_GTK3=1 -DJPEG_VERSION=6

Note: how to check the libjpeg version used by gstreamer?
just goto your gstreamer library directory(for example fedora at /lib64/gstreamer-1.0, ubuntu at /lib/x86_64-linux-gnu/gstreamer-1.0/) execute ldd libgstjpeg.so and find the libjpeg.so.x used
if x is 62, then set JPEG_VERSION to 6, if x is 7 then set JPEG_VERSION to 7, if x is 8 then set JPEG_VERSION to 8 or not set

Note: this flag only affect the liveview of P1P, if you don't care this function, just skip it

3. building the Bambu Studio

create a directory to store the installed files at /home/username/work/projects/BambuStudio/install_dir
cd BambuStudio
mkdir install_dir
mkdir build;cd build

cmake .. -DSLIC3R_STATIC=ON -DSLIC3R_GTK=3 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="/home/_username_/work/projects/BambuStudio_dep/usr/local" -DCMAKE_INSTALL_PREFIX="../install_dir" -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install --config Release -jN (N can be a number between 1 and the max cpu number)

Currently these steps have been verified on ubuntu and fedora,
For more Linux Platforms or script building, we can find the details or help at Bambustudio build for linux(Thanks to all the contributors)
and we will update more details later on this Page.

4. using scripts under ubuntu

currently we support build it using scripts under ubuntu
just execute following commands
cd BambuStudio
./BuildLinux.sh -dsi
the binary and appimage will be generated