diff --git a/Dockerfile b/Dockerfile index d9b6e3c3..bc7c7606 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,8 @@ ARG BASE_TAG=ubuntu-22.04 ARG BASE_TAG=python-3.10.6 FROM $BASE_CONTAINER:$BASE_TAG +ARG BUILD_TYPE=Release + LABEL maintainer="Xeus-clang-repl Project" #LABEL com.nvidia.volumes.needed="nvidia_driver" @@ -29,26 +31,28 @@ ENV LC_ALL=en_US.UTF-8 \ # Install all OS dependencies for notebook server that starts but lacks all # features (e.g., download as all possible file formats) RUN \ + set -x && \ apt-get update --yes && \ apt-get install --yes --no-install-recommends pciutils && \ - _CUDA_=$(lspci -nn | grep '\[03' | grep NVIDIA) && \ + lspci && \ + export _CUDA_="$(lspci -nn | grep '\[03' | grep NVIDIA)" && \ apt-get install --yes --no-install-recommends \ - #fonts-liberation, pandoc, run-one are inherited from base-notebook container image + #fonts-liberation, pandoc, run-one are inherited from base-notebook container image # Other "our" apt installs - unzip \ - curl \ - jq \ - ###libomp-dev \ + unzip \ + curl \ + jq \ + ###libomp-dev \ # Other "our" apt installs (development and testing) - build-essential \ - git \ - nano-tiny \ - less \ - gdb valgrind \ - emacs \ + build-essential \ + git \ + nano-tiny \ + less \ + gdb valgrind \ + emacs \ # CUDA - #cuda \ - $([ -n "$_CUDA_" ] && echo nvidia-cuda-toolkit) \ + #cuda \ + $([ -n "$_CUDA_" ] && echo nvidia-cuda-toolkit) \ && \ apt-get clean && rm -rf /var/lib/apt/lists/* && \ echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ @@ -246,7 +250,7 @@ RUN \ mkdir build && \ cd build && \ export CPPINTEROP_BUILD_DIR=$PWD && \ - cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_CLING=OFF -DUSE_REPL=ON -DLLVM_DIR=$PATH_TO_LLVM_BUILD -DLLVM_USE_LINKER=gold -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR .. && \ + cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_CLING=OFF -DUSE_REPL=ON -DLLVM_DIR=$PATH_TO_LLVM_BUILD -DLLVM_USE_LINKER=gold -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR .. && \ cmake --build . --parallel $(nproc --all) && \ #make install -j$(nproc --all) export CPLUS_INCLUDE_PATH="$CPPINTEROP_DIR/include:$CPLUS_INCLUDE_PATH" && \ @@ -262,7 +266,7 @@ RUN \ # Install CppInterOp (cd $CPPINTEROP_BUILD_DIR && cmake --build . --target install --parallel $(nproc --all)) && \ # Build and Install cppyy-backend - cmake -DCMAKE_BUILD_TYPE=Debug -DCppInterOp_DIR=$CPPINTEROP_DIR .. && \ + cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCppInterOp_DIR=$CPPINTEROP_DIR .. && \ cmake --build . --parallel $(nproc --all) && \ cp libcppyy-backend.so $CPPINTEROP_DIR/lib/ && \ cd ../.. && \ @@ -273,7 +277,7 @@ RUN \ git clone https://github.com/compiler-research/CPyCppyy.git && \ cd CPyCppyy && \ mkdir build && cd build && \ - cmake -DCMAKE_BUILD_TYPE=Debug .. && \ + cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && \ cmake --build . --parallel $(nproc --all) && \ export CPYCPPYY_DIR=$PWD && \ cd ../.. && \ @@ -301,7 +305,7 @@ RUN \ cd build && \ echo "export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> ~/.profile && \ ##echo "conda activate .venv" >> ~/.profile - cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_CMAKE_DIR=$PATH_TO_LLVM_BUILD -DCMAKE_PREFIX_PATH=$KERNEL_PYTHON_PREFIX -DCMAKE_INSTALL_PREFIX=$KERNEL_PYTHON_PREFIX -DCMAKE_INSTALL_LIBDIR=lib -DLLVM_CONFIG_EXTRA_PATH_HINTS=${PATH_TO_LLVM_BUILD}/lib -DCPPINTEROP_DIR=$CPPINTEROP_BUILD_DIR -DLLVM_USE_LINKER=gold .. && \ + cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_CMAKE_DIR=$PATH_TO_LLVM_BUILD -DCMAKE_PREFIX_PATH=$KERNEL_PYTHON_PREFIX -DCMAKE_INSTALL_PREFIX=$KERNEL_PYTHON_PREFIX -DCMAKE_INSTALL_LIBDIR=lib -DLLVM_CONFIG_EXTRA_PATH_HINTS=${PATH_TO_LLVM_BUILD}/lib -DCPPINTEROP_DIR=$CPPINTEROP_BUILD_DIR -DLLVM_USE_LINKER=gold .. && \ make install -j$(nproc --all) && \ cd .. && \ # @@ -311,8 +315,9 @@ RUN \ cd clad && \ mkdir build && \ cd build && \ - cmake -DCMAKE_BUILD_TYPE=Debug .. -DClang_DIR=${PATH_TO_LLVM_BUILD}/lib/cmake/clang/ -DLLVM_DIR=${PATH_TO_LLVM_BUILD}/lib/cmake/llvm/ -DCMAKE_INSTALL_PREFIX=${CONDA_DIR} -DLLVM_EXTERNAL_LIT="$(which lit)" && \ - make -j$(nproc --all) && \ + cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. -DClang_DIR=${PATH_TO_LLVM_BUILD}/lib/cmake/clang/ -DLLVM_DIR=${PATH_TO_LLVM_BUILD}/lib/cmake/llvm/ -DCMAKE_INSTALL_PREFIX=${CONDA_DIR} -DLLVM_EXTERNAL_LIT="$(which lit)" && \ + #make -j$(nproc --all) && \ + make && \ make install && \ ### install clad in all exist kernels ##for i in "$KERNEL_PYTHON_PREFIX"/share/jupyter/kernels/*; do if [[ $i =~ .*/clad-xcpp.* ]]; then jq '.argv += ["-fplugin=$KERNEL_PYTHON_PREFIX/lib/clad.so"] | .display_name += " (with clad)"' "$i"/kernel.json > tmp.$$.json && mv tmp.$$.json "$i"/kernel.json; fi; done && \