Code Monkey home page Code Monkey logo

slicerbuildenvironment's Introduction

Slicer Build Environment

This project is under active development. Its content, API and behavior may change at any time. We mean it.

Overview

This project streamlines the continuous integration (CI) and allows anyone to easily reproduce builds. Currently, it contains only a Docker directory that itself contain a sub-directory associated with each available build environment.

SlicerBuildEnvironment
  |
  |--- Docker
          |--- qt4-centos5
          |          |--- Dockerfile
          |
          |--- qt4-ubuntu1004
          |          |--- Dockerfile
          |
          |--- qt5-centos7
          |          |--- Dockerfile
          |
          |--- Makefile

Docker-based Environments

Each sub-directory (e.g qt5-centos7) contains a Dockerfile allowing to generate a reusable build environment (or docker image). That build environment includes a version of qt (e.g qt5) and is based on a given operating system (e.g centos5).

Supported build environments

slicer/buildenv-qt5-centos7:slicer-4.11-2018.10.17
buildenv-qt5-centos7-slicer-4.11-2018.10.17 Build environment based on Centos7 and including Qt 5.11.2, GCC 5, CMake 3.13.4
slicer/buildenv-qt5-centos7:slicer-4.11-2020.05.27
buildenv-qt5-centos7-slicer-4.11-2020.05.27 Build environment based on Centos7 and including Qt 5.12.8, GCC 5, CMake 3.17.1
slicer/buildenv-qt5-centos7:slicer-4.11-2020.09.30
buildenv-qt5-centos7-slicer-4.11-2020.09.30 Build environment based on Centos7 and including Qt 5.15.1, GCC 5, CMake 3.17.1
slicer/buildenv-qt5-centos7:slicer-4.11-2021.02.26
buildenv-qt5-centos7-slicer-4.11-2021.02.26 Build environment based on Centos7 and including Qt 5.15.1, GCC 5, CMake 3.17.1
slicer/buildenv-qt5-centos7:slicer-4.13-2021.10.07
buildenv-qt5-centos7-slicer-4.13-2021.10.07 Build environment based on Centos7 and including Qt 5.15.2, GCC 5, CMake 3.17.1
slicer/buildenv-qt5-centos7:slicer-4.13-2022.01.20
buildenv-qt5-centos7-slicer-4.13-2022.01.20 Build environment based on Centos7 and including Qt 5.15.2, GCC 7, CMake 3.17.1
slicer/buildenv-qt5-centos7:slicer-5.0
buildenv-qt5-centos7-slicer-5.0 Build environment based on Centos7 and including Qt 5.15.2, GCC 7, CMake 3.22.1
slicer/buildenv-qt5-centos7:slicer-5.2
buildenv-qt5-centos7-slicer-5.2 Build environment based on Centos7 and including Qt 5.15.2, GCC 7, CMake 3.22.1
slicer/buildenv-qt5-centos7:slicer-5.4
buildenv-qt5-centos7-slicer-5.4 Build environment based on Centos7 and including Qt 5.15.2, GCC 7, CMake 3.22.1
slicer/buildenv-qt5-centos7:slicer-5.6
buildenv-qt5-centos7-slicer-5.6 Build environment based on Centos7 and including Qt 5.15.2, GCC 7, CMake 3.22.1
slicer/buildenv-qt5-centos7:latest
buildenv-qt5-centos7-latest Build environment based on Centos7 and including Qt 5.15.2, GCC 7, CMake 3.22.1

Deprecated build environments

slicer/buildenv-qt4-ubuntu1004:latest
buildenv-qt4-ubuntu1004-latest Build environment based on Ubuntu 10.04 and including Qt 4.8.6, GCC 4, CMake 3.11.0
slicer/buildenv-qt4-centos5:latest
buildenv-qt4-centos5-latest Build environment based on Centos5 and including Qt 4.8.7, GCC 4, CMake 3.11.0
slicer/buildenv-qt5-centos7:slicer-4.10
buildenv-qt5-centos7-slicer-4.10 Build environment based on Centos7 and including Qt 5.11.2, GCC 5, CMake 3.12.1

Visual Overview

graph TD;
subgraph library[Base image]
  centos5;
  ubuntu1004;
  centos7-gcc5[centos7];
  centos7-gcc7[centos7];
end
subgraph dockbuild[Dockbuild image]
  db-centos5[centos5-devtoolset2-gcc4];
  db-ubuntu1004[ubuntu1004-gcc4]
  db-centos7-gcc5[centos7-devtoolset4-gcc5]
  db-centos7-gcc7[centos7-devtoolset7-gcc7]
end
subgraph slicer[SlicerBuildEnvironment image]
  buildenv-qt4-centos5;
  buildenv-qt4-ubuntu1004;
  buildenv-qt5-centos7-gcc5[...\nbuildenv-qt5-centos7:slicer-4.13-2021.10.07];
  buildenv-qt5-centos7-gcc7[buildenv-qt5-centos7:slicer-4.13-2022.01.20\nbuildenv-qt5-centos7:slicer-5.0\nbuildenv-qt5-centos7:slicer-5.2\nbuildenv-qt5-centos7:latest];
end
centos5 --> db-centos5;
db-centos5 --> buildenv-qt4-centos5;

ubuntu1004 --> db-ubuntu1004;
db-ubuntu1004 --> buildenv-qt4-ubuntu1004;

centos7-gcc5 --> db-centos7-gcc5;
db-centos7-gcc5 --> buildenv-qt5-centos7-gcc5;

centos7-gcc7 --> db-centos7-gcc7;
db-centos7-gcc7 --> buildenv-qt5-centos7-gcc7;

classDef dep stroke-dasharray: 5 5;
class centos5,db-centos5 dep;
class ubuntu1004,db-ubuntu1004 dep;
class centos7-gcc5,db-centos7-gcc5 dep;
class centos7-gcc7,db-centos7-gcc7 dep;

classDef builenv fill:#0B7CBC
class buildenv-qt4-centos5 builenv;
class buildenv-qt4-ubuntu1004 builenv;
class buildenv-qt5-centos7-gcc5 builenv;
class buildenv-qt5-centos7-gcc7 builenv;
Loading

dockbuild

The interesting part is that the recipe associated with each SlicerBuildEnvironment image is only responsible to install (or build) Qt, the remaining of the tools forming the complete compiling environment are provided by some other base images provided by the dockbuild project.

dockbuild is a project responsible to create base docker image that includes a tested compiling environment, latest git version, cmake, ninja, python 3 and openssh-client. And also a convenience entrypoint allowing to automatically mount the current working directory into the image.

dockbuild was itself inspired by dockcross, a collection of docker image providing cross-compiling environment. It even re-use the same tests and entrypoint script.

Tutorials

How to download an existing docker image ?

To download the latest version of the qt5-centos7 image:

docker pull slicer/buildenv-qt5-centos7:latest

How to install a docker based environment ?

This image does not need to be run manually. Instead, there is a helper script to execute build commands on source code existing on the local host filesystem. This script is bundled with the image.

To install the helper script, run one of the images with no arguments, and redirect the output to a file:

::
env_name=ENV_NAME script=~/bin/slicer-buildenv-${env_name} docker run --rm slicer/buildenv-${env_name} > $script chmod +x $script

For example, to install the script associated with the latest qt5-centos7 images:

env_name=qt5-centos7
script=~/bin/slicer-buildenv-${env_name}
docker run --rm slicer/buildenv-${env_name} > $script
chmod +x $script

How to locally build the docker images ?

To build all images:

cd Docker
export QT_ACCOUNT_LOGIN=XXX
export QT_ACCOUNT_PASSWORD=XXX
make

To build a specific image:

cd Docker
export QT_ACCOUNT_LOGIN=XXX
export QT_ACCOUNT_PASSWORD=XXX
make qt5-centos7

Important:

  • Setting QT_ACCOUNT_LOGIN and QT_ACCOUNT_PASSWORD variables should NOT be done if the images are built using public continuous integration services. If this is needed, approach like what is done in rabits/dockerfiles should be implemented.
  • Setting these variables is appropriate only in the case of building the docker images from build machines with restricted access.

Configure, build and package Slicer for Linux

The following steps will:

  • download Slicer 4.8.1 source code
  • download the associated build environment
  • configure, build and package Slicer
ROOT_DIR=/tmp/Slicer481
mkdir -p $ROOT_DIR

cd ${ROOT_DIR}

# Download sources
svn co http://svn.slicer.org/Slicer4/branches/Slicer-4-8 Slicer -r 26813

# Download corresponding build environment and generate convenience script
docker run --rm slicer/buildenv-qt4-ubuntu1004 > ~/bin/slicer-buildenv-qt4-ubuntu1004
chmod u+x ~/bin/slicer-buildenv-qt4-ubuntu1004

# Configure Slicer
slicer-buildenv-qt4-ubuntu1004 cmake \
  -BSlicer-build -HSlicer \
  -GNinja \
  -DCMAKE_BUILD_TYPE:STRING=Release \
  -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF \
  -DSlicer_BUILD_CLI:BOOL=OFF \
  -DSlicer_USE_SimpleITK:BOOL=OFF \
  -DBUILD_TESTING:BOOL=OFF

# Build Slicer
slicer-buildenv-qt4-ubuntu1004 cmake --build Slicer-build

# Package Slicer
slicer-buildenv-qt4-ubuntu1004 cmake --build Slicer-build/Slicer-build --target package

Configure, build and package a Slicer extension for Linux

The following steps will:

  • download an extension source code
  • configure, build and package the extension using the build generated in the previous tutorial
ROOT_DIR=/tmp/Slicer481

cd ${ROOT_DIR}

EXTENSION_NAME=ImageMaker

# Download extension source
git clone git://github.com/finetjul/ImageMaker ${EXTENSION_NAME}

# Configure the extension
slicer-buildenv-qt4-ubuntu1004 cmake \
  -B${EXTENSION_NAME}-build -H${EXTENSION_NAME} \
  -GNinja \
  -DCMAKE_BUILD_TYPE:STRING=Release \
  -DSlicer_DIR:PATH=/work/Slicer-build/Slicer-build


# Hint: /work is the working directory in the image, it corresponds to
#       the directory from which the script `slicer-buildenv-qt4-ubuntu1004` is called.


# Build the extension
slicer-buildenv-qt4-ubuntu1004 cmake --build ${EXTENSION_NAME}-build

# Package the extension
slicer-buildenv-qt4-ubuntu1004 cmake --build ${EXTENSION_NAME}-build --target package

Maintainers

Tagging a build environment image

  1. Choose a tag (e.g slicer-X.Y)
TAG=<name-of-tag>
  1. Update Docker/Makefile with the chosen tag
sed -i -E "s/^TAG = .+$/TAG = ${TAG}/g" Docker/Makefile
  1. Add an entry in README.rst referencing the chosen tag
Since the image has not yet been published, specify sha256-UNKNOWN as image hash.
  1. Commit the changes
git add README.rst Docker/Makefile
git commit -m "Set TAG to ${TAG}"
  1. Build and publish an image
cd Docker
make <name-of-image>
make <name-of-image>.push
  1. Update Docker/Makefile with the "latest" tag, update README.rst replacing sha256-UNKNOWN with expected value.
sed -i -E "s/^TAG = .+$/TAG = latest/g" Docker/Makefile
  1. Commit the changes
git add README.rst Docker/Makefile
git commit -m "Set TAG to latest"

slicerbuildenvironment's People

Contributors

jamesobutler avatar jcfr avatar phcerdan avatar punzo avatar sjh26 avatar thewtex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slicerbuildenvironment's Issues

DCMTK can't build do to conflict with ICU

This is similar to DCMTK can't buid #10, but in that case the problem was something else besides a conflict with the system installed ICU.

The error I encounter in building Slicer is:

[ 2%] Linking CXX executable ../../bin/ofstd_tests
../../lib/libofstd.so.3.6.3: undefined reference to ucnv_getFromUCallBack_50' ../../lib/libofstd.so.3.6.3: undefined reference to ucnv_setToUCallBack_50'
../../lib/libofstd.so.3.6.3: undefined reference to ucnv_close_50' ../../lib/libofstd.so.3.6.3: undefined reference to ucnv_convertEx_50'
../../lib/libofstd.so.3.6.3: undefined reference to u_errorName_50' ../../lib/libofstd.so.3.6.3: undefined reference to UCNV_FROM_U_CALLBACK_SKIP_50'
../../lib/libofstd.so.3.6.3: undefined reference to UCNV_TO_U_CALLBACK_SKIP_50' ../../lib/libofstd.so.3.6.3: undefined reference to ucnv_setFromUCallBack_50'
../../lib/libofstd.so.3.6.3: undefined reference to ucnv_open_50' ../../lib/libofstd.so.3.6.3: undefined reference to ucnv_getName_50'
../../lib/libofstd.so.3.6.3: undefined reference to UCNV_TO_U_CALLBACK_STOP_50' ../../lib/libofstd.so.3.6.3: undefined reference to UCNV_FROM_U_CALLBACK_STOP_50'
collect2: error: ld returned 1 exit status
make[5]: *** [bin/ofstd_tests] Error 1
make[4]: *** [ofstd/tests/CMakeFiles/ofstd_tests.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [DCMTK-prefix/src/DCMTK-stamp/DCMTK-build] Error 2
make[1]: *** [CMakeFiles/DCMTK.dir/all] Error 2
make: *** [all] Error 2

Unlike the situation discussed in DCMTK can't buid #10, I do have a previously installed
version of ICU on my system (RedHat Linux version 7.6):

[jtilton@GSSDR17041094 ~]$ rpm -q -a | grep icu
libicu-devel-50.1.2-17.el7.x86_64
harfbuzz-icu-1.7.5-2.el7.x86_64
libicu-50.1.2-17.el7.x86_64

[jtilton@GSSDR17041094 ~]$ ls /usr/lib64/libicu*
/usr/lib64/libicudata.so /usr/lib64/libicuio.so.50.1.2 /usr/lib64/libicutest.so.50
/usr/lib64/libicudata.so.50 /usr/lib64/libicule.so /usr/lib64/libicutest.so.50.1.2
/usr/lib64/libicudata.so.50.1.2 /usr/lib64/libicule.so.50 /usr/lib64/libicutu.so
/usr/lib64/libicui18n.so /usr/lib64/libicule.so.50.1.2 /usr/lib64/libicutu.so.50
/usr/lib64/libicui18n.so.50 /usr/lib64/libiculx.so /usr/lib64/libicutu.so.50.1.2
/usr/lib64/libicui18n.so.50.1.2 /usr/lib64/libiculx.so.50 /usr/lib64/libicuuc.so
/usr/lib64/libicuio.so /usr/lib64/libiculx.so.50.1.2 /usr/lib64/libicuuc.so.50
/usr/lib64/libicuio.so.50 /usr/lib64/libicutest.so /usr/lib64/libicuuc.so.50.1.2

which apparently conflicts with:

[jtilton@GSSDR17041094 ~]$ ls /opt/Qt/5.12.3/gcc_64/lib/libicu*
/opt/Qt/5.12.3/gcc_64/lib/libicudata.so /opt/Qt/5.12.3/gcc_64/lib/libiculx.so
/opt/Qt/5.12.3/gcc_64/lib/libicudata.so.56 /opt/Qt/5.12.3/gcc_64/lib/libiculx.so.56
/opt/Qt/5.12.3/gcc_64/lib/libicudata.so.56.1 /opt/Qt/5.12.3/gcc_64/lib/libiculx.so.56.1
/opt/Qt/5.12.3/gcc_64/lib/libicui18n.so /opt/Qt/5.12.3/gcc_64/lib/libicutest.so
/opt/Qt/5.12.3/gcc_64/lib/libicui18n.so.56 /opt/Qt/5.12.3/gcc_64/lib/libicutest.so.56
/opt/Qt/5.12.3/gcc_64/lib/libicui18n.so.56.1 /opt/Qt/5.12.3/gcc_64/lib/libicutest.so.56.1
/opt/Qt/5.12.3/gcc_64/lib/libicuio.so /opt/Qt/5.12.3/gcc_64/lib/libicutu.so
/opt/Qt/5.12.3/gcc_64/lib/libicuio.so.56 /opt/Qt/5.12.3/gcc_64/lib/libicutu.so.56
/opt/Qt/5.12.3/gcc_64/lib/libicuio.so.56.1 /opt/Qt/5.12.3/gcc_64/lib/libicutu.so.56.1
/opt/Qt/5.12.3/gcc_64/lib/libicule.so /opt/Qt/5.12.3/gcc_64/lib/libicuuc.so
/opt/Qt/5.12.3/gcc_64/lib/libicule.so.56 /opt/Qt/5.12.3/gcc_64/lib/libicuuc.so.56
/opt/Qt/5.12.3/gcc_64/lib/libicule.so.56.1 /opt/Qt/5.12.3/gcc_64/lib/libicuuc.so.56.1

I've already tried setting my LD_LIBRARY_PATH to have the Qt version of the library appear first in my LD_LIBRARY_PATH - but I still get this same error.

How can I resolve this problem?

qt5-centos7: Missing pulse, libXcomposite, libXcursor, libXtst, libXrandr and libEGL

  • libpulse
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: warning: libpulse-mainloop-glib.so.0, needed by /opt/qt/5.10.1/gcc_64/lib/libQt5Multimedia.so.5.10.1, not found (try using -rpath or -rpath-link)
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: warning: libpulse.so.0, needed by /opt/qt/5.10.1/gcc_64/lib/libQt5Multimedia.so.5.10.1, not found (try using -rpath or -rpath-link)
  • libXcomposite
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: warning: libXcomposite.so.1, needed by /opt/qt/5.10.1/gcc_64/lib/libQt5WebEngineCore.so.5.10.1, not found (try using -rpath or -rpath-link)
  • libXcursor
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: warning: libXcursor.so.1, needed by /opt/qt/5.10.1/gcc_64/lib/libQt5WebEngineCore.so.5.10.1, not found (try using -rpath or -rpath-link)
  • libXtst
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: warning: libXtst.so.6, needed by /opt/qt/5.10.1/gcc_64/lib/libQt5WebEngineCore.so.5.10.1, not found (try using -rpath or -rpath-link)
  • libXrandr
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: warning: libXrandr.so.2, needed by /opt/qt/5.10.1/gcc_64/lib/libQt5WebEngineCore.so.5.10.1, not found (try using -rpath or -rpath-link)
  • libasound
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: warning: libasound.so.2, needed by /opt/qt/5.10.1/gcc_64/lib/libQt5WebEngineCore.so.5.10.1, not found (try using -rpath or -rpath-link)
  • libEGL
/opt/rh/devtoolset-4/root/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/ld: warning: libEGL.so.1, needed by /opt/qt/5.10.1/gcc_64/lib/libQt5WebEngineCore.so.5.10.1, not found (try using -rpath or -rpath-link)

See https://circleci.com/gh/Slicer/Slicer/2558

DCMTK can't buid

I have the problem with building Slicer, because of:

207/311] Performing build step for 'DCMTK'
[55/1229] Building CXX object oflog/libsrc/CMakeFiles/oflog.dir/appender.cc.o
FAILED: bin/ofstd_tests 
: && /opt/rh/devtoolset-4/root/usr/bin/g++  -fvisibility=hidden -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L -fPIC -std=c++11 -O3 -DNDEBUG  -rdynamic ofstd/tests/CMakeFiles/ofstd_tests.dir/tests.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tatof.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/terror.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tmap.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tvec.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tfilsys.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tftoa.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tthread.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tbase64.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tstring.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tlist.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tstack.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tofdatim.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tofstd.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tmarkup.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tchrenc.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/txml.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tuuid.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/toffile.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tmem.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/toption.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/ttuple.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tlimits.cc.o ofstd/tests/CMakeFiles/ofstd_tests.dir/tvariant.cc.o  -o bin/ofstd_tests  -Wl,-rpath,/work/Slicer-build/DCMTK-build/lib:/opt/qt/5.11.2/gcc_64/lib: lib/libofstd.so.3.6.3 /opt/qt/5.11.2/gcc_64/lib/libicuuc.so /opt/qt/5.11.2/gcc_64/lib/libicudata.so -lnsl -lpthread && :
lib/libofstd.so.3.6.3: undefined reference to `ucnv_getFromUCallBack_50'
lib/libofstd.so.3.6.3: undefined reference to `ucnv_setToUCallBack_50'
lib/libofstd.so.3.6.3: undefined reference to `ucnv_close_50'
lib/libofstd.so.3.6.3: undefined reference to `ucnv_convertEx_50'
lib/libofstd.so.3.6.3: undefined reference to `u_errorName_50'
lib/libofstd.so.3.6.3: undefined reference to `UCNV_FROM_U_CALLBACK_SKIP_50'
lib/libofstd.so.3.6.3: undefined reference to `UCNV_TO_U_CALLBACK_SKIP_50'
lib/libofstd.so.3.6.3: undefined reference to `ucnv_setFromUCallBack_50'
lib/libofstd.so.3.6.3: undefined reference to `ucnv_open_50'
lib/libofstd.so.3.6.3: undefined reference to `ucnv_getName_50'
lib/libofstd.so.3.6.3: undefined reference to `UCNV_TO_U_CALLBACK_STOP_50'
lib/libofstd.so.3.6.3: undefined reference to `UCNV_FROM_U_CALLBACK_STOP_50'
collect2: error: ld returned 1 exit status

And I try to some fixes but no success. Before building Slicer 4.10 I have successfully built with this repo Slicer 4.9.

DOC: Script to build qt5 image, bundling external modules.

From this script: https://github.com/phcerdan/configuration_files/blob/master/load_scripts/binUbuntuMassey/build-utilities/SlicerBuildEnvironment-scripts/build-configure-package-slicer.sh

Status August 6th 2018 (tested with SlicerBuildEnvironment 1de3dc02b8ce)

#!/bin/bash
#From: https://github.com/Slicer/SlicerBuildEnvironment
ROOT_DIR=/tmp/SlicerDocker
DOCKER_IMAGE=buildenv-qt5-centos7
# August 5th 2018
Slicer_SHA=ea79c943d168f637cb3347bda199d47bbb111890
mkdir -p $ROOT_DIR

cd ${ROOT_DIR}

# Download sources: https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#CHECKOUT_slicer_source_files
# svn co http://svn.slicer.org/Slicer4/branches/Slicer-4-8 Slicer -r 26813
git clone https://github.com/Slicer/Slicer Slicer
cd Slicer; git reset --hard ea79c943d168f637cb3347bda199d47bbb111890; cd ${ROOT_DIR}

# Download extensions:
# Hint: /work is the working directory in the image, it corresponds to
# the directory from which the script `slicer-${DOCKER_IMAGE}` is called.
EXTENSION_NAME=MeshToLabelMap
git clone https://github.com/NIRALUser/MeshToLabelMap ${EXTENSION_NAME}
Slicer_EXTENSION_SOURCE_DIRS="/work/${EXTENSION_NAME}"

EXTENSION_NAME=BoneTextureExtension
git clone git://github.com/Kitware/${EXTENSION_NAME} ${EXTENSION_NAME}
Slicer_EXTENSION_SOURCE_DIRS="${Slicer_EXTENSION_SOURCE_DIRS};/work/${EXTENSION_NAME}"
echo "Slicer_EXTENSION_SOURCE_DIRS: ${Slicer_EXTENSION_SOURCE_DIRS}"

# Download corresponding build environment and generate convenience script
docker run --rm slicer/${DOCKER_IMAGE} > ~/bin/slicer-${DOCKER_IMAGE}
chmod u+x ~/bin/slicer-${DOCKER_IMAGE}

# Configure Slicer
slicer-${DOCKER_IMAGE} cmake \
  -BSlicer-build -HSlicer \
  -GNinja \
  -DCMAKE_BUILD_TYPE:STRING=Release \
  -DSlicer_USE_SimpleITK:BOOL=OFF \
  -DBUILD_TESTING:BOOL=OFF \
  -DSlicer_EXTENSION_SOURCE_DIRS:STRING=${Slicer_EXTENSION_SOURCE_DIRS} \
  -DSlicer_VTK_VERSION_MAJOR:STRING=9 \
  -DSlicer_REQUIRED_QT_VERSION:STRING=5

# Qt5_DIR will be populated, because it is already in the system path.

# Build Slicer
slicer-${DOCKER_IMAGE} cmake --build Slicer-build

# Package Slicer
slicer-${DOCKER_IMAGE} cmake --build Slicer-build/Slicer-build --target package

You can then unpack the generated ${ROOT_DIR}/Slicer-build/Slicer-build/Slicer-XXX-YYY.tar.gz anywhere to run Slicer.

Question about packaging extensions

So, I have build and packaged Slicer, and now I am building an extension.

The extension does not provide a --target package as the example in the readme.

I guess I can still add it manually as described here: https://www.slicer.org/wiki/Documentation/Nightly/SlicerApplication/ExtensionsManager#How_to_manually_install_an_extension_package.3F

  • unpack the packaged slicer (it was packed in tar.gz)
  • copy lib/qt-loadable-modules/* from the module to the same folder in the unpacked slicer.
  • repack with tar -czf Slicer-XXX-Date.tar.gz SlicerUnpackedFolder`

Is this the recommended way? Thanks!

documentation for building / using the qt5 image locally

Here are notes from commands that we used (needs testing):

sudo mkdir /work
sudo chown -R $USER.$USER /work
cd /work
git clone https://github.com/Slicer/Slicer.git
docker run --rm slicer/buildenv-qt5-centos7 > slicer-buildenv-qt5-centos7
chmod +x ./slicer-buildenv-qt5-centos7
./slicer-buildenv-qt5-centos7 cmake -BSlicer-build -HSlicer -GNinja -DCMAKE_BUILD_TYPE=Release -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF -DSlicer_BUILD_CLI:BOOL=OFF -DSlicer_USE_SimpleITK:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DQt5_DIR:PATH=\${Qt5_DIR}
./slicer-buildenv-qt5-centos7 cmake --build Slicer-build
# mv /opt/qt from the image onto the host

Graphics tests support tasks

  • Verify that packages / variable settings are all needed
  • Test w/ increased screen size
  • Investigate appropriate QPA plugin for xvfb

See: #20 - merged

Ensure DEFAULT_DOCKCROSS_IMAGE is correctly set in image script

After checking DEFAULT_DOCKCROSS_IMAGE env variable is properly set in the image, check that this code work as expected: https://github.com/dockbuild/dockbuild/blob/dad2ee6c4b48f70284964e3d49d9f6b4930bcded/imagefiles/entrypoint.sh#L6-L19

If not, it should be fixed in dockcross (https://github.com/dockcross/dockcross/blob/master/imagefiles/entrypoint.sh#L6-L19) and then integrated in dockbuild by running https://github.com/dockbuild/dockbuild/blob/master/imagefiles/UpdateFromUpstream.sh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.