SyneRBI / SIRF-SuperBuild

SIRF CMake SuperBuild
http://www.ccpsynerbi.ac.uk
Apache License 2.0
15 stars 17 forks source link

compilation problems on Ubuntu 20.04 after SuperBuild rebuild #443

Closed Ede1994 closed 3 years ago

Ede1994 commented 3 years ago

Actually I only wanted to enable OpenMP afterwards, but since then I get several error messages when rebuilding. Recently I did the following:

cmake ../Source \
        -DCMAKE_INSTALL_PREFIX=${SIRF_INSTALL_PATH} \
        -U\*_URL -U\*_TAG \
        -DUSE_SYSTEM_SWIG=ON \
        -DUSE_SYSTEM_Boost=OFF \
        -DUSE_SYSTEM_Armadillo=ON \
        -DUSE_SYSTEM_FFTW3=ON \
        -DUSE_SYSTEM_HDF5=ON \
        -DBUILD_siemens_to_ismrmrd=OFF \
        -DUSE_ITK=ON \
        -DDEVEL_BUILD=ON \
        -DBUILD_CIL_LITE=OFF \
        -DNIFTYREG_USE_CUDA=OFF \
        -DBUILD_GADGETRON:BOOL=OFF \
        -DBUILD_TESTING_ISMRMRD:BOOL=OFF

After make -j 1 2>&1 | tee error_msg.txt I get the following error (detailed log is in the attached txt-file):

/home/eric/SIRF-SuperBuild/Source/sources/ITK/Modules/ThirdParty/VNL/src/vxl/vcl/vcl_compiler.h:101:4: error: #error "Dunno about this gcc"
  101 | #  error "Dunno about this gcc"
      |    ^~~~~
make[5]: *** [Modules/ThirdParty/VNL/src/vxl/vcl/CMakeFiles/itkvcl.dir/build.make:63: Modules/ThirdParty/VNL/src/vxl/vcl/CMakeFiles/itkvcl.dir/vcl_deprecated.cxx.o] Fehler 1
make[4]: *** [CMakeFiles/Makefile2:5635: Modules/ThirdParty/VNL/src/vxl/vcl/CMakeFiles/itkvcl.dir/all] Fehler 2
make[3]: *** [Makefile:152: all] Fehler 2
make[2]: *** [CMakeFiles/ITK.dir/build.make:113: builds/ITK/stamp/ITK-build] Fehler 2
make[1]: *** [CMakeFiles/Makefile2:209: CMakeFiles/ITK.dir/all] Fehler 2
make: *** [Makefile:95: all] Fehler 2

error_msg.txt

KrisThielemans commented 3 years ago

Ubuntu 20.04? Which is the default compiler used? (if just using the default, cc --version)

Possibly it is too recent for the ITK version that we default to. Checking vcl_compiler.h on my machine they go up to gcc 8.3.

Either downgrade your compiler, or upgrade ITK. I believe -DITK_TAG=v5.1.1 could do the trick as I'm not aware of any incompatibilities introduced that matter to us, but please run all tests. One way to do that is to create a PR on the superbuild that modifies version_config.cmake.

By the way, I cannot believe that this is "just" a rebuild. I strongly suspect you updated your system somewhere in between.

Ede1994 commented 3 years ago

Yes, Ubuntu 20.04. I have now switched my compiler from gcc-9 to gcc-8, then the ITK build ran through. But now I have another error:

/home/eric/SIRF-SuperBuild/Install/include/sirf/NiftyMoMo/BSplineTransformation.h:41:7: note: ‘class NiftyMoMo::BSplineTransformation’ defined here
 class BSplineTransformation :public Transformation
       ^~~~~~~~~~~~~~~~~~~~~
make[5]: *** [src/Registration/NiftyMoMo/CMakeFiles/NiftyMoMo.dir/build.make:82: src/Registration/NiftyMoMo/CMakeFiles/NiftyMoMo.dir/BSplineTransformation.cpp.o] Fehler 1
make[4]: *** [CMakeFiles/Makefile2:523: src/Registration/NiftyMoMo/CMakeFiles/NiftyMoMo.dir/all] Fehler 2
make[3]: *** [Makefile:160: all] Fehler 2
make[2]: *** [CMakeFiles/SIRF.dir/build.make:138: builds/SIRF/stamp/SIRF-build] Fehler 2
make[1]: *** [CMakeFiles/Makefile2:232: CMakeFiles/SIRF.dir/all] Fehler 2
make: *** [Makefile:114: all] Fehler 2

error_msg.txt

KrisThielemans commented 3 years ago

You missed the important bit from the error message

[  6%] Building CXX object src/Registration/NiftyMoMo/CMakeFiles/NiftyMoMo.dir/BSplineTransformation.cpp.o
/home/eric/SIRF-SuperBuild/Source/sources/SIRF/src/Registration/NiftyMoMo/BSplineTransformation.cpp:1340:39: error: no declaration matches ‘NiftyMoMo::BSplineTransformation::PrecisionType* NiftyMoMo::BSplineTransformation::GetDVFGradientWRTTransformationParameters(nifti_image*)’
 BSplineTransformation::PrecisionType* BSplineTransformation::GetDVFGradientWRTTransformationParameters( nifti_image* denseDVFIn )
                                       ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/eric/SIRF-SuperBuild/Source/sources/SIRF/src/Registration/NiftyMoMo/BSplineTransformation.cpp:21:
/home/eric/SIRF-SuperBuild/Install/include/sirf/NiftyMoMo/BSplineTransformation.h:90:49: note: candidate is: ‘virtual NiftyMoMo::BSplineTransformation::PrecisionType* NiftyMoMo::BSplineTransformation::GetDVFGradientWRTTransformationParameters(nifti_image*, nifti_image*)’
   virtual BSplineTransformation::PrecisionType* GetDVFGradientWRTTransformationParameters( nifti_image* denseDVFIn, nifti_image* sourceImage );
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/eric/SIRF-SuperBuild/Source/sources/SIRF/src/Registration/NiftyMoMo/BSplineTransformation.cpp:21:
/home/eric/SIRF-SuperBuild/Install/include/sirf/NiftyMoMo/BSplineTransformation.h:41:7: note: ‘class NiftyMoMo::BSplineTransformation’ defined here
 class BSplineTransformation :public Transformation

I believe this is https://github.com/SyneRBI/SIRF/issues/659. Current solution:

rm -rf /home/eric/SIRF-SuperBuild/Install/include/
make
KrisThielemans commented 3 years ago

I've edited https://github.com/SyneRBI/SIRF/wiki/Rebuilding-after-upgrades to make this clearer. Feel free to improve on that text!

Ede1994 commented 3 years ago

Okay. That helped. Now, next error:

/usr/bin/ld: cgadgetron.cpp:(.text.startup+0x36): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: cgadgetron.cpp:(.text.startup+0x3b): undefined reference to `boost::system::system_category()'
/usr/bin/ld: cgadgetron.cpp:(.text.startup+0x40): undefined reference to `boost::system::system_category()'
collect2: error: ld returned 1 exit status
make[5]: *** [src/xGadgetron/cGadgetron/tests/CMakeFiles/MR_TESTS_CPLUSPLUS.dir/build.make:444: src/xGadgetron/cGadgetron/tests/MR_TESTS_CPLUSPLUS] Fehler 1
make[4]: *** [CMakeFiles/Makefile2:870: src/xGadgetron/cGadgetron/tests/CMakeFiles/MR_TESTS_CPLUSPLUS.dir/all] Fehler 2
make[3]: *** [Makefile:160: all] Fehler 2
make[2]: *** [CMakeFiles/SIRF.dir/build.make:138: builds/SIRF/stamp/SIRF-build] Fehler 2
make[1]: *** [CMakeFiles/Makefile2:201: CMakeFiles/SIRF.dir/all] Fehler 2
make: *** [Makefile:114: all] Fehler 2

I've tried to USE_SYSTEM_BOOST ON and OFF. Both created the same error. error_msg.txt

KrisThielemans commented 3 years ago

oh well. weird that you're getting this now of course. Sort of sounds like it's still picking up mixed boost versions, but I'm not sure. Can you try the following:

  1. change sources/SIRF/CMakeLists.txt by added the following line

    add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)

    after L99 (where it adds BOOST_ALL_NO_LIB).

  2. do cmake -DDISABLE_GIT_CHECKOUT:BOOL=ON .; make -j4

  3. If that doesn't work, repeat after adding

    add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)

If that doesn't work,

rm builds/SIRF/build/CMakeFiles/MR_TESTS_CPLUSPLUS.dir/mrtests.cpp.o
make VERBOSE=ON >& verbose.log

and send us that one.

KrisThielemans commented 3 years ago

By the way, your log file contained a lot of ugly things like

   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

seems that vtk-7.1 has its own problems! Luckily they don't seem to have affected you (yet)

Ede1994 commented 3 years ago

Sooooo...same error. builds/SIRF/build/CMakeFiles/MR_TESTS_CPLUSPLUS.dir/mrtests.cpp.o doesn't exist. I found only builds/SIRF/build/src/xGadgetron/cGadgetron/tests/CMakeFiles/MR_TESTS_CPLUSPLUS.dir/mrtests.cpp.o. I've deleted this, but without any success. verbose.log

KrisThielemans commented 3 years ago

in your log file, I see

cd /home/eric/SIRF-SuperBuild/Build/builds/SIRF/build/src/xGadgetron/cGadgetron/tests && /usr/bin/c++  -DBOOST_ALL_NO_LIB -DSIRF_VTK -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/common -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/common/include -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/iUtilities -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/iUtilities/include -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/Synergistic/cSyn -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/Synergistic/cSyn/include -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/xGadgetron/cGadgetron -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/xGadgetron/cGadgetron/include -I/usr/include/hdf5/serial -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/xSTIR/cSTIR/include -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/xSTIR/cSTIR -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/Registration/cReg/include -I/usr/include/vtk-7.1 -I/home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/Registration/NiftyMoMo/include -isystem /home/eric/SIRF-SuperBuild/Install/include -isystem /home/eric/SIRF-SuperBuild/Install/include/ismrmrd -isystem /usr/include/ITK-4.13 -isystem /usr/include/gdcm-3.0  -O3 -DNDEBUG -fPIE   -fopenmp -std=gnu++11 -o CMakeFiles/MR_TESTS_CPLUSPLUS.dir/mrtests.cpp.o -c /home/eric/SIRF-SuperBuild/Build/sources/SIRF/src/xGadgetron/cGadgetron/tests/mrtests.cpp

This means that the boost-related modifications (with add_definitions) were not taken on board for some reason. If you do have it in the files, then I guess I'd remove builds/SIRF, redo the cmake and make again.

Otherwise, we can force it without the SuperBuild for now (but it'll come and bite you later)

cd builds/SIRF/build
cmake . -DCMAKE_CXX_FLAGS="-DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_SYSTEM_NO_DEPRECATED"
make -j4 install

However, once you start doing this, any build from the SuperBuild main directory will likely overwrite whatever you did in the SIRF build directory.

If it still doesn't work, remove the mrtests.cpp.o again, do the verbose make, and check if the compilation flags now include the above.

KrisThielemans commented 3 years ago

hmmm. checking my own installation, I see that those flags are there. In fact, we have https://github.com/SyneRBI/SIRF-SuperBuild/blob/0365a51041f885e652d560ad7d4848555ad19fe0/SuperBuild/External_Boost.cmake#L111-L117

So... what version of the SuperBuild are you using?

Ede1994 commented 3 years ago

HAHA! It works! I just did this steps again:

rm builds/SIRF
  1. change sources/SIRF/CMakeLists.txt by added the following line
add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
make

I don't know why it didn't work the first time, but it worked the second time. SO I'm happy :) Thank you so much!!!!!!

KrisThielemans commented 3 years ago

😄

Could you please confirm your SuperBuild version, and in particular if you have the above quoted lines in your SuperBuild/External_Boost.cmake. If so, we need to think why you still needed to add these variables by hand.

If you do have them, I'd like to ask you to restart this process, which you could do via

mv sources/SIRF sources/SIRF-that-worked
mv builds/SIRF builds/SIRF-that-worked
cmake -DDISABLE_GIT_CHECKOUT:BOOL=OFF .
make -j4

If that works, it was a case of existing files messing everything up (and downgrading to gcc8)

Ede1994 commented 3 years ago

I hope that is the correct way to confirm the SuperBuild version: DEFAULT_SIRF_TAG v2.2.0 ? Or should I use a special command?

Could you please confirm your SuperBuild version, and in particular if you have the above quoted lines in your SuperBuild/External_Boost.cmake. If so, we need to think why you still needed to add these variables by hand.

I can't find any indicator in SuperBuild/External_Boost.cmake

mv sources/SIRF sources/SIRF-that-worked
mv builds/SIRF builds/SIRF-that-worked
cmake -DDISABLE_GIT_CHECKOUT:BOOL=OFF .
make -j4

-> same error message occurs

error_msg.txt

Ede1994 commented 3 years ago

I hope that is the correct way to confirm the SuperBuild version: DEFAULT_SIRF_TAG v2.2.0 ? Or should I use a special command?

I can't find any indicator in SuperBuild/External_Boost.cmake

mv sources/SIRF sources/SIRF-that-worked
mv builds/SIRF builds/SIRF-that-worked
cmake -DDISABLE_GIT_CHECKOUT:BOOL=OFF .
make -j4

-> same error message occurs

error_msg.txt

KrisThielemans commented 3 years ago

ok,

cd ~/devel/SIRF-SuperBuild # or wherever your source is
git checkout master

that'll help!

Ede1994 commented 3 years ago
cd ~/devel/SIRF-SuperBuild # or wherever your source is
git checkout master

Delivered:

Already on 'master
Your branch is on the same level as 'origin/master'.

(own translation, because I use linux in german)

KrisThielemans commented 3 years ago

I forgot git pull

Ede1994 commented 3 years ago

Okay. git pull:

remote: Counting objects: 100% (94/94), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 121 (delta 83), reused 90 (delta 81), pack-reused 27
Empfange Objekte: 100% (121/121), 26.43 KiB | 1.65 MiB/s, Fertig.
Löse Unterschiede auf: 100% (83/83), abgeschlossen mit 26 lokalen Objekten.
Von https://github.com/SyneRBI/SIRF-SuperBuild
   d05907b..0365a51  master                 -> origin/master
 * [neuer Branch]    build_Gadgetron_master -> origin/build_Gadgetron_master
 * [neuer Branch]    stir_build_swig        -> origin/stir_build_swig
 * [neuer Branch]    update_cil_master      -> origin/update_cil_master
Aktualisiere d05907b..0365a51
Fast-forward
 .travis.yml                                    | 78 +++++++++++++++++++----------------------------
 CMake/SetGitTagAndRepo.cmake                   | 18 ++++++-----
 SuperBuild/External_Armadillo.cmake            |  1 +
 SuperBuild/External_Boost.cmake                |  8 +++++
 SuperBuild/External_CCPi-Framework.cmake       |  3 ++
 SuperBuild/External_FFTW3.cmake                | 19 +++++++++---
 SuperBuild/External_FFTW3double.cmake          |  4 ---
 SuperBuild/External_FFTW_build.cmake           |  0
 SuperBuild/External_FFTW_configure.cmake       |  0
 SuperBuild/External_FFTWdouble_build.cmake     |  0
 SuperBuild/External_FFTWdouble_configure.cmake |  0
 SuperBuild/External_Gadgetron.cmake            |  1 +
 SuperBuild/External_HDF5.cmake                 |  1 +
 SuperBuild/External_ISMRMRD.cmake              |  1 +
 SuperBuild/External_ITK.cmake                  | 18 +++++++++++
 SuperBuild/External_SIRF.cmake                 |  1 +
 SuperBuild/External_STIR.cmake                 | 21 ++++++++-----
 version_config.cmake                           |  2 +-
 18 files changed, 104 insertions(+), 72 deletions(-)
 delete mode 100644 SuperBuild/External_FFTW_build.cmake
 delete mode 100644 SuperBuild/External_FFTW_configure.cmake
 delete mode 100644 SuperBuild/External_FFTWdouble_build.cmake
 delete mode 100644 SuperBuild/External_FFTWdouble_configure.cmake
KrisThielemans commented 3 years ago

ok, now build again.

Ede1994 commented 3 years ago

It works.

KrisThielemans commented 3 years ago

ok great!

For posterity:

This is more positive than feared.

thanks Eric!