Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issue with GTSAM 4.0 #43

Closed
thinhhoang95 opened this issue Jun 2, 2019 · 6 comments
Closed

Build issue with GTSAM 4.0 #43

thinhhoang95 opened this issue Jun 2, 2019 · 6 comments

Comments

@thinhhoang95
Copy link

thinhhoang95 commented Jun 2, 2019

I've just built GTSAM 4.0 with VC++ 14.1 on VS 2017. During full project build, I get the error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in libboost. It turns out that I need to remove libboost release dlls (those do not contain "gd" in their filename) in Linker > Input > Additional dependencies. I wonder if this is a bug. Also, 8 projects failed to build with the following error, I cannot seem to trace the reason why.

CMAKE: out of the box, with turned off GTSAM_BUILD_WRAP, GTSAM_WITH_EIGEN_MKL, GTSAM_WITH_EIGEN_MKL_OPENMP, GTSAM_WITH_TBB, and GTSAM_WRAP_SERIALIZATION.

Severity Code Description Project File Line Suppression State Error LNK2005 "public: static class Eigen::CwiseNullaryOp<struct Eigen::internal::scalar_constant_op<double>,class Eigen::Matrix<double,2,1,0,2,1> > const __cdecl Eigen::DenseBase<class Eigen::Matrix<double,2,1,0,2,1> >::Zero(void)" (?Zero@?$DenseBase@V?$Matrix@N$01$00$0A@$01$00@Eigen@@@Eigen@@SA?BV?$CwiseNullaryOp@U?$scalar_constant_op@N@internal@Eigen@@V?$Matrix@N$01$00$0A@$01$00@3@@2@XZ) already defined in Event.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: class Eigen::Matrix<double,3,1,0,3,1> & __thiscall Eigen::EigenBase<class Eigen::Matrix<double,3,1,0,3,1> >::derived(void)" (?derived@?$EigenBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QAEAAV?$Matrix@N$02$00$0A@$02$00@2@XZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: class Eigen::Matrix<double,3,1,0,3,1> const & __thiscall Eigen::EigenBase<class Eigen::Matrix<double,3,1,0,3,1> >::derived(void)const " (?derived@?$EigenBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QBEABV?$Matrix@N$02$00$0A@$02$00@2@XZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: class Eigen::Matrix<double,3,1,0,3,1> & __thiscall Eigen::EigenBase<class Eigen::Matrix<double,3,1,0,3,1> >::const_cast_derived(void)const " (?const_cast_derived@?$EigenBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QBEAAV?$Matrix@N$02$00$0A@$02$00@2@XZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: int __thiscall Eigen::DenseCoeffsBase<class Eigen::Matrix<double,3,1,0,3,1>,3>::outerStride(void)const " (?outerStride@?$DenseCoeffsBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@$02@Eigen@@QBEHXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: static class Eigen::CwiseNullaryOp<struct Eigen::internal::scalar_constant_op<double>,class Eigen::Matrix<double,3,1,0,3,1> > const __cdecl Eigen::DenseBase<class Eigen::Matrix<double,3,1,0,3,1> >::Zero(void)" (?Zero@?$DenseBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@SA?BV?$CwiseNullaryOp@U?$scalar_constant_op@N@internal@Eigen@@V?$Matrix@N$02$00$0A@$02$00@3@@2@XZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: int __thiscall Eigen::PlainObjectBase<class Eigen::Matrix<double,3,1,0,3,1> >::rows(void)const " (?rows@?$PlainObjectBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QBEHXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: int __thiscall Eigen::PlainObjectBase<class Eigen::Matrix<double,3,1,0,3,1> >::cols(void)const " (?cols@?$PlainObjectBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QBEHXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: double const * __thiscall Eigen::PlainObjectBase<class Eigen::Matrix<double,3,1,0,3,1> >::data(void)const " (?data@?$PlainObjectBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QBEPBNXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: void __thiscall Eigen::PlainObjectBase<class Eigen::Matrix<double,3,1,0,3,1> >::resize(int,int)" (?resize@?$PlainObjectBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QAEXHH@Z) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: static void __cdecl Eigen::PlainObjectBase<class Eigen::Matrix<double,3,1,0,3,1> >::_check_template_params(void)" (?_check_template_params@?$PlainObjectBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@SAXXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: int __thiscall Eigen::Matrix<double,3,1,0,3,1>::outerStride(void)const " (?outerStride@?$Matrix@N$02$00$0A@$02$00@Eigen@@QBEHXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "protected: __thiscall Eigen::MatrixBase<class Eigen::Matrix<double,3,1,0,3,1> >::MatrixBase<class Eigen::Matrix<double,3,1,0,3,1> >(void)" (??0?$MatrixBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@IAE@XZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: int __thiscall Eigen::EigenBase<class Eigen::Matrix<double,3,1,0,3,1> >::rows(void)const " (?rows@?$EigenBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QBEHXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: int __thiscall Eigen::EigenBase<class Eigen::Matrix<double,3,1,0,3,1> >::cols(void)const " (?cols@?$EigenBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QBEHXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: double & __thiscall Eigen::PlainObjectBase<class Eigen::Matrix<double,3,1,0,3,1> >::coeffRef(int)" (?coeffRef@?$PlainObjectBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QAEAANH@Z) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2005 "public: int __thiscall Eigen::EigenBase<class Eigen::Matrix<double,3,1,0,3,1> >::size(void)const " (?size@?$EigenBase@V?$Matrix@N$02$00$0A@$02$00@Eigen@@@Eigen@@QBEHXZ) already defined in SimPolygon2D.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\gtsamDebug.lib(gtsamDebug.dll) 1 Error LNK2038 mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in Dummy.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\libboost_thread-vc141-mt-x32-1_70.lib(tss_pe.obj) 1 Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in Dummy.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\libboost_thread-vc141-mt-x32-1_70.lib(tss_pe.obj) 1 Error LNK2038 mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in Dummy.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\libboost_thread-vc141-mt-x32-1_70.lib(thread.obj) 1 Error LNK2038 mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MDd_DynamicDebug' in Dummy.obj gtsam_unstable D:\gtsam-4.0.0\build\gtsam_unstable\libboost_thread-vc141-mt-x32-1_70.lib(thread.obj) 1 Error LNK1169 one or more multiply defined symbols found gtsam_unstable D:\gtsam-4.0.0\build\bin\Debug\gtsam_unstableDebug.dll 1 Error LNK2001 unresolved external symbol "public: virtual void __thiscall gtsam::PreintegratedCombinedMeasurements::resetIntegration(void)" (?resetIntegration@PreintegratedCombinedMeasurements@gtsam@@UAEXXZ) ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\examples\ISAM2_SmartFactorStereo_IMU.obj 1 Error LNK2001 unresolved external symbol "public: virtual void __thiscall gtsam::PreintegratedCombinedMeasurements::print(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?print@PreintegratedCombinedMeasurements@gtsam@@UBEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\examples\ISAM2_SmartFactorStereo_IMU.obj 1 Error LNK2001 unresolved external symbol "public: virtual void __thiscall gtsam::PreintegratedCombinedMeasurements::integrateMeasurement(class Eigen::Matrix<double,3,1,0,3,1> const &,class Eigen::Matrix<double,3,1,0,3,1> const &,double)" (?integrateMeasurement@PreintegratedCombinedMeasurements@gtsam@@UAEXABV?$Matrix@N$02$00$0A@$02$00@Eigen@@0N@Z) ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\examples\ISAM2_SmartFactorStereo_IMU.obj 1 Error LNK2019 unresolved external symbol "public: __thiscall gtsam::CombinedImuFactor::CombinedImuFactor(unsigned __int64,unsigned __int64,unsigned __int64,unsigned __int64,unsigned __int64,unsigned __int64,class gtsam::PreintegratedCombinedMeasurements const &)" (??0CombinedImuFactor@gtsam@@QAE@_K00000ABVPreintegratedCombinedMeasurements@1@@Z) referenced in function _main ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\examples\ISAM2_SmartFactorStereo_IMU.obj 1 Error LNK2001 unresolved external symbol "public: virtual class boost::shared_ptr<class gtsam::NonlinearFactor> __thiscall gtsam::CombinedImuFactor::clone(void)const " (?clone@CombinedImuFactor@gtsam@@UBE?AV?$shared_ptr@VNonlinearFactor@gtsam@@@boost@@XZ) ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\examples\ISAM2_SmartFactorStereo_IMU.obj 1 Error LNK2001 unresolved external symbol "public: virtual void __thiscall gtsam::CombinedImuFactor::print(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class boost::function<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl(unsigned __int64)> const &)const " (?print@CombinedImuFactor@gtsam@@UBEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$function@$$A6A?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_K@Z@boost@@@Z) ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\examples\ISAM2_SmartFactorStereo_IMU.obj 1 Error LNK2001 unresolved external symbol "public: virtual bool __thiscall gtsam::CombinedImuFactor::equals(class gtsam::NonlinearFactor const &,double)const " (?equals@CombinedImuFactor@gtsam@@UBE_NABVNonlinearFactor@2@N@Z) ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\examples\ISAM2_SmartFactorStereo_IMU.obj 1 Error LNK2001 unresolved external symbol "public: virtual class Eigen::Matrix<double,-1,1,0,-1,1> __thiscall gtsam::CombinedImuFactor::evaluateError(class gtsam::Pose3 const &,class Eigen::Matrix<double,3,1,0,3,1> const &,class gtsam::Pose3 const &,class Eigen::Matrix<double,3,1,0,3,1> const &,class gtsam::imuBias::ConstantBias const &,class gtsam::imuBias::ConstantBias const &,class boost::optional<class Eigen::Matrix<double,-1,-1,0,-1,-1> &>,class boost::optional<class Eigen::Matrix<double,-1,-1,0,-1,-1> &>,class boost::optional<class Eigen::Matrix<double,-1,-1,0,-1,-1> &>,class boost::optional<class Eigen::Matrix<double,-1,-1,0,-1,-1> &>,class boost::optional<class Eigen::Matrix<double,-1,-1,0,-1,-1> &>,class boost::optional<class Eigen::Matrix<double,-1,-1,0,-1,-1> &>)const " (?evaluateError@CombinedImuFactor@gtsam@@UBE?AV?$Matrix@N$0?0$00$0A@$0?0$00@Eigen@@ABVPose3@2@ABV?$Matrix@N$02$00$0A@$02$00@4@01ABVConstantBias@imuBias@2@2V?$optional@AAV?$Matrix@N$0?0$0?0$0A@$0?0$0?0@Eigen@@@boost@@33333@Z) ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\examples\ISAM2_SmartFactorStereo_IMU.obj 1 Error LNK1120 8 unresolved externals ISAM2_SmartFactorStereo_IMU D:\gtsam-4.0.0\build\bin\Debug\ISAM2_SmartFactorStereo_IMU.exe 1 Error C2678 binary '=': no operator found which takes a left-hand operand of type 'T' (or there is no acceptable conversion) StereoVOExample_large D:\gtsam-4.0.0\gtsam\base\GenericValue.h 171 Error C2027 use of undefined type 'gtsam::traits<T>' SmartRangeExample_plaza1 D:\gtsam-4.0.0\gtsam\base\GenericValue.h 152 Error C3861 'GetDimension': identifier not found SmartRangeExample_plaza1 D:\gtsam-4.0.0\gtsam\base\GenericValue.h 152 Error C2678 binary '=': no operator found which takes a left-hand operand of type 'T' (or there is no acceptable conversion) ConcurrentCalibration D:\gtsam-4.0.0\gtsam\base\GenericValue.h 171 Error C2678 binary '=': no operator found which takes a left-hand operand of type 'T' (or there is no acceptable conversion) SmartProjectionFactorExample D:\gtsam-4.0.0\gtsam\base\GenericValue.h 171 Error C2027 use of undefined type 'gtsam::traits<T>' SmartRangeExample_plaza2 D:\gtsam-4.0.0\gtsam\base\GenericValue.h 152 Error C3861 'GetDimension': identifier not found SmartRangeExample_plaza2 D:\gtsam-4.0.0\gtsam\base\GenericValue.h 152 Error C2678 binary '=': no operator found which takes a left-hand operand of type 'T' (or there is no acceptable conversion) SmartStereoProjectionFactorExample D:\gtsam-4.0.0\gtsam\base\GenericValue.h 171
May I have some suggestions on how to resolve this? Many thanks!

@jlblancoc
Copy link
Member

Where did you get Boost from? Custom build? Binary install?

@thinhhoang95
Copy link
Author

I got Boost from binary for Windows

@jlblancoc
Copy link
Member

Please, give it a try to the code version in this PR: #27

It should have fixed those errors.

@dellaert
Copy link
Member

@thinhhoang95 please follow up or close the issue if now resolved?

@thinhhoang95
Copy link
Author

I'm trying the solution and will get back in a few hours

@thinhhoang95
Copy link
Author

Sorry for the late reply. I confirm that it was a bug in VC++ 2017.

varunagrawal added a commit that referenced this issue Mar 23, 2021
13a2f66c4 Merge pull request #46 from borglab/feature/new-shared-pointer
3c7d85865 updated docs
6d7897088 use @ for raw pointer, go back to * for shared pointer
1d6194c57 updated matlab wrapper to handle both raw and shared pointers
1448f6924 fix some failing tests
2ab1dae32 Merge branch 'master' into feature/new-shared-pointer
96f8a56bd Merge pull request #47 from borglab/fix/ci
6003203f3 run CI only for pull requests
a8f29ead1 fix the python version yml key
fcae17227 check if directory exists when testing
f592f08c9 explicit pip3 so that we don't use Python2
d49c2f3c2 correct call for pip
dfe360526 fix the CI
149b7c523 docs for templated functions
f2189acc6 support typedefing for templated functions
965458a2b added test for templated functions
eaff6e6ab made is_const common for all types
3d9c70b32 added tests and cleaned up a bit
010b89626 support for simple pointers on basis types
6b98fd80c new syntax for shared_ptr
ff7ad0b78 support for templated functions
a1a443c8d Merge pull request #43 from borglab/fix/cmake-and-matlab
2f3a055e4 remove accidentally committed file
770d055e2 set proper paths for cmake and eschew relative paths
773d01ae1 fix bug in matlab wrapper
721ef740f Merge pull request #41 from borglab/feature/type-hints
67aac9758 minor refactor of CI yml
e6a63ae0c fix all mypy issues
a3aaa3e7c remove a lot of linter issues from matlab_wrapper
a96db522f static typing for interface_parser

git-subtree-dir: wrap
git-subtree-split: 13a2f66c42f08c5e393e2eff0ebdd83c46254fb6
varunagrawal added a commit that referenced this issue Mar 24, 2021
3eff76f60 Merge pull request #53 from borglab/feature/refactor
13215dfa7 Merge pull request #52 from borglab/fix/tests
696913b11 install setuptools
9523328ba Merge branch 'master' into fix/tests
7c630b361 some more cleanup
656993a71 cleaned up  Typename
a16f6f38e move qualified and basis type outside to their own class scope
72ead8bd7 Merge pull request #51 from borglab/fix/test-interface-parser
6deefd4fc added tests for interface_parser
50d490a85 Merge pull request #50 from borglab/feature/refs-all-types
be4511290 updated docs for BasisType
0e80b0d8c update MATLAB tests
0015d7397 added support for shared pointer and ref for basis types
86d2158f1 remove std::string from list of Basis types
94f928441 ignore code coverage reports
2033dd345 replace prints with log.debug statements
ae98091b3 fix deprecation in doc tests
13a2f66c4 Merge pull request #46 from borglab/feature/new-shared-pointer
3c7d85865 updated docs
6d7897088 use @ for raw pointer, go back to * for shared pointer
1d6194c57 updated matlab wrapper to handle both raw and shared pointers
1448f6924 fix some failing tests
2ab1dae32 Merge branch 'master' into feature/new-shared-pointer
96f8a56bd Merge pull request #47 from borglab/fix/ci
6003203f3 run CI only for pull requests
a8f29ead1 fix the python version yml key
fcae17227 check if directory exists when testing
f592f08c9 explicit pip3 so that we don't use Python2
d49c2f3c2 correct call for pip
dfe360526 fix the CI
149b7c523 docs for templated functions
f2189acc6 support typedefing for templated functions
965458a2b added test for templated functions
eaff6e6ab made is_const common for all types
3d9c70b32 added tests and cleaned up a bit
010b89626 support for simple pointers on basis types
6b98fd80c new syntax for shared_ptr
ff7ad0b78 support for templated functions
a1a443c8d Merge pull request #43 from borglab/fix/cmake-and-matlab
2f3a055e4 remove accidentally committed file
770d055e2 set proper paths for cmake and eschew relative paths
773d01ae1 fix bug in matlab wrapper
721ef740f Merge pull request #41 from borglab/feature/type-hints
67aac9758 minor refactor of CI yml
e6a63ae0c fix all mypy issues
a3aaa3e7c remove a lot of linter issues from matlab_wrapper
a96db522f static typing for interface_parser

git-subtree-dir: wrap
git-subtree-split: 3eff76f604b5ba9e71cf4947654e288142ed7a94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants