From 97b269f9ea9c55f689fb32eaa26c61c1a960bea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drik=20Fuoco?= <105517825+cedrik-fuoco-adsk@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:12:59 -0400 Subject: [PATCH] Adding dockerfile for Rocky Linux 8 and 9 and adding a mention in the documentation (#597) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Adding dockerfile for Rocky Linux 8 and 9 and adding a mention in the documentation ### Linked issues n/a ### Summarize your change. Added dockefiles and updated documentation to reflect that. ### Describe the reason for the change. Adding Dockerfile for Rocky Linux 8 and 9 as a way to build Open RV with ease. ### Describe what you have tested and on which operating system. Rocky Linux 8 ### If possible, provide screenshots. #### Rocky Linux 8 ![rocky8](https://github.com/user-attachments/assets/ed31730a-7dc6-4a83-b78b-b0ccce1fdd4a) #### Rocky Linux 9 ![rocky9](https://github.com/user-attachments/assets/d274164b-b5c2-4e80-91b8-78a957f6045f) --------- Signed-off-by: Cédrik Fuoco --- dockerfiles/Dockerfile.Linux-Rocky8 | 106 ++++++++++++++ dockerfiles/Dockerfile.Linux-Rocky9 | 106 ++++++++++++++ docs/build_system/config_linux_rocky8.md | 173 +++++++++++++++++++++-- docs/build_system/config_linux_rocky9.md | 161 ++++++++++++++++++++- 4 files changed, 534 insertions(+), 12 deletions(-) create mode 100644 dockerfiles/Dockerfile.Linux-Rocky8 create mode 100644 dockerfiles/Dockerfile.Linux-Rocky9 diff --git a/dockerfiles/Dockerfile.Linux-Rocky8 b/dockerfiles/Dockerfile.Linux-Rocky8 new file mode 100644 index 00000000..25d2bb2e --- /dev/null +++ b/dockerfiles/Dockerfile.Linux-Rocky8 @@ -0,0 +1,106 @@ +FROM rockylinux/rockylinux:8.9 + +LABEL maintainer="Open RV maintainer - https://github.com/AcademySoftwareFoundation/OpenRV" + +USER root + +# enable epel crb and devel packages +RUN dnf upgrade -y \ + && dnf install -y epel-release \ + && dnf config-manager --set-enabled powertools \ + && dnf update -y\ + && dnf install -y \ + # RV requirements + alsa-lib-devel \ + autoconf \ + automake \ + avahi-compat-libdns_sd-devel \ + bison \ + bzip2-devel \ + cmake-gui \ + curl-devel \ + diffutils \ + flex \ + git \ + gcc \ + gcc-c++ \ + libXcomposite \ + libXi-devel \ + libaio-devel \ + libffi-devel \ + nasm ncurses-devel \ + nss \ + libtool \ + libxkbcommon \ + libXcomposite \ + libXdamage \ + libXrandr \ + libXtst \ + libXcursor \ + mesa-libGLU \ + mesa-libGLU-devel \ + mesa-libOSMesa \ + mesa-libOSMesa-devel \ + meson \ + openssl-devel \ + patch \ + pulseaudio-libs \ + pulseaudio-libs-glib2 \ + ocl-icd ocl-icd-devel \ + opencl-headers \ + qt5-qtbase-devel \ + readline-devel \ + sqlite-devel \ + sudo \ + tcl-devel \ + tcsh \ + tk-devel \ + wget \ + xz-devel \ + yasm \ + zip \ + zlib-devel \ + systemd-devel \ + # The cmake in dnf is not recent enough, install from the CMake site + && curl -L https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-linux-x86_64.sh -o cmake.sh \ + && sh cmake.sh --prefix=/usr/local/ --skip-license && rm -rf cmake.sh \ + # Clearing dnf caches + && dnf clean all && rm -rf /var/cache/yum + + +ENV PATH=/home/rv/.local/bin:/usr/local/bin:$PATH \ + QT_QPA_PLATFORM=offscreen + +# create and run as user rv +RUN useradd -u 1001 -ms /bin/bash rv +WORKDIR /home/rv +USER rv + +# Download ninja from GitHub to get a more recent version. +RUN wget https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip +RUN unzip ninja-linux.zip -d ./ninja +RUN echo 'export PATH=/home/rv/ninja:$PATH' >> /home/rv/.bash_profile +ENV PATH /home/rv/ninja:$PATH + +# Using pyenv to make sure that python and python3 command points to the same version. +# Install pyenv +RUN git clone http://github.com/pyenv/pyenv.git /home/rv/.pyenv +ENV PYENV_ROOT /home/rv/.pyenv +ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH +RUN echo 'export PYENV_ROOT="/home/rv/.pyenv"' >> ~/.bashrc +RUN echo 'export PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc +RUN echo 'eval "$(pyenv init -)"' >> ~/.bashrc + +# Install specific version of Python +RUN pyenv install 3.10.13 + +# Set as the global version +RUN pyenv global 3.10.13 + +RUN python -m pip install aqtinstall + +RUN python -m aqt install-qt linux desktop 5.15.2 gcc_64 -O ~/Qt \ + -m debug_info qtcharts qtdatavis3d qtlottie qtnetworkauth qtpurchasing qtquick3d qtquicktimeline qtscript qtvirtualkeyboard qtwaylandcompositor qtwebengine qtwebglplugin \ + --archives icu qt3d qtbase qtconnectivity qtdeclarative qtgamepad qtgraphicaleffects qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2 qtremoteobjects qtscxml qtsensors qtserialbus qtserialport qtspeech qtsvg qttools qttranslations qtwayland qtwebchannel qtwebsockets qtwebview qtx11extras qtxmlpatterns + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/dockerfiles/Dockerfile.Linux-Rocky9 b/dockerfiles/Dockerfile.Linux-Rocky9 new file mode 100644 index 00000000..cdce7f54 --- /dev/null +++ b/dockerfiles/Dockerfile.Linux-Rocky9 @@ -0,0 +1,106 @@ +FROM rockylinux/rockylinux:9 + +LABEL maintainer="Open RV maintainer - https://github.com/AcademySoftwareFoundation/OpenRV" + +USER root + +# enable epel crb and devel packages +RUN dnf upgrade -y \ + && dnf install -y epel-release \ + && dnf config-manager --set-enabled crb devel \ + && dnf install -y \ + # RV requirements + alsa-lib-devel \ + autoconf \ + automake \ + avahi-compat-libdns_sd-devel \ + bison \ + bzip2-devel \ + cmake-gui \ + curl-devel \ + diffutils \ + flex \ + git \ + gcc \ + gcc-c++ \ + libXcomposite \ + libXi-devel \ + libaio-devel \ + libffi-devel \ + nasm ncurses-devel \ + nss \ + libtool \ + libxkbcommon \ + libXcomposite \ + libXdamage \ + libXrandr \ + libXtst \ + libXcursor \ + mesa-libGLU \ + mesa-libGLU-devel \ + mesa-libOSMesa \ + mesa-libOSMesa-devel \ + meson \ + ninja-build \ + openssl-devel \ + patch \ + perl-FindBin \ + pulseaudio-libs \ + pulseaudio-libs-glib2 \ + ocl-icd ocl-icd-devel \ + opencl-headers \ + qt5-qtbase-devel \ + readline-devel \ + sqlite-devel \ + sudo \ + tcl-devel \ + tcsh \ + tk-devel \ + wget \ + yasm \ + zip \ + zlib-devel \ + systemd-devel \ + # The cmake in dnf is not recent enough, install from the CMake site + && curl -L https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3-linux-x86_64.sh -o cmake.sh \ + && sh cmake.sh --prefix=/usr/local/ --skip-license && rm -rf cmake.sh \ + # Clearing dnf caches + && dnf clean all && rm -rf /var/cache/yum + + +ENV PATH=/home/rv/.local/bin:/usr/local/bin:$PATH \ + QT_QPA_PLATFORM=offscreen + +# create and run as user rv +RUN useradd -u 1001 -ms /bin/bash rv +WORKDIR /home/rv +USER rv + +# Download ninja from GitHub to get a more recent version. +RUN wget https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip +RUN unzip ninja-linux.zip -d ./ninja +RUN echo 'export PATH=/home/rv/ninja:$PATH' >> /home/rv/.bash_profile +ENV PATH /home/rv/ninja:$PATH + +# Using pyenv to make sure that python and python3 command points to the same version. +# Install pyenv +RUN git clone http://github.com/pyenv/pyenv.git /home/rv/.pyenv +ENV PYENV_ROOT /home/rv/.pyenv +ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH +RUN echo 'export PYENV_ROOT="/home/rv/.pyenv"' >> ~/.bashrc +RUN echo 'export PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc +RUN echo 'eval "$(pyenv init -)"' >> ~/.bashrc + +# Install specific version of Python +RUN pyenv install 3.10.13 + +# Set as the global version +RUN pyenv global 3.10.13 + +RUN python -m pip install aqtinstall + +RUN python -m aqt install-qt linux desktop 5.15.2 gcc_64 -O ~/Qt \ + -m debug_info qtcharts qtdatavis3d qtlottie qtnetworkauth qtpurchasing qtquick3d qtquicktimeline qtscript qtvirtualkeyboard qtwaylandcompositor qtwebengine qtwebglplugin \ + --archives icu qt3d qtbase qtconnectivity qtdeclarative qtgamepad qtgraphicaleffects qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2 qtremoteobjects qtscxml qtsensors qtserialbus qtserialport qtspeech qtsvg qttools qttranslations qtwayland qtwebchannel qtwebsockets qtwebview qtx11extras qtxmlpatterns + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/docs/build_system/config_linux_rocky8.md b/docs/build_system/config_linux_rocky8.md index 716e629a..f01e4141 100644 --- a/docs/build_system/config_linux_rocky8.md +++ b/docs/build_system/config_linux_rocky8.md @@ -3,9 +3,12 @@ ## Summary 1. [Install Basics](#install-basics) -1. [Install tools and build dependencies](#install-tools-and-build-dependencies) -1. [Install CMake](#install-cmake) -1. [Install Qt5](#install-qt) +2. [Install tools and build dependencies](#install-tools-and-build-dependencies) +3. [Install CMake](#install-cmake) +4. [Install Qt5](#install-qt) +5. [Build Open RV](build_rocky8_openrv) + 1. [Building from command line](building_rocky8_from_command_line) + 2. [Building with Docker](building_rocky8_with_docker) ## Install Basics @@ -21,7 +24,7 @@ Some of the build dependencies come from outside the main AppStream repo. So fir ```bash sudo dnf install epel-release -sudo dnf config-manager --set-enabled crb devel +sudo dnf config-manager --set-enabled powertools sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel bison bzip2-devel cmake-gui curl-devel flex gcc gcc-c++ libXcomposite libXi-devel libaio-devel libffi-devel nasm ncurses-devel nss libtool libxkbcommon libXcomposite libXdamage libXrandr libXtst libXcursor mesa-libOSMesa mesa-libOSMesa-devel meson ninja-build openssl-devel patch pulseaudio-libs pulseaudio-libs-glib2 ocl-icd ocl-icd-devel opencl-headers python3 python3-devel qt5-qtbase-devel readline-devel sqlite-devel tcl-devel tcsh tk-devel yasm zip zlib-devel ``` @@ -48,18 +51,18 @@ python3 -m pip install -r requirements.txt ## Install CMake -You need CMake version 3.24+ to build RV. The dnf-installable version is not quite recent enough, you'll to build and install CMake from sources. +You need CMake version 3.27+ to build RV. The dnf-installable version is not quite recent enough, you'll to build and install CMake from sources. ```bash -wget https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0.tar.gz -tar -zxvf cmake-3.24.0.tar.gz -cd cmake-3.24.0 +wget https://github.com/Kitware/CMake/releases/download/v3.30.3/cmake-3.30.3.tar.gz +tar -zxvf cmake-3.30.3.tar.gz +cd cmake-3.30.3 ./bootstrap --parallel=32 # 32 or whatever your machine allows make -j 32 # 32 or whatever your machine allows sudo make install cmake --version # confirm the version of your newly installed version of CMake -cmake version 3.24.0 +cmake version3.30.3 ``` ## Install Qt @@ -67,3 +70,155 @@ cmake version 3.24.0 Download the last version of Qt 5.15.x that you can get using the online installer on the [Qt page](https://www.qt.io/download-open-source). Logs, Android, iOS and WebAssembly are not required to build OpenRV. WARNING: If you fetch Qt from another source, make sure to build it with SSL support, that it contains everything required to build PySide2, and that the file structure is similar to the official package. + + +(build_rocky8_openrv)= +## Build Open RV + +(building_rocky8_from_command_line)= +### Building from command line + +(build_rocky8_openrv1)= +#### Before executing any commands + +To maximize your chances of successfully building Open RV, you must: +- Fully update your code base to the latest version (or the version you want to use) with a command like `git pull`. +- Fix all conflicts due to updating the code. +- Revisit all modified files to ensure they aren't using old code that changed during the update such as when the Visual Studio version changes. + +(build_rocky8_openrv2)= +#### Get Open RV source code + +Clone the Open RV repository and change directory into the newly created folder. Typically, the command would be: + +Using a password-protected SSH key: +```shell +git clone --recursive git@github.com:AcademySoftwareFoundation/OpenRV.git +cd OpenRV +``` + +Using the web URL: +```shell +git clone --recursive https://github.com/AcademySoftwareFoundation/OpenRV.git +cd OpenRV +``` + +(build_rocky8_openrv3)= +#### Load aliases for Open RV + +From the Open RV directory: +```shell +source rvcmds.sh +``` + +(build_rocky8_openrv4)= +#### Install Python dependencies + +````{note} +This section needs to be done only one time when a fresh Open RV repository is cloned. +The first time the `rvsetup` is executed, it will create a Python virtual environment in the current directory under `.venv`. +```` + +From the Open RV directory, the following command will download and install the Python dependencies. +```shell +rvsetup +``` + +(build_rocky8_openrv5)= +#### Configure the project + +From the Open RV directory, the following command will configure CMake for the build: + +````{tabs} +```{code-tab} bash Release +rvcfg +``` +```{code-tab} bash Debug +rvcfgd +``` +```` + +(build_rocky8_openrv6)= +#### Build the dependencies + +From the Open RV directory, the following command will build the dependencies: + +````{tabs} +```{code-tab} bash Release +rvbuildt dependencies +``` +```{code-tab} bash Debug +rvbuildtd dependencies +``` +```` + +(build_rocky8_openrv7)= +#### Build the main executable + +From the Open RV directory, the following command will build the main executable: + +````{tabs} +```{code-tab} bash Release +rvbuildt main_executable +``` +```{code-tab} bash Debug +rvbuildtd main_executable +``` +```` + +(build_rocky8_openrv8)= +#### Opening Open RV executable + +````{tabs} +```{tab} Release +Once the build is completed, the Open RV application can be found in the Open RV directory under `_build/stage/app/bin/rv`. +``` +```{tab} Debug +Once the build is completed, the Open RV application can be found in the Open RV directory under `_build_debug/stage/app/bin/rv``. +``` +```` + +(building_rocky8_with_docker)= +### Building with Docker (Optional) + +To build Open RV using Docker, utilize the provided Dockerfile, which includes all required dependencies. + +(build_rocky8_image)= +#### Build the image +```bash +cd dockerfiles +docker build -t openrv-rocky8 -f Dockerfile.Linux-Rocky8 . +``` + +(run_rocky8_image)= +#### Create the container +```bash +docker run -d openrv-rocky8 /bin/bash -c "sleep infinity" +``` + +(go_into_the_rocky8_container)= +#### Go into the container +```bash +# Lookup the container id for openrv-rocky8 +docker container ls + +# Use the container id to go into it. +# e.g. +# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +# 59e7878debc4 openrv-rocky8 "/bin/bash -c 'sleep…" 21 minutes ago Up 21 minutes crazy_pare +# In this example, the would be 59e7878debc4. +docker container exec -it /bin/bash +``` + +Once you are into the container, you can follow the [standard process](build_rocky8_openrv2). + +#### Copy the stage folder outside of the container + +If you are on a host that is compatible with Rocky Linux 8, you can copy the stage folder outside of the container and +execute Open RV. + +Container id is the same as the one used in the step [Go into the container](go_into_the_rocky8_container). + +```bash +docker cp :/home/rv/OpenRV/_build/stage ./openrv_stage +``` \ No newline at end of file diff --git a/docs/build_system/config_linux_rocky9.md b/docs/build_system/config_linux_rocky9.md index f577d075..5f300d52 100644 --- a/docs/build_system/config_linux_rocky9.md +++ b/docs/build_system/config_linux_rocky9.md @@ -3,9 +3,12 @@ ## Summary 1. [Install Basics](#install-basics) -1. [Install tools and build dependencies](#install-tools-and-build-dependencies) -1. [Install CMake](#install-cmake) -1. [Install Qt5](#install-qt) +2. [Install tools and build dependencies](#install-tools-and-build-dependencies) +3. [Install CMake](#install-cmake) +4. [Install Qt5](#install-qt) +5. [Build Open RV](build_rocky9_openrv) + 1. [Building from command line](building_rocky9_from_command_line) + 2. [Building with Docker](building_rocky9_with_docker) ## Install Basics @@ -59,3 +62,155 @@ python3 -m pip install -r requirements.txt Download the last version of Qt 5.15.x that you can get using the online installer on the [Qt page](https://www.qt.io/download-open-source). During Qt Setup's Select Components phase, check the "Archive" box on the right side of the window then click on "Filter" to see Qt 5.15.x options. Logs, Android, iOS and WebAssembly are not required to build OpenRV. Make sure to note the destination of the Qt install, as you will have to set the `QT_HOME` environment variable to this location's build dir. WARNING: If you fetch Qt from another source, make sure to build it with SSL support, that it contains everything required to build PySide2, and that the file structure is similar to the official package. + + +(build_rocky9_openrv)= +## Build Open RV + +(building_rocky9_from_command_line)= +### Building from command line + +(build_rocky9_openrv1)= +#### Before executing any commands + +To maximize your chances of successfully building Open RV, you must: +- Fully update your code base to the latest version (or the version you want to use) with a command like `git pull`. +- Fix all conflicts due to updating the code. +- Revisit all modified files to ensure they aren't using old code that changed during the update such as when the Visual Studio version changes. + +(build_rocky9_openrv2)= +#### Get Open RV source code + +Clone the Open RV repository and change directory into the newly created folder. Typically, the command would be: + +Using a password-protected SSH key: +```shell +git clone --recursive git@github.com:AcademySoftwareFoundation/OpenRV.git +cd OpenRV +``` + +Using the web URL: +```shell +git clone --recursive https://github.com/AcademySoftwareFoundation/OpenRV.git +cd OpenRV +``` + +(build_rocky9_openrv3)= +#### Load aliases for Open RV + +From the Open RV directory: +```shell +source rvcmds.sh +``` + +(build_rocky9_openrv4)= +#### Install Python dependencies + +````{note} +This section needs to be done only one time when a fresh Open RV repository is cloned. +The first time the `rvsetup` is executed, it will create a Python virtual environment in the current directory under `.venv`. +```` + +From the Open RV directory, the following command will download and install the Python dependencies. +```shell +rvsetup +``` + +(build_rocky9_openrv5)= +#### Configure the project + +From the Open RV directory, the following command will configure CMake for the build: + +````{tabs} +```{code-tab} bash Release +rvcfg +``` +```{code-tab} bash Debug +rvcfgd +``` +```` + +(build_rocky9_openrv6)= +#### Build the dependencies + +From the Open RV directory, the following command will build the dependencies: + +````{tabs} +```{code-tab} bash Release +rvbuildt dependencies +``` +```{code-tab} bash Debug +rvbuildtd dependencies +``` +```` + +(build_rocky9_openrv7)= +#### Build the main executable + +From the Open RV directory, the following command will build the main executable: + +````{tabs} +```{code-tab} bash Release +rvbuildt main_executable +``` +```{code-tab} bash Debug +rvbuildtd main_executable +``` +```` + +(build_rocky9_openrv8)= +#### Opening Open RV executable + +````{tabs} +```{tab} Release +Once the build is completed, the Open RV application can be found in the Open RV directory under `_build/stage/app/bin/rv`. +``` +```{tab} Debug +Once the build is completed, the Open RV application can be found in the Open RV directory under `_build_debug/stage/app/bin/rv``. +``` +```` + +(building_rocky9_with_docker)= +### Building with Docker (Optional) + +To build Open RV using Docker, utilize the provided Dockerfile, which includes all required dependencies. + +(build_rocky9_image)= +#### Build the image +```bash +cd dockerfiles +docker build -t openrv-rocky9 -f Dockerfile.Linux-Rocky9 . +``` + +(run_rocky9_image)= +#### Create the container +```bash +docker run -d openrv-rocky9 /bin/bash -c "sleep infinity" +``` + +(go_into_the_rocky9_container)= +#### Go into the container +```bash +# Lookup the container id for openrv-rocky9 +docker container ls + +# Use the container id to go into it. +# e.g. +# CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +# 1f6a1104a1f4 openrv-rocky9 "/bin/bash -c 'sleep…" 25 minutes ago Up 25 minutes busy_sanderson +# In this example, the would be 1f6a1104a1f4. +docker container exec -it /bin/bash +``` + +Once you are into the container, you can follow the [standard process](build_rocky9_openrv2). + +#### Copy the stage folder outside of the container + +If you are on a host that is compatible with Rocky Linux 9, you can copy the stage folder outside of the container and +execute Open RV. + +Container id is the same as the one used in the step [Go into the container](go_into_the_rocky9_container). + +```bash +docker cp :/home/rv/OpenRV/_build/stage ./openrv_stage +``` \ No newline at end of file