Hi CASToR users and developers,
I recently started working with CASToR and managed to compile it for Ubuntu and Windows. As I am forced to work with Windows, this was my primary targeted platform (Ubuntu VM just for cross-checks).
However, I managed to build a 32bit release with Windows 7 64bit, Visual Studio 2017 (v15.5.5), CMake 3.9.6 and pre-compiled ROOT binaries for Visual Studio 2013 (“root_v5.34.36.win32.vc12.zip”).
During this journey I discovered a couple of errors with CASToR’s (CMake) configuration files which I would to draw your attention to.
This is probably not the right place to submit this, but I could not find any bug tracker or repository to issue cases.
Due to my limited knowledge with CMake I just mention issues here instead of offering true solutions.
My issues:
- The default CMakeLists.txt of CASToR provides two forks, one for “win32” and one for unix-based system.
Whereas the unix fork cares for flags as “CASToR_BUILD_GATE_UTILITIES” and checks if “CASToR_ROOT” is set (which is required to read ROOT files), the win32 fork does not check this.
Hence, the build will fail due to missing ROOT libraries.
My solution to this was to copy the parts from the unix part to the corresponding win32 section and it worked. Maybe this is not the way it is supposed to be, please check.
- ROOT for Windows can only be built in 32bit mode, as the 64bit version would require a lot of changes to ROOT and the underlying libraries (see https://root-forum.cern.ch/t/native-windows-64-bit-build/9102/27).
Therefore, whenever a windows platform is detected, the compiler should be force to 32bit mode and the CASToR build as well (see variable “CASToR_64bits”).
At least some prominent error should be displayed if this is easier to implement.
- The “FindROOT.cmake” file you provide in “cmake-modules” only works for unix-systems.
Here, the calls to ${ROOT_CONFIG_EXECUTABLE} in the “execute_process” instructions do not work for windows as the “root-config” file cannot be executed.
I adjusted this section by borrowing parts from here: https://git.fangmeier.tech/caleb/TTTT/src/master/cmake/FindROOT.cmake
Again, I do not know if this is the way to go but it works for me.
- When using CASToR_ROOT and building in 32bit mode using Visual Studio 2017, this still fails due to some weird error namely:
path_to_my_root_build\include\tvirtualx.h(183): error C2059: syntax error : ‘constant’
I nailed this down to a ROOT bug submitted several years ago:
https://sft.its.cern.ch/jira/browse/ROOT-3158
The solution is to add the line “#include “Windows4Root.h” right before “#include “TCanvas.h” in the file:
castor_v1.2_0\source\include\management\gDataConversionUtilities.hh
I do not know what consequences this has.
- One small cosmetic issue (maybe it is a real issue but I did not have an problems with this):
Probably both lines of “add_definitions( /DCASTOR_ROOT )” in the unix-fork of the CMakeLists.txt should be replaced with the hyphenated version (-DCASTOR_ROOT).
At least this is the case for all other flags (-DCASTOR_MPI, -DCASTOR_VERBOSE et.c) in this section. Maybe the compiler will also handle the slash version.
Long story short, the build now works and the results of the executables look promising. Nevertheless, due to the 32bit memory restrictions, this CASToR build is suboptimal.
I now plan on using a 32bit release to convert my GATE geometry data and the corresponding ROOT simulation files into CASToR data files.
In addition, I’m going to build a 64bit release as well and develop my own stuff.
Bottom line: You guys did an amazing job and I really like what v1.2 offers. Keep up the good work!
Yours sincerely,
Moritz Schaar