Building Avogadro 1.2.0 fails on Scientific Linux 7 and CentOS 6: cannot find OpenBabel


Under CentOS 6 and Scientific Linux 7 I’ve been trying to build Avogadro, plus the two dependencies of it not provided by these distro’s repos: Eigen (specifically version 3.3.4)and OpenBabel (2.4.1). I built these dependencies without a problem and installed them to /home/fusion809/install/usr (-DCMAKE_INSTALL_PREFIX=/home/fusion809/install/usr). I have checked /home/fusion809/install/usr/include/openbabel-2.0/openbabel and the header files do exist there. The problem is now I’m trying to build Avogadro 1.2.0. I created a build directory called build inside the source directory of Avogadro 1.2.0, then I ran:

cmake .. -DCMAKE_INSTALL_PREFIX=/home/fusion809/install/usr

and I received the error:

-- Found Eigen3: /home/fusion809/install/usr/include/eigen3 (Required is at least version "2.91.0") 
-- Found ZLIB: /usr/lib64/ (found version "1.2.7") 
-- Found PkgConfig: /bin/pkg-config (found version "0.27.1") 
-- checking for module 'openbabel-2.0>=2.3.0'
--   package 'openbabel-2.0>=2.3.0' not found
CMake Error at cmake/modules/FindOpenBabel2.cmake:69 (message):
  Could NOT find OpenBabel 2.3 or later
Call Stack (most recent call first):
  CMakeLists.txt:244 (find_package)

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

Then I thought maybe adding the option -DOPENBABEL2_INCLUDE_DIR=/home/fusion809/install/usr/include to the cmake command might fix things, after removing files generated by the first cmake run, of course, but it didn’t, I received the exact same error again. I then tried adding -DOPENBABEL2_INCLUDE_DIR=/home/fusion809/install/usr/include/openbabel-2.0 instead, but that gave me the exact same error. CMakeError.log is here and CMakeOutput.log is here.

Thanks for your time,

Hi Brenton,

For Avogadro 1.2.0 on CentOS 7 (basically SL7)

“Eigen (specifically version 3.3.4)”
Don’t use Eigen above 3.2.x (I built with 3.2.4).

For Openbabel, I used 2.4.1 like you.

You need to run this command before running cmake:
$ export PKG_CONFIG_PATH=/where/your/install/is/obabel/2.4.1/lib/pkgconfig/:$PKG_CONFIG_PATH

My cmake command, for reference:

$ prefix=/where/you/want/avogadro/installed # (just remove cmake flag to set default)

$ cmake -DCMAKE_INSTALL_PREFIX=$prefix -DEIGEN3_INCLUDE_DIR=/path/to/eigen/3.2.4/include -DOPENBABEL2_INCLUDE_DIR=/path/to/2.4.1/include/openbabel-2.0/openbabel/ -DOPENBABEL2_LIBRARIES=/path/to/2.4.1/lib/ -Wno-dev ../ 

$ make

$ make install

Good luck!

By today’s perspective (Jan 2022) – and dependent on the purpose of (re)building Avogadro – one would consider using a more recent release of CentOS and perhaps more importantly, of OpenBabel (currently at version 3.1.1).

No. Avogadro 1.2 uses Open Babel 2.x, Qt 4.x, etc.

That’s why we can’t release updates for it anymore. It’s not worth the coding effort to port all of that to OB 3.x, Qt 5/6, etc.

All effort is going into Avo2.

My assumption is, the interested to rebuild Avogadro consults the GitHub page and notices the jump from version 0.9.0 to version 1.9.0 in December 2016 which states a from now on, focus is reaching Avogadro2. This is even ahead of the date of the original post. Package trackers of Linux distributions eventually moved to Avogadro2 (e.g., Debian, Ubuntu). Both your comment and this observations would be strong reasons to favour contemporary Avogadro2 as targeted build over going back to senior (but with work and support stopped) Avogadro1.