SyneRBI / SIRF-SuperBuild

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

Windows: IMRMRD fails to link with self built Boost #720

Open paskino opened 2 years ago

paskino commented 2 years ago

If building for Linux we specify which libraries we build for Boost https://github.com/SyneRBI/SIRF-SuperBuild/blob/eb7d38fb8aa1d1104497d1c32fea7c68e1cbe9ac/SuperBuild/External_Boost_configureboost.cmake#L27

However, this is not available for Windows and I noticed that random for instance is not built, so ISMRMD fails.

paskino commented 2 years ago

I get the following in my build.

Component configuration:

      - atomic                   : building
      - chrono                   : building
      - container                : not building
      - context                  : not building
      - contract                 : not building
      - coroutine                : not building
      - date_time                : building
      - exception                : not building
      - fiber                    : not building
      - filesystem               : building
      - graph                    : not building
      - graph_parallel           : not building
      - headers                  : not building
      - iostreams                : not building
      - locale                   : not building
      - log                      : not building
      - math                     : not building
      - mpi                      : not building
      - program_options          : building
      - python                   : not building
      - random                   : not building
      - regex                    : not building
      - serialization            : not building
      - stacktrace               : not building
      - system                   : building
      - test                     : building
      - thread                   : building
      - timer                    : building
      - type_erasure             : not building
      - wave                     : not building

Therefore we are missing regex and random.

paskino commented 2 years ago

Apparently, these are specified here https://github.com/SyneRBI/SIRF-SuperBuild/blob/eb7d38fb8aa1d1104497d1c32fea7c68e1cbe9ac/SuperBuild/External_Boost_buildboost.cmake#L25-L26

paskino commented 2 years ago

I added regex and random and I still experience problems.

generate_cartesian_shepp_logan.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::program_options::invalid_option_value::invalid_option_val
ue(class boost::program_options::invalid_option_value const &)" (__imp_??0invalid_option_value@program_options@boost@@QEAA@AEBV012@@Z) referenced in function "struct boost::wrapexcep
t<class boost::program_options::invalid_option_value> __cdecl boost::exception_detail::enable_both<class boost::program_options::invalid_option_value>(class boost::program_options::i
nvalid_option_value const &)" (??$enable_both@Vinvalid_option_value@program_options@boost@@@exception_detail@boost@@YA?AU?$wrapexcept@Vinvalid_option_value@program_options@boost@@@1@
AEBVinvalid_option_value@program_options@1@@Z) [C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\utilities\ismrmrd_generate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\bu
ildVM\ISMRMRD.vcxproj]
      Hint on symbols that are defined and could potentially match:
        "__declspec(dllimport) public: __cdecl boost::program_options::invalid_option_value::invalid_option_value(class std::basic_string<char,struct std::char_traits<char>,class std
  ::allocator<char> > const &)" (__imp_??0invalid_option_value@program_options@boost@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
generate_cartesian_shepp_logan.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::program_options::detail::cmdline::cmdline(class std::vect
or<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::
allocator<char> > > > const &)" (__imp_??0cmdline@detail@program_options@boost@@QEAA@AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_
string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) referenced in function "public: __cdecl boost::program_options::basic_command_line_parser<char>::basic_command_line_
parser<char>(int,char const * const * const)" (??0?$basic_command_line_parser@D@program_options@boost@@QEAA@HQEBQEBD@Z) [C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\utilities\
ismrmrd_generate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
generate_cartesian_shepp_logan.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl boost::program_options::detail::cmdline::style(int)" (__imp
_?style@cmdline@detail@program_options@boost@@QEAAXH@Z) referenced in function "class boost::program_options::basic_parsed_options<char> __cdecl boost::program_options::parse_command
_line<char>(int,char const * const * const,class boost::program_options::options_description const &,int,class boost::function1<struct std::pair<class std::basic_string<char,struct s
td::char_traits<char>,class std::allocator<char> >,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> > const &>)" (??$parse_command_line@D@program_options@boost@@YA?AV?$basic_parsed_options@D@01@HQEBQEBDAEBVoptions_description@01@HV?$func
tion1@U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@1@@Z) [C:\Users\ofn77899\Dev\buil
dVM\builds\ISMRMRD\build\utilities\ismrmrd_generate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
generate_cartesian_shepp_logan.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl boost::program_options::detail::cmdline::get_canonical_optio
n_prefix(void)" (__imp_?get_canonical_option_prefix@cmdline@detail@program_options@boost@@QEAAHXZ) referenced in function "public: class boost::program_options::basic_parsed_options<
char> __cdecl boost::program_options::basic_command_line_parser<char>::run(void)" (?run@?$basic_command_line_parser@D@program_options@boost@@QEAA?AV?$basic_parsed_options@D@23@XZ) [C
:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\utilities\ismrmrd_generate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
generate_cartesian_shepp_logan.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl boost::program_options::detail::cmdline::set_options_descri
ption(class boost::program_options::options_description const &)" (__imp_?set_options_description@cmdline@detail@program_options@boost@@QEAAXAEBVoptions_description@34@@Z) referenced
 in function "class boost::program_options::basic_parsed_options<char> __cdecl boost::program_options::parse_command_line<char>(int,char const * const * const,class boost::program_op
tions::options_description const &,int,class boost::function1<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basi
c_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> > const &>)" (??$pars
e_command_line@D@program_options@boost@@YA?AV?$basic_parsed_options@D@01@HQEBQEBDAEBVoptions_description@01@HV?$function1@U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@
D@2@@std@@V12@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@1@@Z) [C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\utilities\ismrmrd_generate_cartesian_shep
p_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
generate_cartesian_shepp_logan.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::vector<class boost::program_options::basic_option<char>,class
 std::allocator<class boost::program_options::basic_option<char> > > __cdecl boost::program_options::detail::cmdline::run(void)" (__imp_?run@cmdline@detail@program_options@boost@@QEA
A?AV?$vector@V?$basic_option@D@program_options@boost@@V?$allocator@V?$basic_option@D@program_options@boost@@@std@@@std@@XZ) referenced in function "public: class boost::program_optio
ns::basic_parsed_options<char> __cdecl boost::program_options::basic_command_line_parser<char>::run(void)" (?run@?$basic_command_line_parser@D@program_options@boost@@QEAA?AV?$basic_p
arsed_options@D@23@XZ) [C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\utilities\ismrmrd_generate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
generate_cartesian_shepp_logan.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl boost::program_options::detail::cmdline::set_additional_par
ser(class boost::function1<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &>)" (__imp_?set_additional_parser@cmdline@detai
l@program_options@boost@@QEAAXV?$function1@U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@
@2@@4@@Z) referenced in function "class boost::program_options::basic_parsed_options<char> __cdecl boost::program_options::parse_command_line<char>(int,char const * const * const,cla
ss boost::program_options::options_description const &,int,class boost::function1<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<cha
r> >,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> >
 const &>)" (??$parse_command_line@D@program_options@boost@@YA?AV?$basic_parsed_options@D@01@HQEBQEBDAEBVoptions_description@01@HV?$function1@U?$pair@V?$basic_string@DU?$char_traits@
D@std@@V?$allocator@D@2@@std@@V12@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@1@@Z) [C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\utilities\ismrmrd_gen
erate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
generate_cartesian_shepp_logan.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl boost::program_options::detail::cmdline::~cmdline(void)" (__imp_
??1cmdline@detail@program_options@boost@@QEAA@XZ) referenced in function "class boost::program_options::basic_parsed_options<char> __cdecl boost::program_options::parse_command_line<
char>(int,char const * const * const,class boost::program_options::options_description const &,int,class boost::function1<struct std::pair<class std::basic_string<char,struct std::ch
ar_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::basic_string<char,struct std::char_t
raits<char>,class std::allocator<char> > const &>)" (??$parse_command_line@D@program_options@boost@@YA?AV?$basic_parsed_options@D@01@HQEBQEBDAEBVoptions_description@01@HV?$function1@
U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@1@@Z) [C:\Users\ofn77899\Dev\buildVM\bu
ilds\ISMRMRD\build\utilities\ismrmrd_generate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
generate_cartesian_shepp_logan.obj : error LNK2001: unresolved external symbol "public: __cdecl boost::program_options::invalid_option_value::invalid_option_value(class boost::progra
m_options::invalid_option_value const &)" (??0invalid_option_value@program_options@boost@@QEAA@AEBV012@@Z) [C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\utilities\ismrmrd_gener
ate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\utilities\Release\ismrmrd_generate_cartesian_shepp_logan.exe : fatal error LNK1120: 9 unresolved externals [C:\Users\ofn77899\Dev\b
uildVM\builds\ISMRMRD\build\utilities\ismrmrd_generate_cartesian_shepp_logan.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]

and

test_main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl boost::unit_test::unit_test_main(bool (__cdecl*)(void),int,char * * const)" (__imp_?unit_
test_main@unit_test@boost@@YAHP6A_NXZHQEAPEAD@Z) referenced in function main [C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\tests\test_ismrmrd.vcxproj] [C:\Users\ofn77899\Dev\bu
ildVM\ISMRMRD.vcxproj]
C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\tests\Release\test_ismrmrd.exe : fatal error LNK1120: 1 unresolved externals [C:\Users\ofn77899\Dev\buildVM\builds\ISMRMRD\build\te
sts\test_ismrmrd.vcxproj] [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'C:\Users\ofn77899\Dev\bui
ldVM\CMakeFiles\6e769affef22a34aee1f60598d93f30e\ISMRMRD-update.rule;C:\Users\ofn77899\Dev\buildVM\CMakeFiles\6e769affef22a34aee1f60598d93f30e\ISMRMRD-patch.rule;C:\Users\ofn77899\De
v\buildVM\CMakeFiles\6e769affef22a34aee1f60598d93f30e\ISMRMRD-configure.rule;C:\Users\ofn77899\Dev\buildVM\CMakeFiles\6e769affef22a34aee1f60598d93f30e\ISMRMRD-build.rule;C:\Users\ofn
77899\Dev\buildVM\CMakeFiles\6e769affef22a34aee1f60598d93f30e\ISMRMRD-install.rule;C:\Users\ofn77899\Dev\buildVM\CMakeFiles\ba5f48e32deb1fe8e7cafa5e2d6ee847\ISMRMRD-complete.rule;C:\
Users\ofn77899\Dev\buildVM\CMakeFiles\3676d48c67df001e203b690bdfa72513\ISMRMRD.rule' exited with code 1. [C:\Users\ofn77899\Dev\buildVM\ISMRMRD.vcxproj]

As a matter of fact, the problems seem to be due to program_options and unit_test.

paskino commented 2 years ago

@evgueni-ovtchinnikov @KrisThielemans any suggestions?

KrisThielemans commented 2 years ago

I have never succeeded in doing this with building our own boost. At least at the time, it was very hard to pass compiler info, multi-threading etc etc to the boost build system. It also takes about half a day. As I mentioned in https://github.com/SyneRBI/SIRF-SuperBuild/issues/197#issuecomment-751800777 I downloaded the prebuilt boost binaries and installed this first. This is why we default to USE_SYSTEM_BOOST=ON on Windows https://github.com/SyneRBI/SIRF-SuperBuild/blob/eb7d38fb8aa1d1104497d1c32fea7c68e1cbe9ac/SuperBuild.cmake#L183-L187

I wouldn't invest too much time on trying to build boost ourselves really. (Certainly as we're aiming for conda anyway).

I'm a bit dismayed that it looks like I never documented my Windows set-up, except in the issues. Apologies.

paskino commented 2 years ago

BTW, in the current configuration we build in 32 bits.

KrisThielemans commented 2 years ago

I would definitely switch to 64 bit.

paskino commented 2 years ago

Me too, but haven't found how to. I tried address-model=64 as parameter to b2, but it hasn't worked.