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..." 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 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 */ 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@" "\$@"