SyneRBI / SIRF

Main repository for the CCP SynerBI software
http://www.ccpsynerbi.ac.uk
Other
59 stars 29 forks source link

Windows build boost linking problems #1124

Open paskino opened 2 years ago

paskino commented 2 years ago

I build SIRF on windows using HDF5, FFTW3 and Boost from conda. I have problems linking with Boost (I also set -DRUN_ISMRMRD_SHEPP_LOGAN:BOOL=OFF)

Any idea?

This is what I've done:

conda create --name sirf_b3 -c conda-forge \
  python numpy openblas matplotlib=3.4 docopt cmake \
  deprecation nose fftw hdf5 boost boost-cpp

cmake ..\..\SIRF-SuperBuild -DSIRF_TAG=origin/master -DSTIR_TAG=origin/master -DCIL_TAG=origin/master \
-DBUILD_Gadgetron=OFF -DUSE_SYSTEM_HDF5=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW=ON \
-DPYTHON_DEST_DIR=%CONDA_PREFIX%\lib\site-packages -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%
Creating directories for 'SIRF'
  Performing download step (git clone) for 'SIRF'
  Cloning into 'SIRF'...
  HEAD is now at a7813b71 Merge pull request #1119 from samdporter/Add_details_citation.cff
  Submodule 'data' (https://github.com/CCPPETMR/SIRF_data.git) registered for path 'data'
  Cloning into 'C:/Users/ofn77899/Dev/build/sirf_b4/sources/SIRF/data'...
  Submodule path 'data': checked out '5bd102338ee192edbbd7df3e9343695b20337677'
  Performing update step for 'SIRF'
  HEAD is now at a7813b71 Merge pull request #1119 from samdporter/Add_details_citation.cff
  No patch step for 'SIRF'
  Performing configure step for 'SIRF'
CUSTOMBUILD : CMake warning :  [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
  loading initial cache file C:/Users/ofn77899/Dev/build/sirf_b4/builds/SIRF/tmp/SIRF-cache-Release.cmake
    Ignoring extra path from command line:

     "C:/Users/ofn77899/Dev/build/sirf_b4/builds/SIRF/build/("

CUSTOMBUILD : CMake warning :  [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
    Ignoring extra path from command line:

     ")"

  CMake Deprecation Warning at CMakeLists.txt:33 (cmake_policy):
    The OLD behavior for policy CMP0078 will be removed from a future version
    of CMake.

    The cmake-policies(7) manual explains that the OLD behaviors of all
    policies are deprecated and that a policy should be set to OLD only under
    specific short-term circumstances.  Projects should be ported to the NEW
    behavior and not rely on setting a policy to OLD.

  -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
  -- The C compiler identification is MSVC 19.29.30133.0
  -- The CXX compiler identification is MSVC 19.29.30133.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bi
  n/Hostx64/x64/cl.exe - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/
  bin/Hostx64/x64/cl.exe - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Found Boost: C:/Apps/miniconda3/envs/sirf_b4/Library/lib/cmake/Boost-1.78.0/BoostConfig.cmake (found suitable version "1
  .78.0", minimum required is "1.36.0") found components: system filesystem thread date_time chrono
  CMake Warning at CMakeLists.txt:134 (message):
    Usage of PYTHON_EXECUTABLE is deprecated.  Use Python_EXECUTABLE instead.

  -- Found Python: C:/Apps/miniconda3/envs/sirf_b4/python.exe (found version "3.10.5") found components: Interpreter Developm
  ent Development.Module Development.Embed
  -- Python libraries found
  -- SIRF Python modules will be installed in C:/Apps/miniconda3/envs/sirf_b4/Lib/site-packages
  CMake Warning at CMakeLists.txt:181 (message):
    MATLAB not found.  Set Matlab_ROOT_DIR if you want it.  Set DISABLE_Matlab
    to ON to silence this warning.

  CMake Deprecation Warning at src/iUtilities/CMakeLists.txt:41 (cmake_policy):
    The OLD behavior for policy CMP0078 will be removed from a future version
    of CMake.

    The cmake-policies(7) manual explains that the OLD behaviors of all
    policies are deprecated and that a policy should be set to OLD only under
    specific short-term circumstances.  Projects should be ported to the NEW
    behavior and not rely on setting a policy to OLD.

  -- Found SWIG: C:/Apps/miniconda3/envs/sirf_b4/SWIG-3.0.12/swig.exe (found version "4.0.2")
  CMake Warning (dev) at C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:617 (message):
    Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
    flag.  Run "cmake --help-policy CMP0086" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.

  Call Stack (most recent call first):
    C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:888 (SWIG_ADD_SOURCE_TO_MODULE)
    src/iUtilities/CMakeLists.txt:57 (SWIG_ADD_LIBRARY)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Found HDF5 at C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake/hdf5 via NO_MODULE. Now trying to extract locations et
  c.
  -- Trying to get properties of target hdf5-shared
  -- Found imported configurations: RELEASE
  -- Start search through imported configurations in the following order: Release;RELWITHDEBINFO;RELEASE;DEBUG;RELEASE
  -- Selected imported configuration: RELEASE
  -- Found HDF5: C:/Apps/miniconda3/envs/sirf_b4/Library/lib/hdf5.lib;hdf5-shared (found version "1.12.1") found components:
  C
  -- HDF5_DIR: C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake/hdf5
  -- HDF5_DEFINITIONS:
  -- HDF5_INCLUDE_DIRS: C:/Apps/miniconda3/envs/sirf_b4/Library/include
  -- HDF5_LIBRARIES: C:/Apps/miniconda3/envs/sirf_b4/Library/lib/hdf5.lib;hdf5-shared
  -- HDF5_HL_LIBRARIES:
  -- HDF5_C_DEFINITIONS:
  -- HDF5_C_INCLUDE_DIR:
  -- HDF5_C_INCLUDE_DIRS: C:/Apps/miniconda3/envs/sirf_b4/Library/include
  -- HDF5_C_LIBRARY: C:/Apps/miniconda3/envs/sirf_b4/Library/lib/hdf5.lib
  -- HDF5_C_LIBRARIES: hdf5-shared
  -- HDF5_C_HL_LIBRARY:
  -- HDF5_C_HL_LIBRARIES:
  -- Defined targets (if any):
  -- ... hdf5::hdf5
  -- ... hdf5-static
  -- ... hdf5-shared
  -- ... hdf5_hl-static
  -- ... hdf5_hl-shared
  -- ... hdf5_cpp-static
  -- ... hdf5_cpp-shared
  -- ... hdf5_hl_cpp-static
  -- ... hdf5_hl_cpp-shared
  -- FFTW3 WINDOWS libraries: C:/Apps/miniconda3/envs/sirf_b4/FFTW/libfftw3f-3.lib
  -- Found FFTW3: C:/Apps/miniconda3/envs/sirf_b4/FFTW/libfftw3f-3.lib
  -- Install FFTW3 libraries from C:/Apps/miniconda3/envs/sirf_b4/FFTW
  -- Install boost shared libraries from
  CMake Warning at src/xGadgetron/cGadgetron/CMakeLists.txt:92 (MESSAGE):
    The Gadgetron Toolboxes required for radial gridding were NOT FOUND.
    Non-cartesian encoding will NOT BE compiled.

  -- Downloading (if not already done)...
                  Path:     C:/Users/ofn77899/Dev/build/sirf_b4/sources/SIRF/data/examples/MR/zenodo/3D_RPE_Lowres.h5
                  URL:      https://zenodo.org/record/4600937/files/3DRPE_Lowres.h5?download=1
                  MD5:      a692ba3a6c456d1ad49750717a9d5dda

  -- [download 100% complete]
  -- path for finding shared libs/DLLs when generating MR data: C:/Apps/miniconda3/envs/sirf_b4/lib;C:/Apps/miniconda3/envs/s
  irf_b4/bin/;;C:/Apps/miniconda3/envs/sirf_b4/FFTW/;C:/Apps/miniconda3/envs/sirf_b4/Library/lib//../bin
  CMake Deprecation Warning at src/xGadgetron/pGadgetron/CMakeLists.txt:22 (cmake_policy):
    The OLD behavior for policy CMP0078 will be removed from a future version
    of CMake.

    The cmake-policies(7) manual explains that the OLD behaviors of all
    policies are deprecated and that a policy should be set to OLD only under
    specific short-term circumstances.  Projects should be ported to the NEW
    behavior and not rely on setting a policy to OLD.

  CMake Warning (dev) at C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:617 (message):
    Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
    flag.  Run "cmake --help-policy CMP0086" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.

  Call Stack (most recent call first):
    C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:888 (SWIG_ADD_SOURCE_TO_MODULE)
    src/xGadgetron/pGadgetron/CMakeLists.txt:36 (SWIG_ADD_LIBRARY)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Found OpenMP_C: -openmp (found version "2.0")
  -- Found OpenMP_CXX: -openmp (found version "2.0")
  -- Found OpenMP: TRUE (found version "2.0")
  -- Matlab not enabled, so SPM cannot be enabled
  -- VTK found: 0
  CMake Deprecation Warning at src/Registration/pReg/CMakeLists.txt:22 (cmake_policy):
    The OLD behavior for policy CMP0078 will be removed from a future version
    of CMake.

    The cmake-policies(7) manual explains that the OLD behaviors of all
    policies are deprecated and that a policy should be set to OLD only under
    specific short-term circumstances.  Projects should be ported to the NEW
    behavior and not rely on setting a policy to OLD.

  CMake Warning (dev) at C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:617 (message):
    Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
    flag.  Run "cmake --help-policy CMP0086" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.

  Call Stack (most recent call first):
    C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:888 (SWIG_ADD_SOURCE_TO_MODULE)
    src/Registration/pReg/CMakeLists.txt:39 (SWIG_ADD_LIBRARY)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- ITK support in STIR enabled.
  -- HDF5 support in STIR enabled.
  -- Found HDF5 at C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake/hdf5 via NO_MODULE. Now trying to extract locations et
  c.
  -- Trying to get properties of target hdf5_cpp-shared
  -- Found imported configurations: RELEASE
  -- Start search through imported configurations in the following order: Release;RELWITHDEBINFO;RELEASE;DEBUG;RELEASE
  -- Selected imported configuration: RELEASE
  -- Found HDF5: C:/Apps/miniconda3/envs/sirf_b4/Library/lib/hdf5.lib;hdf5_cpp-shared (found suitable version "1.12.1", minim
  um required is "1.12.1") found components: CXX
  -- HDF5_DIR: C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake/hdf5
  -- HDF5_DEFINITIONS:
  -- HDF5_INCLUDE_DIRS: C:/Apps/miniconda3/envs/sirf_b4/Library/include
  -- HDF5_LIBRARIES: C:/Apps/miniconda3/envs/sirf_b4/Library/lib/hdf5.lib;hdf5_cpp-shared
  -- HDF5_HL_LIBRARIES:
  -- HDF5_CXX_DEFINITIONS:
  -- HDF5_CXX_INCLUDE_DIR:
  -- HDF5_CXX_INCLUDE_DIRS: C:/Apps/miniconda3/envs/sirf_b4/Library/include
  -- HDF5_CXX_LIBRARY: C:/Apps/miniconda3/envs/sirf_b4/Library/lib/hdf5_cpp.lib
  -- HDF5_CXX_LIBRARIES: hdf5_cpp-shared
  -- HDF5_CXX_HL_LIBRARY:
  -- HDF5_CXX_HL_LIBRARIES:
  -- Defined targets (if any):
  -- ... hdf5::hdf5
  -- ... hdf5-static
  -- ... hdf5-shared
  -- ... hdf5_hl-static
  -- ... hdf5_hl-shared
  -- ... hdf5::hdf5_cpp
  -- ... hdf5_cpp-static
  -- ... hdf5_cpp-shared
  -- ... hdf5_hl_cpp-static
  -- ... hdf5_hl_cpp-shared
  -- STIR version found: 5.1.0
  -- STIR not built with NiftyPET.
  -- STIR not built with Parallelproj.
  CMake Deprecation Warning at src/xSTIR/pSTIR/CMakeLists.txt:21 (cmake_policy):
    The OLD behavior for policy CMP0078 will be removed from a future version
    of CMake.

    The cmake-policies(7) manual explains that the OLD behaviors of all
    policies are deprecated and that a policy should be set to OLD only under
    specific short-term circumstances.  Projects should be ported to the NEW
    behavior and not rely on setting a policy to OLD.

  CMake Warning (dev) at C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:617 (message):
    Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
    flag.  Run "cmake --help-policy CMP0086" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.

  Call Stack (most recent call first):
    C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:888 (SWIG_ADD_SOURCE_TO_MODULE)
    src/xSTIR/pSTIR/CMakeLists.txt:37 (SWIG_ADD_LIBRARY)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Registration, ISMRMRD and STIR (with ITK) have been built. Building synergistic code.
  -- Downloading (if not already done)...
                Path:     C:/Users/ofn77899/Dev/build/sirf_b4/sources/SIRF/data/examples/MR/zenodo/SIRF_recon.h5
                URL:      https://zenodo.org/record/3571228/files/SIRF_recon.h5?download=1
                MD5:      0d69892502d3a5cd220716a717cc2c26

  -- [download 100% complete]
  -- Downloading (if not already done)...
                Path:     C:/Users/ofn77899/Dev/build/sirf_b4/sources/SIRF/data/examples/MR/zenodo/dicom_as_nifti.nii
                URL:      https://zenodo.org/record/3571228/files/dicom_as_nifti.nii?download=1
                MD5:      c5f5b519e5c032560ead912713479b53

  -- [download 100% complete]
  -- Registration, ISMRMRD and STIR (with ITK) have been built.
  CMake Deprecation Warning at src/common/CMakeLists.txt:59 (cmake_policy):
    The OLD behavior for policy CMP0078 will be removed from a future version
    of CMake.

    The cmake-policies(7) manual explains that the OLD behaviors of all
    policies are deprecated and that a policy should be set to OLD only under
    specific short-term circumstances.  Projects should be ported to the NEW
    behavior and not rely on setting a policy to OLD.

  CMake Warning (dev) at C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:617 (message):
    Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
    flag.  Run "cmake --help-policy CMP0086" for policy details.  Use the
    cmake_policy command to set the policy and suppress this warning.

  Call Stack (most recent call first):
    C:/Apps/miniconda3/envs/sirf_b4/Library/share/cmake-3.23/Modules/UseSWIG.cmake:888 (SWIG_ADD_SOURCE_TO_MODULE)
    src/common/CMakeLists.txt:66 (SWIG_ADD_LIBRARY)
  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- python alias:pGadgetron<-sirf.Gadgetron
  -- python alias:pSTIR<-sirf.STIR
  -- python alias:pUtilities<-sirf.Utilities
  -- python alias:pygadgetron<-sirf.pygadgetron
  -- python alias:pystir<-sirf.pystir
  -- python alias:pyiutilities<-sirf.pyiutilities
  -- python alias:pReg<-sirf.Reg
  -- python alias:pyreg<-sirf.pyreg
  -- setup.py:C:/Apps/miniconda3/envs/sirf_b4/Lib/site-packages/setup.py
  -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
  -- Configuring done
  -- Generating done
cgadgetron.lib(gadgetron_x.obj) : error LNK2019: unresolved external symbol "public: __cdecl boost::thread::thread(void)" (??
0thread@boost@@QEAA@XZ) referenced in function "public: __cdecl sirf::GTConnector::GTConnector(void)" (??0GTConnector@sirf@@Q
EAA@XZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_
b4\SIRF.vcxproj]
cgadgetron.lib(gadgetron_x.obj) : error LNK2019: unresolved external symbol "public: class boost::thread::id __cdecl boost::t
hread::get_id(void)const " (?get_id@thread@boost@@QEBA?AVid@12@XZ) referenced in function "public: void __cdecl sirf::Gadgetr
onClientConnector::wait(void)" (?wait@GadgetronClientConnector@sirf@@QEAAXXZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIR
F\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(cgadgetron.obj) : error LNK2001: unresolved external symbol "public: class boost::thread::id __cdecl boost::th
read::get_id(void)const " (?get_id@thread@boost@@QEBA?AVid@12@XZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\
common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(gadgetron_x.obj) : error LNK2019: unresolved external symbol "private: bool __cdecl boost::thread::join_noexce
pt(void)" (?join_noexcept@thread@boost@@AEAA_NXZ) referenced in function "public: void __cdecl sirf::GadgetronClientConnector
::wait(void)" (?wait@GadgetronClientConnector@sirf@@QEAAXXZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\commo
n\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(cgadgetron.obj) : error LNK2001: unresolved external symbol "private: bool __cdecl boost::thread::join_noexcep
t(void)" (?join_noexcept@thread@boost@@AEAA_NXZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vc
xproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(gadgetron_x.obj) : error LNK2019: unresolved external symbol "public: void __cdecl boost::thread::detach(void)
" (?detach@thread@boost@@QEAAXXZ) referenced in function "public: virtual __cdecl sirf::GadgetronClientConnector::~GadgetronC
lientConnector(void)" (??1GadgetronClientConnector@sirf@@UEAA@XZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\
common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(gadgetron_client.obj) : error LNK2001: unresolved external symbol "public: void __cdecl boost::thread::detach(
void)" (?detach@thread@boost@@QEAAXXZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:
\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(gadgetron_x.obj) : error LNK2019: unresolved external symbol "class boost::thread::id __cdecl boost::this_thre
ad::get_id(void)" (?get_id@this_thread@boost@@YA?AVid@thread@2@XZ) referenced in function "public: void __cdecl sirf::Gadgetr
onClientConnector::wait(void)" (?wait@GadgetronClientConnector@sirf@@QEAAXXZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIR
F\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(cgadgetron.obj) : error LNK2001: unresolved external symbol "class boost::thread::id __cdecl boost::this_threa
d::get_id(void)" (?get_id@this_thread@boost@@YA?AVid@thread@2@XZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\
common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(gadgetron_client.obj) : error LNK2019: unresolved external symbol "public: virtual __cdecl boost::detail::thre
ad_data_base::~thread_data_base(void)" (??1thread_data_base@detail@boost@@UEAA@XZ) referenced in function "public: virtual vo
id * __cdecl boost::detail::thread_data<class boost::_bi::bind_t<void,class boost::_mfi::mf0<void,class sirf::GadgetronClient
Connector>,class boost::_bi::list1<class boost::_bi::value<class sirf::GadgetronClientConnector *> > > >::`scalar deleting de
structor'(unsigned int)" (??_G?$thread_data@V?$bind_t@XV?$mf0@XVGadgetronClientConnector@sirf@@@_mfi@boost@@V?$list1@V?$value
@PEAVGadgetronClientConnector@sirf@@@_bi@boost@@@_bi@3@@_bi@boost@@@detail@boost@@UEAAPEAXI@Z) [C:\Users\ofn77899\Dev\build\s
irf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
cgadgetron.lib(gadgetron_client.obj) : error LNK2019: unresolved external symbol "private: bool __cdecl boost::thread::start_
thread_noexcept(void)" (?start_thread_noexcept@thread@boost@@AEAA_NXZ) referenced in function "public: void __cdecl sirf::Gad
getronClientConnector::connect(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class
std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?connect@GadgetronClientConnector@sirf@@
QEAAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\buil
d\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(NiftiImageData.obj) : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert
(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &
,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEBD0AEAV?$basic_stri
ng@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) referenced in function "void __cdecl
check_folder_exists_if_not_create(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > con
st &)" (?check_folder_exists_if_not_create@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) [C:\Users
\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(AffineTransformation.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem::path_traits::c
onvert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_
t> > &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEBD0AEAV?$basi
c_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) [C:\Users\ofn77899\Dev\build\si
rf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(NiftiImageData.obj) : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem::path_traits::convert
(wchar_t const *,wchar_t const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,cl
ass std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEB_W0AEAV?$basic_string
@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) referenced in function "void __cdecl check
_folder_exists_if_not_create(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)
" (?check_folder_exists_if_not_create@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) [C:\Users\ofn7
7899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(AffineTransformation.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem::path_traits::c
onvert(wchar_t const *,wchar_t const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char>
> &,class std::codecvt<wchar_t,char,struct _Mbstatet> const &)" (?convert@path_traits@filesystem@boost@@YAXPEB_W0AEAV?$basic_
string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$codecvt@_WDU_Mbstatet@@@5@@Z) [C:\Users\ofn77899\Dev\build\sirf_b4
\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(NiftiImageData.obj) : error LNK2019: unresolved external symbol "public: static class std::codecvt<wchar_t,char,struc
t _Mbstatet> const & __cdecl boost::filesystem::path::codecvt(void)" (?codecvt@path@filesystem@boost@@SAAEBV?$codecvt@_WDU_Mb
statet@@@std@@XZ) referenced in function "void __cdecl check_folder_exists_if_not_create(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > const &)" (?check_folder_exists_if_not_create@@YAXAEBV?$basic_string@DU?$
char_traits@D@std@@V?$allocator@D@2@@std@@@Z) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxpr
oj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(AffineTransformation.obj) : error LNK2001: unresolved external symbol "public: static class std::codecvt<wchar_t,char
,struct _Mbstatet> const & __cdecl boost::filesystem::path::codecvt(void)" (?codecvt@path@filesystem@boost@@SAAEBV?$codecvt@_
WDU_Mbstatet@@@std@@XZ) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899
\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(NiftiImageData.obj) : error LNK2019: unresolved external symbol "private: unsigned __int64 __cdecl boost::filesystem:
:path::find_parent_path_size(void)const " (?find_parent_path_size@path@filesystem@boost@@AEBA_KXZ) referenced in function "vo
id __cdecl check_folder_exists_if_not_create(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<
char> > const &)" (?check_folder_exists_if_not_create@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIR
F.vcxproj]
Reg.lib(AffineTransformation.obj) : error LNK2001: unresolved external symbol "private: unsigned __int64 __cdecl boost::files
ystem::path::find_parent_path_size(void)const " (?find_parent_path_size@path@filesystem@boost@@AEBA_KXZ) [C:\Users\ofn77899\D
ev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(NiftiImageData.obj) : error LNK2019: unresolved external symbol "class boost::filesystem::file_status __cdecl boost::
filesystem::detail::status(class boost::filesystem::path const &,class boost::system::error_code *)" (?status@detail@filesyst
em@boost@@YA?AVfile_status@23@AEBVpath@23@PEAVerror_code@system@3@@Z) referenced in function "void __cdecl check_folder_exist
s_if_not_create(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?check_fol
der_exists_if_not_create@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) [C:\Users\ofn77899\Dev\buil
d\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(AffineTransformation.obj) : error LNK2001: unresolved external symbol "class boost::filesystem::file_status __cdecl b
oost::filesystem::detail::status(class boost::filesystem::path const &,class boost::system::error_code *)" (?status@detail@fi
lesystem@boost@@YA?AVfile_status@23@AEBVpath@23@PEAVerror_code@system@3@@Z) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\
build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(NiftiImageData.obj) : error LNK2019: unresolved external symbol "bool __cdecl boost::filesystem::detail::create_direc
tory(class boost::filesystem::path const &,class boost::filesystem::path const *,class boost::system::error_code *)" (?create
_directory@detail@filesystem@boost@@YA_NAEBVpath@23@PEBV423@PEAVerror_code@system@3@@Z) referenced in function "void __cdecl
check_folder_exists_if_not_create(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > con
st &)" (?check_folder_exists_if_not_create@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) [C:\Users
\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(AffineTransformation.obj) : error LNK2001: unresolved external symbol "bool __cdecl boost::filesystem::detail::create
_directory(class boost::filesystem::path const &,class boost::filesystem::path const *,class boost::system::error_code *)" (?
create_directory@detail@filesystem@boost@@YA_NAEBVpath@23@PEBV423@PEAVerror_code@system@3@@Z) [C:\Users\ofn77899\Dev\build\si
rf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
Reg.lib(AffineTransformation.obj) : error LNK2019: unresolved external symbol "private: class boost::filesystem::path __cdecl
 boost::filesystem::path::extension_v3(void)const " (?extension_v3@path@filesystem@boost@@AEBA?AV123@XZ) referenced in functi
on "public: virtual void __cdecl sirf::AffineTransformation<float>::write(class std::basic_string<char,struct std::char_trait
s<char>,class std::allocator<char> > const &)const " (?write@?$AffineTransformation@M@sirf@@UEBAXAEBV?$basic_string@DU?$char_
traits@D@std@@V?$allocator@D@2@@std@@@Z) [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [
C:\Users\ofn77899\Dev\build\sirf_b4\SIRF.vcxproj]
C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\Release\_pysirf.pyd : fatal error LNK1120: 14 unresolved ext
ernals [C:\Users\ofn77899\Dev\build\sirf_b4\builds\SIRF\build\src\common\_pysirf.vcxproj] [C:\Users\ofn77899\Dev\build\sirf_b
4\SIRF.vcxproj]
KrisThielemans commented 2 years ago

I'm not sure but think this is a common problem with CMake and boost. I think it happens when both static and dynamic boost libraries are present. We had a similar problem for ISMRMRD https://github.com/SyneRBI/SIRF-SuperBuild/issues/403 with https://github.com/ismrmrd/ismrmrd/pull/134 (merged) giving more info in the comments.

It probably means we should add target_compile_definitions(BOOST_ALL_DYN_LINK=1) if WIN32 (see boost doc for info on that variable).

Other pointers https://github.com/SyneRBI/SIRF-SuperBuild/blob/c19d1340dfc623518c3594538cc4a7121a14b670/SuperBuild/External_Boost.cmake#L105-L111

Re-reading some of this, I'm not sure if I understood it all correctly (I certainly don't understand it now!). Adding this flag would likely prevent linking with static boost libraries, but this is probably not very common. I feel CMake should sort this out, but it doesn't seem to.

Also informative seems https://stackoverflow.com/a/4763452/3467846 with recommendations on how to diagnose.