UCL/petmr-RESOLUTE

building

Closed this issue · 8 comments

Hello

Thanks for making this code available. I'm probably missing something obvious here, but I'm having no luck with building the code. I'm using ubuntu 16.04

I'm in the petmr-RESOLUTE directory and have done

cmake . 
make 

Two issues so far
a) I get an error

In file included from /usr/include/c++/5/initializer_list:36:0,
                 from /usr/local/include/nlohmann/json.hpp:41,
                 from /mnt/edrive/MJF/resolute/petmr-RESOLUTE/src/Resolute.cpp:29:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support \

b) How do I tell it where to look for ITK etc - I'm getting
/petmr-RESOLUTE/src/Resolute.cpp:31:32: fatal error: itkCastImageFilter.h: No such file or directory

Thanks for any advice

Michael

Hi Michael,

a) It seems that the requirement for C++ 11 wasn't picked up. nlohmann/json will not work on older gcc versions < 4.9 (see this). I've modified the CMakeLists.txt. Can you try the ubuntu-build#5 branch?

b) cmake -DITK_DIR=/path/to/ITK/BUILD/DIR is probably what you want.

Please let me know if this works and I will merge to master.

Kind regards,

Ben

Hi Ben

I think I got the c++ error by running cmake in the src directory, so probably that isn't actually a problem.

However, I'm still having no luck with the ITK. I got that along with ANTS, and am running

cmake . -DANTs_SOURCE_DIR=/mnt/edrive/MJF/ants/ANTs -DANTs_LIBRARY_DIR=/mnt/edrive/MJF/ants/antsbin/lib/ -DITK_DIR=/mnt/edrive/MJF/ants/antsbin/ITKv4-build

followed by make, and I get:


[ 25%] Building CXX object src/CMakeFiles/resolute.dir/Resolute.cpp.o
[ 50%] Building CXX object src/CMakeFiles/resolute.dir/mnt/edrive/MJF/ants/ANTs/Examples/antsRegistration.cxx.o
[ 75%] Building CXX object src/CMakeFiles/resolute.dir/mnt/edrive/MJF/ants/ANTs/Examples/antsApplyTransforms.cxx.o
[100%] Linking CXX executable resolute
/mnt/edrive/MJF/ants/antsbin/lib/libantsUtilities.a(antsRegistration2DDouble.cxx.o): In function `itk::GradientDescentOptimizerBasev4Template<double>::~GradientDescentOptimizerBasev4Template()':
antsRegistration2DDouble.cxx:(.text._ZN3itk38GradientDescentOptimizerBasev4TemplateIdED2Ev[_ZN3itk38GradientDescentOptimizerBasev4TemplateIdED5Ev]+0x178): undefined reference to `itk::ObjectToObjectOptimizerBaseTemplate<double>::~ObjectToObjectOptimizerBaseTemplate()'
...

with a whole load of undefined ITK references. Any suggestions appreciated

Thanks

Michael

Did ANTS build successfully? If you go to ANTs-build and run make test does this work?

Hi

ANTs seems to build successfully. make test passes most tests:



99% tests passed, 3 tests failed out of 221

Total Test time (real) = 332.48 sec

The following tests FAILED:
	  3 - antsRegistrationTest_AffineRotationMasks (Failed)
	 15 - antsRegistrationTest_SimilarityRotationMasks (Failed)
	 25 - antsRegistrationTest_initializePerStage_ComparisonTesting (Failed)
Errors while running CTest
Makefile:149: recipe for target 'test' failed
make: *** [test] Error 8

Thanks

Michael

Hmmm, okay. So here are a few questions/suggestions:

  • Does ITK pass its tests? ITK testing in the ANTs SuperBuild is disabled. To enable it, turn testing on in cmake for the ITKv4-build directory using BUILD_TESTING=ON. Then make && make test. (This will take a while as a fair amount of test data needs to be downloaded).
  • What version of ANTs are you using? I built version 2.2.0 on Ubuntu 14.04 (via Travis) and there was no problem.
  • What compiler are you using?
  • What version of CMake are you running?

ITK passes all tests.
100% tests passed, 0 tests failed out of 2434

I'm also with Ants 2.2.0 (built following https://brianavants.wordpress.com/2012/04/13/updated-ants-compile-instructions-april-12-2012/ )

gcc version 5.4.1

cmake version 3.10.3 (Ubuntu has 3.5.1 installed, this was producing the same errors, I removed it and installed 3.10.3)

Best wishes

Michael

Hi, I built a 16.04 VM to test this. It turns out that the order which the libraries are specified matters. ${ANTS_LIBS} must come before ${ITK_LIBRARIES}. If you try the ubuntu#5 branch, you should hopefully be able to build now. Thanks for pointing this out, as it does not appear to be an issue on macOS.

Kind regards,

Ben

Thanks, the ubuntu#5 branch now compiles, and the executable runs (produces help and version info).

Best wishes

Michael