最近需要用到LineSfM,源码是在linux上通过的. 经过几天的努力,成功在我的平台上运行. 过程很曲折,这里做个笔记,希望能帮助到其他人,我以后再不要弄这种事了,乖乖学习linux是正事,要顺应潮流.
源码地址:
https://github.com/ySalaun/LineSfM
首先,需要有:
-
CMake (available for free at https://cmake.org/download/)
-
openCV (available for free at http://opencv.org/) > 2.x
-
Eigen library > 3
-
Blas library
-
Lapack library
-
Ceres library (http://ceres-solver.org/installation.html)
-
Arpack++ with SuperLU (https://github.com/m-reuter/arpackpp)
首先,CMake是肯定要有的。然后分两条路完成最终的编译。
项目属性->配置属性->C/C++->预处理器->预处理器定义,加入__GNUG__,因为这个版本的SuperLU根本没考虑到什么Win32,要VS假装自己是Gnu.
项目属性->配置属性->C/C++->代码生成->运行库应该是/MT for release模式、/MTd for debug模式
不这样设置会有很多问题,这也是为了整体的统一。
第一条路:ceres的编译
https://blog.csdn.net/streamchuanxi/article/details/52944652
https://www.cnblogs.com/ninahu/p/6800660.html
链接好像有些失效了,我晚些时候上传含有sln的gfalg和glog.
按照建议,安装suitesparse,参考https://blog.csdn.net/zpp13hao1/article/details/62217012
其中,我没有加这句话“ cmake_policy(SET CMP0022 NEW)”,因为不知道为什么加,后面也没有出错。
第二条路:arpack++的编译
中间需要安装mingw:https://sourceforge.net/projects/mingw/
https://blog.csdn.net/jellicex/article/details/78006430
同时使用这个网站提供的arpackpp1.2_slu2.patch.diff:http://reuter.mit.edu/software/arpackpatch/
出现的错误:
1)libcpmtd.lib(cout.obj) : error LNK2005: "public: void __thiscall std::basic_ already defined in libglog.lib(libglog.dll)
这个方法是有效的:https://blog.csdn.net/u010499162/article/details/46777677