From 91db1be09e0a3c693583e656d5fe5f4d01a5709f Mon Sep 17 00:00:00 2001 From: deftdawg Date: Tue, 22 Nov 2022 03:24:38 -0500 Subject: [PATCH 1/4] Add sigxcpu76's fix to force use of light GTK theme When using Bambu Studio with a dark themed Linux desktop, many of the dialogs appear as white text on a white background (font's correctly invert, but dialogs remain white). @sigxcpu76 provided a workaround for this in #12 which is to tell the app to use a light GTK theme. This change incorporates that workaround into the AppImage making the app more usable until such time as proper dark theme support can be added to Bambu Studio. --- src/platform/unix/BuildLinuxImage.sh.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platform/unix/BuildLinuxImage.sh.in b/src/platform/unix/BuildLinuxImage.sh.in index 20e7e46450..13921dd400 100644 --- a/src/platform/unix/BuildLinuxImage.sh.in +++ b/src/platform/unix/BuildLinuxImage.sh.in @@ -43,6 +43,8 @@ export LD_LIBRARY_PATH="\$DIR/bin" # 1) BambuStudio will segfault on systems where locale info is not as expected (i.e. Holo-ISO arch-based distro) # 2) BambuStudio will segfault with a boost logging error if ~/.config/BambuStudio doesn't exist on first run export LC_ALL=C +# FIXME: BambuStudio doesn't respect dark mode; use GTK_THEME workaround from sigxcpu76 │ +export GTK_THEME=Adwaita:light mkdir -p \${HOME}/.config/BambuStudio/ 2> /dev/null exec "\$DIR/bin/@SLIC3R_APP_CMD@" "\$@" From e434009577a54577b06d45eb5d4adb16b09780a1 Mon Sep 17 00:00:00 2001 From: deftdawg Date: Thu, 8 Dec 2022 15:01:49 -0500 Subject: [PATCH 2/4] Update Containerfile to make it Docker compatible - Replace COPY command with Docker compatible syntax - Rename container tag to bambu-studio-builder so as to not confuse with a container that would actually run Bambu Studio - Add Docker alternative build method (thx @SG-R) - Update podman syntax to remove unnecessary sudo --- Containerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Containerfile b/Containerfile index 26be20cea3..4969b3dede 100644 --- a/Containerfile +++ b/Containerfile @@ -1,16 +1,22 @@ # Build Bambu Slicer in a container # -# Build an AppImage: -# rm -rf build; sudo podman build . -t bambu-studio && sudo podman run --rm localhost/bambu-studio /bin/bash -c 'tar -c $(find build | grep ubu64.AppImage | head -1)' | tar -xv +# Build an AppImage using rootless Podman (refer to https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md): +# rm -rf build; podman build . -t bambu-studio-builder && podman run --rm localhost/bambu-studio-builder /bin/bash -c 'tar -c $(find build | grep ubu64.AppImage | head -1)' | tar -xv # # Troubleshooting the build container: -# sudo podman run -it --name bambu-studio localhost/bambu-studio /bin/bash +# podman run -it --name bambu-studio-builder localhost/bambu-studio-builder /bin/bash # # Debugging the resulting AppImage: # 1) Install `gdb` # 2) In a terminal in the same directory as the AppImage, start it with following: # echo -e "run\nbt\nquit" | gdb ./BambuStudio_ubu64.AppImage # 3) Find related issue using backtrace output for clues and add backtrace to it on github +# +# Docker alternative AppImage build syntax (use this if you can't install podman): +# rm -rf build; docker build . --file Containerfile -t bambu-studio-builder; docker run --rm bambu-studio-builder /bin/bash -c 'tar -c $(find build | grep ubu64.AppImage | head -1)' | tar -xv +# +# +# TODO: bind mount BambuStudio to inside the container instead of COPY to enable faster rebuilds during dev work. FROM docker.io/ubuntu:20.04 LABEL maintainer "DeftDawg " @@ -46,7 +52,7 @@ RUN apt-get update && apt-get install -y \ file \ sudo -COPY ../BambuStudio BambuStudio +COPY ./ BambuStudio WORKDIR BambuStudio From 51e87881675034c75a9830678519d04536ef768d Mon Sep 17 00:00:00 2001 From: deftdawg Date: Thu, 8 Dec 2022 18:35:48 -0500 Subject: [PATCH 3/4] Add check_available_memory_and_disk to BuildLinux.sh --- BuildLinux.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/BuildLinux.sh b/BuildLinux.sh index 6bdbf14647..f862d4cc0c 100755 --- a/BuildLinux.sh +++ b/BuildLinux.sh @@ -7,6 +7,26 @@ export CMAKE_BUILD_PARALLEL_LEVEL=${NCORES} FOUND_GTK2=$(dpkg -l libgtk* | grep gtk2) FOUND_GTK3=$(dpkg -l libgtk* | grep gtk-3) +function check_available_memory_and_disk() { + FREE_MEM_GB=$(free -g -t | grep 'Mem:' | rev | cut -d" " -f1 | rev) + MIN_MEM_GB=10 + + FREE_DISK_KB=$(df -k . | tail -1 | awk '{print $4}') + MIN_DISK_KB=$((10 * 1024 * 1024)) + + if [ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]; then + echo -e "\nERROR: Bambu Studio Builder requires at least ${MIN_MEM_GB}G of 'available' mem (systen has only ${FREE_MEM_GB}G available)" + echo && free -h && echo + exit 2 + fi + + if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]]; then + echo -e "\nERROR: Bambu Studio Builder requires at least $(echo $MIN_DISK_KB |awk '{ printf "%.1fG\n", $1/1024/1024; }') (systen has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)" + echo && df -h . && echo + exit 1 + fi +} + unset name while getopts ":dsiuhgb" opt; do case ${opt} in @@ -133,6 +153,8 @@ then mkdir deps/build fi +check_available_memory_and_disk + if [[ -n "$BUILD_DEPS" ]] then echo "[3/9] Configuring dependencies..." From 7e96cbf7da0ffac6947b2a8f1885eb4057af03a0 Mon Sep 17 00:00:00 2001 From: hifihedgehog <16614343+hifihedgehog@users.noreply.github.com> Date: Wed, 30 Nov 2022 15:54:36 -0500 Subject: [PATCH 4/4] Fixes #740 Removing check for local or Remote FX virtualized RDP session. The checks below this line already verify if proper OpenGL support is present. --- src/BambuStudio_app_msvc.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/BambuStudio_app_msvc.cpp b/src/BambuStudio_app_msvc.cpp index 41fee09012..9aa386bfe9 100644 --- a/src/BambuStudio_app_msvc.cpp +++ b/src/BambuStudio_app_msvc.cpp @@ -250,9 +250,6 @@ int wmain(int argc, wchar_t **argv) bool load_mesa = // Forced from the command line. force_mesa || - // Running over a rempote desktop, and the RemoteFX is not enabled, therefore Windows will only provide SW OpenGL 1.1 context. - // In that case, use Mesa. - ::GetSystemMetrics(SM_REMOTESESSION) || // Try to load the default OpenGL driver and test its context version. ! opengl_version_check.load_opengl_dll() || ! opengl_version_check.is_version_greater_or_equal_to(2, 0); #endif /* SLIC3R_GUI */