问题:
我已经安装了来自官方 repo 的 libeigen3:
$ sudo apt-get install libeigen3-dev
[sudo] password for nicolas:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libeigen3-dev is already the newest version (3.3~beta1-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
它说这是一个 3.3 版本,正如这个命令所示:
$ dpkg -s libeigen3-dev | grep 'Version'
Version: 3.3~beta1-2
但是,文件中的版本/usr/lib/cmake/eigen3/Eigen3Config.cmake
设置为:
set ( EIGEN3_VERSION_STRING "3.2.92" )
问题:
我想知道为什么?我该如何解决这个问题,因为我至少需要 Eigen3.3 才能构建其他软件。
答案1
- 尝试从另一个较新的 Ubuntu 版本“apt-pinning”软件包 libeigen3-dev 或者
- 通过从以下位置下载 deb 文件来手动执行此操作https://packages.ubuntu.com/bionic/libeigen3-dev(点击“全部”可转到https://packages.ubuntu.com/bionic/all/libeigen3-dev/download) 然后安装它
sudo dpkg -i libeigen3-dev_3.3.4-4_all.deb
(或您下载的任何版本)。它应该可以完美运行,因为没有困难的依赖关系。
答案2
解决方案:
您可以直接从其主网站下载 eigen:
http://eigen.tuxfamily.org/index.php?title=Main_Page
最后,按照文件中的说明进行操作INSTALL
:
$ cat INSTALL Installation instructions for Eigen
***********************************
Explanation before starting
***************************
Eigen consists only of header files, hence there is nothing to compile
before you can use it. Moreover, these header files do not depend on your
platform, they are the same for everybody.
Method 1. Installing without using CMake
****************************************
You can use right away the headers in the Eigen/ subdirectory. In order
to install, just copy this Eigen/ subdirectory to your favorite location.
If you also want the unsupported features, copy the unsupported/
subdirectory too.
Method 2. Installing using CMake
********************************
Let's call this directory 'source_dir' (where this INSTALL file is).
Before starting, create another directory which we will call 'build_dir'.
Do:
cd build_dir
cmake source_dir
make install
The "make install" step may require administrator privileges.
You can adjust the installation destination (the "prefix")
by passing the -DCMAKE_INSTALL_PREFIX=myprefix option to cmake, as is
explained in the message that cmake prints at the end.
如果这些新库与官方库同时安装,请不要忘记在 cmake 中为使用它的任何程序链接到这些新库!;)