3.3.8. Build on Mac OS X¶
This section describes how itom and its plugins are built on a Apple Mac systems running OS X 10.7 or later (tested on OS X 10.9 and 10.10). The general approach is similar to the other documentation in the install chapter that are mainly focussed on Windows.
Xcode is the default IDE on OS X systems. It is also necessary to install Xcode to obtain the command line tools (including the compiler clang and the linker ld).
Since OSX Lion, the Xcode installation doesn’t by default include the command line tools. Part of which a script called easy_install we will need to install some packages.
Once Xcode has been installed, run Xcode and then open the preferences. Select the Download section and the Components tab and install Command Line Tools from there.
Go to http://www.cmake.org to download and install the current stable releasse of CMake. It is recommended to download a release that looks like cmake-x.y.z-Darwin-x86_64.dmg
Most necessary packages can be obtained by the package manager of your solution. We will use Homebrew.
Open a terminal window and copy and paste the following line into a terminal
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run the following command once before installing anything
Homebrew can also be installed as described at http://brew.sh .
The following list describe packages that are required or recommended for building itom and how to install them using brew.
Required Python packages:
Recommended Pyton packages:
You will find the script osx_install_dependencies.sh in the source directory. This script allows to install all dependencies in one rush. To use it run the command sh osx_install_dependencies.sh in a Terminal.
To install all in one rush run the follwing list of commands. This might take a whole lot of time (we might talk about hours).
brew update brew tap homebrew/science brew tap homebrew/python brew install git gcc python3 pkg-config brew install qt --with-developer --with-docs brew install pyqt --with-python3 brew install doxygen --with-doxywizard --with-graphviz brew install ffmpeg glew fftw brew install numpy --with-python3 brew link numpy --overwrite brew install pillow --with-python3 brew link pillow --overwrite brew install matplotlib --with-python3 --with-pyqt brew link matplotlib --overwrite brew install matplotlib-basemap --with-python3 brew link matplotlib-basemap --overwrite brew install scipy --with-python3 brew link scipy --overwrite brew install opencv pcl caskroom/cask/brew-cask brew cask install qt-creator brew linkapps
The above commands in one line:
brew update; brew tap homebrew/science; brew tap homebrew/python; brew install git gcc python3 pkg-config; brew install qt --with-developer --with-docs; brew install doxygen --with-doxywizard --with-graphviz; brew install pyqt --with-python3; brew install qscintilla2 --with-python3; brew install ffmpeg glew fftw; brew install numpy --with-python3; brew link numpy --overwrite; brew install pillow --with-python3; brew link pillow --overwrite; brew install matplotlib --with-python3 --with-pyqt; brew link matplotlib --overwrite; brew install matplotlib-basemap --with-python3; brew link matplotlib-basemap --overwrite; brew install scipy --with-python3; brew link scipy --overwrite; brew install opencv pcl caskroom/cask/brew-cask; brew cask install qt-creator; brew linkapps
If you would like to compile itom with Qt 5 replace brew install qt –with-developer –with-docs with brew install qt5 –with-developer –with-docs and brew install pyqt –with-python3 with brew install pyqt5 –with-python .
188.8.131.52. Python 3¶
The default Python version on OS X is 2.x. Since itom is using Python 3.x you installed in the previous step but it is’nt recommended to replace version 2.x with 3.x. We will set an alias for python3, so when entered python in a terminal session, python3 will be called.
To edit you aliases execute the following command.
printf "alias python='python3'\n" >> ~/.bash_profile
The same thing must be done for pip and easy_install. Be adviced to check the installed version number of python and change it when necessary. The command python –version will give you the installed version number.
printf "alias easy_install='/usr/local/Cellar/python3/3.4.3/bin/easy_install-3.4'\n" >> ~/.bash_profile printf "alias pip='/usr/local/Cellar/python3/3.4.3/bin/pip3.4'\n" >> ~/.bash_profile . ~/.bash_profile
Now we need to install two packages using easy_install (again remeber to check your version number!):
sudo easy_install virtualenv pyparsing frosted
We need some more python packages. Just run the following command:
pip install ipython mpmath sphinx
184.108.40.206. Recommended folder structure¶
Similar to Windows, the following folder structure is recommended:
./sources ./itom # cloned repository of core ./plugins # cloned sources of plugins ./designerPlugins # cloned sources of designerPlugins ... ./build_debug # build folder for debug makefiles of... ./itom # ...core ./plugins # ...plugins ... ./build_release # build folder for release makefiles of... ./itom # ...core ...
To create all folders in your user directory in one step, call the following bash commands:
mkdir ~/itom; cd ~/itom; mkdir ./sources; mkdir ./build_debug; mkdir ./build_debug/itom; mkdir ./build_debug/plugins; mkdir ./build_debug/designerPlugins; mkdir ./build_release; mkdir ./build_release/itom; mkdir ./build_release/plugins; mkdir ./build_release/designerPlugins
220.127.116.11. Obtain the sources¶
Clone at least the core repository of itom (bitbucket.org/itom/itom) as well as the open source plugin and designerPlugin repository into the corresponding subfolders of the sources folder. You can do this by using any git client or the command
cd sources git clone https://bitbucket.org/itom/itom.git git clone https://bitbucket.org/itom/plugins.git git clone https://bitbucket.org/itom/designerplugins.git
18.104.22.168. Configuration process¶
Use CMake to create the necessary makefiles for debug and/or release:
Indicate the folder sources/itom as source folder
Indicate either the folder build_debug/itom or build_release/itom as build folder. If the build folder already contains configured makefiles, the last configuration will automatically loaded into the CMake gui.
Check Advanced to see all available options.
Set the following variables:
- Itom Parameter:
BUILD_TARGET64 to ON.
BUILD_WITH_PCL to ON if you have the point cloud library available on your computer and want to compile itom with support for point clouds and polygon meshes.
- System Parameter:
CMAKE_BUILD_TYPE to either debug or release
The suffix SDK version might also be different as well as the path.
Push the configure button
Usually, CMake should find most of the necessary third-party libraries, however you should check the following things:
OpenMP: OpenMP is not available when using the default compiler clang. If your setup includes OpenMP set -fopenmp to OpenMP_CXX_FLAGS and OpenMP_C_FLAGS.
Python3: On OS X CMake always finds the Python version 2 as default version. This is wrong. Therefore set the following variables to the right pathes:
PYTHON_LIBRARY_DEBUG: /usr/local/Cellar/python3/3.4.3/Frameworks/Python.PYTHON_LIBRARY_RELEASE**: framework/Versions/3.4/lib/libpython3.4.dylib
The suffix 3.4 might also be different. It is also supported to use any other version of Python 3.
- PointCloudLibrary (optonal):
The version 1.7 might also be different. It is also supported to use any other version of the PointCloudLibrary.
Push the generate button.
Now you can build itom by the make or using Xcode command:
make: Open a command line and switch to the build_debug/itom or build_release/itom directory. Simply call make such that the file qitom or qitomd (debug) is built. Start this application by calling ./qitom or ./qitomd in order to run itom.
Xcode: If you plan to change something in the source code it is recommended to use Xcode. Just open the itom.xcodeproj with Xcode and compile the project.
22.214.171.124. Build plugins¶
Build the plugins, designerPlugins… in the same way than itom but make sure that you compiled itom at least once before you start configuring and compiling any plugin. In CMake, you need to indicate the same variables than above, but you also need to set the variable ITOM_SDK_DIR to the sdk folder in build_debug/itom/sdk or build_release/itom/sdk depending whether you want to compile a debug or release version (please don’t forget to set CMAKE_BUILD_TYPE.
If you don’t want to have some of the plugins, simply uncheck them in CMake under the group Plugin.
The plugins and designerPlugins will finally be compiled and then copy their resulting library files into the designer and plugins subfolder of itom. Restart itom and you the plugin will be loaded.
126.96.36.199. Known Problems¶
188.8.131.52.1. PyPort bug¶
If you get build errors that trace back to an error like
... /__locale:436:15: error: C++ requires a type specifier for all declarations char_type toupper(char_type __c) const ^~~~~~~~~~~~~~~~~~~~~~ /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Headers/pyport.h:731:29: note: expanded from macro 'toupper'
You are using a deprecated version of PyPort.
Locate pyport.h, it might be located in /Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m/pyport.h. Open it and replace
#ifdef _PY_PORT_CTYPE_UTF8_ISSUE #include <ctype.h> #include <wctype.h> #undef isalnum #define isalnum(c) iswalnum(btowc(c)) #undef isalpha #define isalpha(c) iswalpha(btowc(c)) #undef islower #define islower(c) iswlower(btowc(c)) #undef isspace #define isspace(c) iswspace(btowc(c)) #undef isupper #define isupper(c) iswupper(btowc(c)) #undef tolower #define tolower(c) towlower(btowc(c)) #undef toupper #define toupper(c) towupper(btowc(c)) #endif
#ifdef _PY_PORT_CTYPE_UTF8_ISSUE #ifndef __cplusplus /* The workaround below is unsafe in C++ because * the <locale> defines these symbols as real functions, * with a slightly different signature. * See python issue #10910 */ #include <ctype.h> #include <wctype.h> #undef isalnum #define isalnum(c) iswalnum(btowc(c)) #undef isalpha #define isalpha(c) iswalpha(btowc(c)) #undef islower #define islower(c) iswlower(btowc(c)) #undef isspace #define isspace(c) iswspace(btowc(c)) #undef isupper #define isupper(c) iswupper(btowc(c)) #undef tolower #define tolower(c) towlower(btowc(c)) #undef toupper #define toupper(c) towupper(btowc(c)) #endif #endif
184.108.40.206.2. python3 not available in Terminal¶
To make Python 3.x and its tools available to the command line add it to the PATH with a command like
sudo export PATH=/Library/Frameworks/Python.framework/Versions/3.4/bin:$PATH
Be sure to adapt the path as necessary. Especially be use to change the version number to the actually installed one.
220.127.116.11.3. pip install fails with TypeError: unorderable types: str() < NoneType()¶
Open /usr/local/Cellar/python3/3.4.3/libexec/setuptools/__init__.py and change
self.py_version or '', self.platform or '',
Do the same for /usr/local/lib/python3.4/site-packages/setuptools-12.2-py3.4.egg/pkg_resources/__init__.py