From cf44bd4028269e5379229ff804305bf3b084cf55 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 7 Nov 2024 10:36:25 -0800 Subject: [PATCH 1/4] Add Dockerfile --- Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ tests_done.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 Dockerfile create mode 100644 tests_done.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..7122e587a7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:24.04 + +RUN apt-get update && apt-get install -y software-properties-common wget fzf + +RUN add-apt-repository ppa:kisak/kisak-mesa -y && apt update && apt upgrade -y + +# RUN apt-get update && apt-get install -y \ +# mesa-utils \ +# libgl1-mesa-dri \ +# libgl1-mesa-glx \ +# && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install -y \ + mesa-utils \ + libgl1 \ + libglx-mesa0 + +WORKDIR /Software +COPY . . + +# Redirecting sudo to a dummy command +RUN echo "#!/bin/bash\n\$@" > /usr/bin/sudo +RUN chmod +x /usr/bin/sudo + +# Setup the sofrware environment +RUN chmod +x ./environment_setup/setup_software.sh && ./environment_setup/setup_software.sh + +# Build bazel cache +# RUN ["bazel", "build", "//software/thunderscope:thunderscope_main"] + +ENV QMLSCENE_DEVICE=softwarecontext +ENV QT_OPENGL=software +ENV LIBGL_ALWAYS_SOFTWARE=1 +ENV LIBGL_ALWAYS_INDIRECT=1 + + +WORKDIR /Software/src +CMD ["/bin/bash"] + diff --git a/tests_done.sh b/tests_done.sh new file mode 100644 index 0000000000..addb95d042 --- /dev/null +++ b/tests_done.sh @@ -0,0 +1,33 @@ +# Run on Ubu24 +sudo docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v /home/minghao/.cache/bazel:/root/.cache/bazel --name test test:latest + +# Run on Mac +sudo docker run --rm -it -e DISPLAY=host.docker.internal:0 --mount type=bind,source=$HOME/Programs/Thunderbot/.cache/bazel,target=/root/.cache/bazel --mount type=bind,source=$HOME/Programs/Thunderbot/Software,target=/Software -v /tmp/.X11-unix:/tmp/.X11-unix --privileged --name testv1 --net=host test:0.1 + +# Run bazel inside docker +bazel run //software/thunderscope:thunderscope_main + + +# Clearing: +sudo docker system prune + +# Building: +sudo docker build -t test:latest . + + +# To fix -> MESA: error: ZINK: failed to choose pdev & glx: failed to create drisw screen + +sudo add-apt-repository ppa:kisak/kisak-mesa -y && sudo apt update && sudo apt upgrade -y + +export QMLSCENE_DEVICE=softwarecontext +export QT_OPENGL=software +export LIBGL_ALWAYS_SOFTWARE=1 + +# To fix -> No matching fbConfigs or visuals found +export LIBGL_ALWAYS_INDIRECT=1 + +apt-get update && apt-get install -y libglvnd-dev libxi-dev libxrandr-dev libx11-dev libfontconfig1-dev libfreetype6-dev qt5-qmake qtbase5-dev qtchooser qtbase5-dev-tools xvfb mesa-utils gdb + +# opengl testing command +glxinfo +glxgears From e58029e4eab7f802421a12acb745c5d72698b6c9 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 7 Nov 2024 10:48:35 -0800 Subject: [PATCH 2/4] Add IGLX command --- tests_done.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests_done.sh b/tests_done.sh index addb95d042..d02eba4075 100644 --- a/tests_done.sh +++ b/tests_done.sh @@ -31,3 +31,6 @@ apt-get update && apt-get install -y libglvnd-dev libxi-dev libxrandr # opengl testing command glxinfo glxgears + +# Enable IGLX on host +defaults write org.xquartz.X11 enable_iglx -bool true From 537301afe1a8fdaa70ddef22d3b23f479260e7b2 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 7 Nov 2024 20:32:34 -0800 Subject: [PATCH 3/4] add X11 test programs into dependencies --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7122e587a7..f056ebf4e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ FROM ubuntu:24.04 -RUN apt-get update && apt-get install -y software-properties-common wget fzf +RUN apt-get update && apt-get install -y software-properties-common wget fzf x11-apps -RUN add-apt-repository ppa:kisak/kisak-mesa -y && apt update && apt upgrade -y +# RUN add-apt-repository ppa:kisak/kisak-mesa -y && apt update && apt upgrade -y +RUN add-apt-repository ppa:oibaf/graphics-drivers -y && apt update && apt upgrade -y # RUN apt-get update && apt-get install -y \ # mesa-utils \ From c69d268fe5bf794704d063f05d4f83e25ee842de Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Fri, 8 Nov 2024 08:51:54 -0800 Subject: [PATCH 4/4] add another cache folder --- tests_done.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests_done.sh b/tests_done.sh index d02eba4075..75bb3f0371 100644 --- a/tests_done.sh +++ b/tests_done.sh @@ -1,8 +1,8 @@ # Run on Ubu24 -sudo docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v /home/minghao/.cache/bazel:/root/.cache/bazel --name test test:latest +sudo docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v $HOME/.cache:/root/.cache --name test test:latest # Run on Mac -sudo docker run --rm -it -e DISPLAY=host.docker.internal:0 --mount type=bind,source=$HOME/Programs/Thunderbot/.cache/bazel,target=/root/.cache/bazel --mount type=bind,source=$HOME/Programs/Thunderbot/Software,target=/Software -v /tmp/.X11-unix:/tmp/.X11-unix --privileged --name testv1 --net=host test:0.1 +sudo docker run --rm -it -e DISPLAY=host.docker.internal:0 --mount type=bind,source=$HOME/Programs/Thunderbot/.cache,target=/root/.cache --mount type=bind,source=$HOME/Programs/Thunderbot/Software,target=/Software -v /tmp/.X11-unix:/tmp/.X11-unix --privileged --name testv1 --net=host test:0.1 # Run bazel inside docker bazel run //software/thunderscope:thunderscope_main @@ -33,4 +33,5 @@ glxinfo glxgears # Enable IGLX on host +xhost + defaults write org.xquartz.X11 enable_iglx -bool true