= Building CompuCell3D 4.x.x on Linux = This write-up presents easy-to-follow instructions on how to build CC3D 4.x.x on Linux = Prerequisites = * conda installation - use python 3.7 installer for 64-bit linux from this webpage https://conda.io/miniconda.html (installing conda is described below in the section "Installing conda") * git * c++ compiler (gcc/g+= version 4.6+) '''Important''': for this tutorial to work you need to make sure that '''libGLU.so''' is in the '''/usr/lib64'''. On Ubuntu this library will be installed in '''/usr/lib/x86_64-linux-gnu''' In this case you may have to create symbolic link (you have to be '''sudo''' to do that) {{{ ln -s /usr/lib/x86_64-linux-gnu /usr/lib64 }}} If you are on '''CentOS 7.x''' or '''RedHat 7.x''' you may have more work to do, but it is fairly straightforward. You will need to create more symbolic links as shown below: {{{ cd /usr/lib64 ln -s libXt.so.6 libXt.so ln -s libGLU.so.1 libGLU.so ln -s libGL.so.1 libGL.so ln -s libXext.so.6 libXext.so ln -s libX11.so.6 libX11.so ln -s libICE.so.6 libICE.so ln -s libSM.so.6 libSM.so }}} Of course you need to do it as super user and keep in mind that the library numbers (.so.x) may vary depending on your system version == Cloning essential repositories == First let's make sure we have cloned a repository that contains CC3D documentation and useful build CC3D scripts for various operating systems. We do this by running the following commands: {{{ cd git clone https://github.com/CompuCell3D/cc3d_build_scripts.git }}} The repository will be cloned to '''/cc3d_build_scripts''' '''Important''': make sure to replace '''''' with actual path to your home directory '''Important''': you can find useful CC3D linux setup/compilation details inside '''/cc3d_build_scripts/linux/400''' folder. Those are internal notes and the content of them is relayed here but in case we missed some details it is not a bad idea to look into this folder. Next let's clone actual CC3D repository: {{{ mkdir /CC3D_PY3_GIT cd /CC3D_PY3_GIT git clone https://github.com/CompuCell3D/CompuCell3D.git . }}} == Instaling conda == To install conda/miniconda on your machine please follow the instructions indicated on this page: https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html After you successfully install conda first thing we will do is to create python virtual environment where we will store all the dependencies for compiling and running CC3D: {{{ conda create -n cc3d_2020 python=3.7 }}} After the environment '''cc3d_2020''' is created we will activate it. BTW you can call this environment whatever you want. Just keep the names meaningful to you: {{{ source activate cc3d_2020 }}} or {{{ conda activate cc3d_2020 }}} Let's install CC3D dependencies this environment to enable compilation of CC3D: {{{ conda install -c conda-forge numpy scipy pandas jinja2 webcolors vtk=8.2 pyqt pyqtgraph deprecated qscintilla2 jinja2 chardet cmake swig=3 requests }}} vtk packages from conda-forge repository depends on Threading Building Blocks library (tbb). However, conda package does not include all dependencies needed to compile and link c++ modules that rely on vtk. To alleviate this we build conda package that fixex issues with tb installation. All you need to do is to install ''tbb_full_dev'' package from ''compucell3d'' anaconda channel by running: {{{ conda install -c compucell3d tbb_full_dev }}} Additionally we will need to install '''libroadrunner''' (solves SBML models) and '''antimony''' (make SBML model specification much easier and elegant) using '''pip''' by typing {{{ pip install libroadrunner pip install antimony }}} If you need specific version of libroadrunner you can always type , for example: {{{ pip install libroadrunner==1.5.24 }}} where we specified version 1.5.24 following two equal signs. At this point we are almost ready to install compile CC3D but we need to do few minor patches. It happens sometimes that packages coming from conda channels are not 100% ready for use during compilations so we need to fix them. Fortunately the steps required to do so are minor == Fixing Qt hard-coded paths in qt.conf (optional - needed only if you plan to redistribute your cc3d package) == To ensure that we can run cc3d on other systems we need to copy '''qt.conf''' from '''/cc3d_build_scripts/linux/400/conda_patches''' folder into '''/envs/cc3d_2020/bin''' or simply replace the content of '''/envs/cc3d_2020/bin/qt.conf''' with the following text: {{{ [Paths] Prefix = ../ Binaries = ../bin Libraries = ../lib Headers = ../include/qt }}} == Compiling == Once you completed above steps by far the easiest way to compile CC3Dis to use automatic script '''build.py''' from '''/cc3d_build_scripts/linux/400/''' folder. To do so do the following: {{{ conda activate base cd /cc3d_build_scripts/linux/400/ python build.py --prefix=/410_auto --source-root=/CC3D_PY3_GIT --build-dir=/410_auto_build --version=4.1.0 --cores=2 --conda-env-name=cc3d_2020 }}} '''Important''' It is important to activate base conda environment before using script ''build.py''. The script figures out the path to conda environment using a method that will not work properly if you are in ''cc3d_2020'' environment. After the the script finishes you should have a copy of CC3D in '''/410_auto''' == Testing == You can test your installation with; {{{ cd /410_auto runScript.sh }}} Which should return the option list for CompCell3D via that script. To do an actual run using a demo try: {{{ runScript.sh -i ./Demos/cellsort_project_py_step_new_style/cellsort_2D.cc3d -f 11 -fs 12 -fr 13 }}} This will write in your CC3DWorkspace folder named "cellsort_2D_cc3d_MM_DD_YYYY_HH_MM_SS", restart files every 13 steps and VTK files every 11 steps. ---- '''Important:''' You may need to apply additional fix apply on newer linuxes (Ununtu 18.04 !RedHat 7.5) This is related to the issue of that shows up during the compilation and is related to SWIG complaining that it is unable find "swig.swg" file (and few others). The temporary solution is to uninstall system swig and install swig from source by following download links from www.swig.org. Alternatively you may fix it by specifying proper path to '''SWIG_DIR''' in the CMake dialog - make sure you toggle ''Advanced'' box and type ``Swig`` in CMake search box to display this setting