Closed Tobias-Fischer closed 11 months ago
@mikesheffler and I spent a lot of time on Windows compilation, but there is still a lot of work to do. I might have cycles for this after the ICRA deadline...
Thanks, sounds good!
One thing I forgot to mention is that we only tried with the last release (4.1.1), not with the latest commit on develop where some fixes might have landed.
I've been solidly on the Linux side since February**, but I can do some test building on Windows as another data point, if that is helpful.
I updated VS 2019 and pulled the HEAD
of develop
. Configuring with default options, the debug
configuration of gtsam
builds, but gtsam_unstable
does not. There are a lot of linker errors related to multiply-defined symbols. Just for grins, I thought I would try the release
configuration, but I forgot that TangentPreintegration.cpp
takes like an hour (literally) to compile in release
, so I'm not sure yet -- I would expect to see the same stuff as in debug
, but it would be good to confirm.
What would actually be helpful for me to do? Should I try to replicate @Tobias-Fischer 's setup or try something else?
** It looks like #1087 is still open. I'm not sure if I still owe anything on that issue? I just kind of wandered off when #1107 landed, and I'm not sure what remains to be done.
Hiya - I'm just wondering whether you had any time to look into this?
I'll definitely look into this. @mattking-smith and I were talking about the wrapper on Windows so I have motivation. :)
I'll definitely look into this. @mattking-smith and I were talking about the wrapper on Windows so I have motivation. :)
Yeah, I definitely have lots of interest from sponsors using GTSAM
for Windows wrapping availability. Sponsors have limited Unix OS availability, so @varunagrawal let me know how I can help here.
I'm encountering similar issues both for the python and matlab wrappers. In VisualStudio2019, the project gtsam builds successfully, but not gtsam_py
Build started...
1>------ Build started: Project: gtsam_header, Configuration: Release x64 ------
2>------ Build started: Project: pybind_wrap_gtsam, Configuration: Release x64 ------
1>Building Custom Rule C:/gtsam/python/CMakeLists.txt
2>Building Custom Rule C:/gtsam/python/CMakeLists.txt
3>------ Build started: Project: gtsam_py, Configuration: Release x64 ------
3>Building Custom Rule C:/gtsam/python/CMakeLists.txt
3>LINK : fatal error LNK1149: output filename matches input filename 'C:\gtsam\build\lib\Release\gtsam.lib'
3>Done building project "gtsam_py.vcxproj" -- FAILED.
========== Build: 2 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========
or gtsam_matlab_wrapper
1> Creating library C:/gtsam/build/wrap/gtsam_mex/Release/gtsam_wrapper.lib and object C:/gtsam/build/wrap/gtsam_mex/Release/gtsam_wrapper.exp
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl gtsam::RedirectCout::str(void)const " (?str@RedirectCout@gtsam@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "void __cdecl gtsamRedirectCout_str_106(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?gtsamRedirectCout_str_106@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: __cdecl gtsam::RedirectCout::~RedirectCout(void)" (??1RedirectCout@gtsam@@QEAA@XZ) referenced in function "public: __cdecl std::_Temporary_owner<struct gtsam::RedirectCout>::~_Temporary_owner<struct gtsam::RedirectCout>(void)" (??1?$_Temporary_owner@URedirectCout@gtsam@@@std@@QEAA@XZ)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl gtsam::markdown(class gtsam::DiscreteValues const &,class std::function<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl(unsigned __int64)> const &,class std::map<unsigned __int64,class std::vector<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> > > >,struct std::less<unsigned __int64>,class std::allocator<struct std::pair<unsigned __int64 const ,class std::vector<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 &)" (?markdown@gtsam@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVDiscreteValues@1@AEBV?$function@$$A6A?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_K@Z@3@AEBV?$map@_KV?$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@@U?$less@_K@2@V?$allocator@U?$pair@$$CB_KV?$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@@@std@@@2@@3@@Z) referenced in function "void __cdecl markdown_812(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?markdown_812@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl gtsam::html(class gtsam::DiscreteValues const &,class std::function<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl(unsigned __int64)> const &,class std::map<unsigned __int64,class std::vector<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> > > >,struct std::less<unsigned __int64>,class std::allocator<struct std::pair<unsigned __int64 const ,class std::vector<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 &)" (?html@gtsam@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBVDiscreteValues@1@AEBV?$function@$$A6A?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_K@Z@3@AEBV?$map@_KV?$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@@U?$less@_K@2@V?$allocator@U?$pair@$$CB_KV?$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@@@std@@@2@@3@@Z) referenced in function "void __cdecl html_815(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?html_815@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: static class std::optional<class gtsam::Pose2> __cdecl gtsam::Pose2::Align(class std::vector<struct std::pair<class Eigen::Matrix<double,2,1,0,2,1>,class Eigen::Matrix<double,2,1,0,2,1> >,class std::allocator<struct std::pair<class Eigen::Matrix<double,2,1,0,2,1>,class Eigen::Matrix<double,2,1,0,2,1> > > > const &)" (?Align@Pose2@gtsam@@SA?AV?$optional@VPose2@gtsam@@@std@@AEBV?$vector@U?$pair@V?$Matrix@N$01$00$0A@$01$00@Eigen@@V12@@std@@V?$allocator@U?$pair@V?$Matrix@N$01$00$0A@$01$00@Eigen@@V12@@std@@@2@@4@@Z) referenced in function "void __cdecl gtsamPose2_Align_1044(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?gtsamPose2_Align_1044@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: static class std::optional<class gtsam::Pose2> __cdecl gtsam::Pose2::Align(class Eigen::Matrix<double,-1,-1,0,-1,-1> const &,class Eigen::Matrix<double,-1,-1,0,-1,-1> const &)" (?Align@Pose2@gtsam@@SA?AV?$optional@VPose2@gtsam@@@std@@AEBV?$Matrix@N$0?0$0?0$0A@$0?0$0?0@Eigen@@0@Z) referenced in function "void __cdecl gtsamPose2_Align_1045(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?gtsamPose2_Align_1045@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: class Eigen::Matrix<double,-1,-1,0,-1,-1> __cdecl gtsam::Pose2::transformTo(class Eigen::Matrix<double,-1,-1,0,-1,-1> const &)const " (?transformTo@Pose2@gtsam@@QEBA?AV?$Matrix@N$0?0$0?0$0A@$0?0$0?0@Eigen@@AEBV34@@Z) referenced in function "void __cdecl gtsamPose2_transformTo_1040(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?gtsamPose2_transformTo_1040@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: class Eigen::Matrix<double,-1,-1,0,-1,-1> __cdecl gtsam::Pose2::transformFrom(class Eigen::Matrix<double,-1,-1,0,-1,-1> const &)const " (?transformFrom@Pose2@gtsam@@QEBA?AV?$Matrix@N$0?0$0?0$0A@$0?0$0?0@Eigen@@AEBV34@@Z) referenced in function "void __cdecl gtsamPose2_transformFrom_1038(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?gtsamPose2_transformFrom_1038@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "class std::vector<struct gtsam::SfmTrack2d,class std::allocator<struct gtsam::SfmTrack2d> > __cdecl gtsam::gtsfm::tracksFromPairwiseMatches(class std::map<class gtsam::IndexPair,class Eigen::Matrix<int,-1,2,0,-1,2>,struct std::less<class gtsam::IndexPair>,class std::allocator<struct std::pair<class gtsam::IndexPair const ,class Eigen::Matrix<int,-1,2,0,-1,2> > > > const &,class std::vector<struct gtsam::gtsfm::Keypoints,class std::allocator<struct gtsam::gtsfm::Keypoints> > const &,bool)" (?tracksFromPairwiseMatches@gtsfm@gtsam@@YA?AV?$vector@USfmTrack2d@gtsam@@V?$allocator@USfmTrack2d@gtsam@@@std@@@std@@AEBV?$map@VIndexPair@gtsam@@V?$Matrix@H$0?0$01$0A@$0?0$01@Eigen@@U?$less@VIndexPair@gtsam@@@std@@V?$allocator@U?$pair@$$CBVIndexPair@gtsam@@V?$Matrix@H$0?0$01$0A@$0?0$01@Eigen@@@std@@@6@@4@AEBV?$vector@UKeypoints@gtsfm@gtsam@@V?$allocator@UKeypoints@gtsfm@gtsam@@@std@@@4@_N@Z) referenced in function "void __cdecl tracksFromPairwiseMatches_4280(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?tracksFromPairwiseMatches_4280@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: class gtsam::NonlinearFactorGraph __cdecl gtsam::TranslationRecovery::buildGraph(class std::vector<class gtsam::BinaryMeasurement<class gtsam::Unit3>,class std::allocator<class gtsam::BinaryMeasurement<class gtsam::Unit3> > > const &)const " (?buildGraph@TranslationRecovery@gtsam@@QEBA?AVNonlinearFactorGraph@2@AEBV?$vector@V?$BinaryMeasurement@VUnit3@gtsam@@@gtsam@@V?$allocator@V?$BinaryMeasurement@VUnit3@gtsam@@@gtsam@@@std@@@std@@@Z) referenced in function "void __cdecl gtsamTranslationRecovery_buildGraph_4253(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?gtsamTranslationRecovery_buildGraph_4253@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: void __cdecl gtsam::TranslationRecovery::addPrior(class std::vector<class gtsam::BinaryMeasurement<class gtsam::Unit3>,class std::allocator<class gtsam::BinaryMeasurement<class gtsam::Unit3> > > const &,double,class std::vector<class gtsam::BinaryMeasurement<class Eigen::Matrix<double,3,1,0,3,1> >,class std::allocator<class gtsam::BinaryMeasurement<class Eigen::Matrix<double,3,1,0,3,1> > > > const &,class gtsam::NonlinearFactorGraph *,class std::shared_ptr<class gtsam::noiseModel::Base> const &)const " (?addPrior@TranslationRecovery@gtsam@@QEBAXAEBV?$vector@V?$BinaryMeasurement@VUnit3@gtsam@@@gtsam@@V?$allocator@V?$BinaryMeasurement@VUnit3@gtsam@@@gtsam@@@std@@@std@@NAEBV?$vector@V?$BinaryMeasurement@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@gtsam@@V?$allocator@V?$BinaryMeasurement@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@gtsam@@@std@@@4@PEAVNonlinearFactorGraph@2@AEBV?$shared_ptr@VBase@noiseModel@gtsam@@@4@@Z) referenced in function "void __cdecl gtsamTranslationRecovery_addPrior_4251(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?gtsamTranslationRecovery_addPrior_4251@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>gtsam_wrapper.obj : error LNK2019: unresolved external symbol "public: class gtsam::Values __cdecl gtsam::TranslationRecovery::run(class std::vector<class gtsam::BinaryMeasurement<class gtsam::Unit3>,class std::allocator<class gtsam::BinaryMeasurement<class gtsam::Unit3> > > const &,double,class std::vector<class gtsam::BinaryMeasurement<class Eigen::Matrix<double,3,1,0,3,1> >,class std::allocator<class gtsam::BinaryMeasurement<class Eigen::Matrix<double,3,1,0,3,1> > > > const &,class gtsam::Values const &)const " (?run@TranslationRecovery@gtsam@@QEBA?AVValues@2@AEBV?$vector@V?$BinaryMeasurement@VUnit3@gtsam@@@gtsam@@V?$allocator@V?$BinaryMeasurement@VUnit3@gtsam@@@gtsam@@@std@@@std@@NAEBV?$vector@V?$BinaryMeasurement@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@gtsam@@V?$allocator@V?$BinaryMeasurement@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@gtsam@@@std@@@5@AEBV32@@Z) referenced in function "void __cdecl gtsamTranslationRecovery_run_4254(int,struct mxArray_tag * * const,int,struct mxArray_tag const * * const)" (?gtsamTranslationRecovery_run_4254@@YAXHQEAPEAUmxArray_tag@@HQEAPEBU1@@Z)
1>C:\gtsam\build\wrap\gtsam_mex\Release\gtsam_wrapper.mexw64 : fatal error LNK1120: 12 unresolved externals
1>Done building project "gtsam_matlab_wrapper.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========
Just added PR #1514 which should address 1.2 under original post "Steps to reproduce." Small victory.
I've been solidly on the Linux side since February**, but I can do some test building on Windows as another data point, if that is helpful.
I updated VS 2019 and pulled the
HEAD
ofdevelop
. Configuring with default options, thedebug
configuration ofgtsam
builds, butgtsam_unstable
does not. There are a lot of linker errors related to multiply-defined symbols. Just for grins, I thought I would try therelease
configuration, but I forgot thatTangentPreintegration.cpp
takes like an hour (literally) to compile inrelease
, so I'm not sure yet -- I would expect to see the same stuff as indebug
, but it would be good to confirm.What would actually be helpful for me to do? Should I try to replicate @Tobias-Fischer 's setup or try something else?
** It looks like #1087 is still open. I'm not sure if I still owe anything on that issue? I just kind of wandered off when #1107 landed, and I'm not sure what remains to be done.
Check my comment here if you still experience the long build times on Windows https://github.com/borglab/gtsam/issues/1216#issuecomment-1581163113
We have now managed to build the Python bindings on Windows. We still need a few patches (see https://github.com/conda-forge/gtsam-feedstock/tree/main/recipe), but I think most of the issues have been addressed in the dev
branch (we are using the 4.2.0 release in conda-forge).
Description
Steps to reproduce
1.1 Basically the problem is that on Linux people rename to the same name different libraries because they have different suffix (like .a vs .so for static vs shared, or .pysomething vs .so for Python vs shared C++). However, on Windows when you build a shared library you create both a name.lib and a name.dll, so if you have a static and shared library with the same name, that results in a collision. Similalry, if you have a name.dll and name.pyd (C++ and Python), both will also generate a name.lib that will result in a collision. See https://github.com/pantor/ruckig/pull/18. (Credits to @traversaro) 1.2 The cmake command
configure_file(${test_file} "${GTSAM_UNSTABLE_MODULE_PATH}/tests/${test_file}" COPYONLY)
leads to a syntax error on Windows for some reason. I am not sure why, for testing I simply commented it out.GTSAM_BUILD_PYTHON=ON
on WindowsExpected behavior
Build should succeed, and I should be able to
import gtsam
in a Windows python environment without issues.Environment
Windows with VS2019 on conda-forge. I expect this to happen on any Windows machine, but I have not confirmed this. Full build commands:
Additional information
See https://github.com/conda-forge/gtsam-feedstock/pull/8 where we are able to build gtsam (including gtsam-unstable) successfully, but fail building with python bindings enabled.