从源 Ubuntu 20.04 安装 Avogadro 1.2.0

从源 Ubuntu 20.04 安装 Avogadro 1.2.0

下载的软件包为 avogadro-1.2.0.tar.gz,放在 home/src 文件夹中;解压到同一个文件夹。我从 INSTALL 文件夹一直到第 2 步,这里...

Requirements
============
 -- CMake 2.8.9 or later (2.8.11 recommended)
 -- Qt 4.6.0 or later (4.8.5 recommended)
 -- OpenBabel 2.3.x or later (development version from 
  http://github.org/openbabel/openbabel is recommended)
 -- Eigen 2.0.x or later (3.x also supported)


Basic Installation
==================
These instructions give a very basic overview of how to configure, compile and
install Avogadro on most systems.  If you are using unique install locations
and/or libraries are not automatically detected please consult the 'Advanced'
section.

1. Create a 'build' directory in the package source directory.

   mkdir build
   cd build

2. Configure the build system

   cmake ../

3. Compile

   make -j2

4. Install

   sudo make install

也就是说,输入

cmake ../

我收到以下错误,

darren@darren-Vostro-3560:~/src/avogadro-1.2.0/build$  cmake ../
-- The build type is RelWithDebInfo
CMake Error at /usr/share/cmake-3.16/Modules/FindQt4.cmake:1314 (message):
  Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
  CMakeLists.txt:226 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/darren/src/avogadro-1.2.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/darren/src/avogadro-1.2.0/build/CMakeFiles/CMakeError.log".

CMakeOutput.log 中写道,由于时间太长而被删减,但可以提供。

CMakeError.log 中写道:

Performing C++ SOURCE FILE Test COMPILES_WITHOUT_FPERMISSIVE failed with the following output:
Change Dir: /home/darren/src/avogadro-1.2.0/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_842a7/fast && /usr/bin/make -f CMakeFiles/cmTC_842a7.dir/build.make CMakeFiles/cmTC_842a7.dir/build
make[1]: Entering directory '/home/darren/src/avogadro-1.2.0/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_842a7.dir/src.cxx.o
/usr/bin/c++    -fvisibility=hidden -fvisibility-inlines-hidden -DCOMPILES_WITHOUT_FPERMISSIVE   -o CMakeFiles/cmTC_842a7.dir/src.cxx.o -c /home/darren/src/avogadro-1.2.0/build/CMakeFiles/CMakeTmp/src.cxx
/home/darren/src/avogadro-1.2.0/build/CMakeFiles/CMakeTmp/src.cxx:6:17: error: declaration of ‘auto_ptr<_Tp> counted_ptr<_Tp>::auto_ptr()’ changes meaning of ‘auto_ptr’ [-fpermissive]
    6 |   auto_ptr<_Tp> auto_ptr();
      |                 ^~~~~~~~
/home/darren/src/avogadro-1.2.0/build/CMakeFiles/CMakeTmp/src.cxx:2:28: note: ‘auto_ptr’ declared here as ‘class auto_ptr<_Tp>’
    2 | template <class _Tp> class auto_ptr {};
      |                            ^~~~~~~~
make[1]: *** [CMakeFiles/cmTC_842a7.dir/build.make:66: CMakeFiles/cmTC_842a7.dir/src.cxx.o] Error 1
make[1]: Leaving directory '/home/darren/src/avogadro-1.2.0/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_842a7/fast] Error 2


Source file was:

template <class _Tp> class auto_ptr {};
template <class _Tp>
struct counted_ptr
{
  auto_ptr<_Tp> auto_ptr();
};
int main() {return 0;}

我说,请帮帮我。

答案1

Avogadro 1.2 需要 Qt4,由于 Qt5 可用,Qt4 已被弃用。您可以使用以下命令直接安装(无需编译)较新版本(1.93.0)的 Avogadro

sudo apt install avogadro

如果你确实需要旧版本,请首先安装 Rock Core Team 的 Qt4电力供应协议(请注意,我还没有测试过,因此使用时请自担风险。不过,已经有 50000+下载来自这个 PPA,因此它可能是安全的。)

sudo add-apt-repository ppa:rock-core/qt4
sudo apt update

然后使用以下方法安装 Qt4 库

sudo apt install qt4-x11 libqt4-dev

cmake ../现在再次继续。

相关内容