Hello there,
Long time Linux (ubuntu) developer and compiler of openbabel and Avogadro.
New project: build Avogadro and Openbabel using Mac OS 10.6
First things first,
I started out on a completely new installation of 10.6 - not infected by any
software other than what I did to it. And what I did to it, comes here:
I downloaded and installed the latest compiler tools from
developer.apple.com so I can compile stuff (gcc 4.2.1). Then I proceeded to
download the latest CMAKE (2.8) and Qt (4.6) dmg packages and installed them
using the built-in tools for that. From here, I downloaded and extracted the
openbabel 2.2.3 source code and extracted it into ~/software/src giving me
an openbabel-2.2.3 folder here. Based on this mail, I’ve exported
CXXFLAGS=-m32 and CFLAGS=-m32 to enable 32 bit compilation of openbabel
(this is required since I’ve apparently got hold of the 32 bit Qt package).
I have a build directory for openbabel in ~/software/build/openbabel from
where i run the following command
…/…/src/openbabel-2.2.3/configure
to configure the makefiles for openbabel
then
make
sudo make install
which works flawlessly.
I can run babel -H and it shows me the available formats GAMESS, GAUSSIAN,
CML and lots of others. To confirm that openbabel is working, I also ran
obminize -ff MMFF94 with some random xyz file as argument and it starts to
minimize and thus it works with forcefields too. (yay)
I’ve also installed eigen (in a non standard location) as required (notice
that I have not attempted to build the avogadro+python binaries, but it’ll
come when I get this working)
Now I want to compile avogadro so I’ve download the 1.0.0 source from
sourceforge and extracted it in ~/software/src to get a
~/software/src/avogadro-1.0.0 folder.
If I am in the corresponding build folder (~/software/build/avogadro-1.0.0)
which I’ve created myself, and I run
cmake -DEIGEN2_INCLUDE_DIR=~/software/install/include/eigen2
-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32 -DENABLE_PYTHON=false
-DCMAKE_OSX_ARCHITECTURES:STRING=i386 -DCMAKE_BUILD_TYPE=Debug
…/…/src/avogadro-1.0.0
It reports that it cannot find openbabel. I am then thinking: well, this is
a mac and I down know how your work compared to my ubuntu, so OK.
I then provide the following arguments to cmake
cmake -DCMAKE_OSX_ARCHITECTURES:STRING=i386 -DCMAKE_BUILD_TYPE=Debug
-DEIGEN2_INCLUDE_DIR=/Users/administrator/software/install/include/eigen2/
-DOPENBABEL2_INCLUDE_DIR=/usr/local/include/openbabel-2.0
-DOPENBABEL2_LIBRARIES=/usr/local/lib/libopenbabel.dylib
-DOPENBABEL2_VERSION_MET=true -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32
-DENABLE_PYTHON=false …/…/src/avogadro-1.0.0
in which case it runs, accepts the input and even states that it found the
openbabel executable in /usr/local/bin/babel.
I then run
make
and everything compiles and links like it should in which case I can assume
that the openbabel libraries are also correctly versioned and being 32 bit.
My problem then
if I go into ~/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS
and launch avogadro by
./Avogadro
I get the following output
"Avogadro version: 1.0.0 Git:
LibAvogadro version: 1.0.0 Git: “
Locale: “en_US"
Libavogadro translations not found.
“System has OpenGL support.”
“About to test OpenGL capabilities.”
“OpenGL capabilities found: “
“Double Buffering.”
“Direct Rendering.”
“Antialiasing.“
Loading plugins:
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/colors"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/engines"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/extensions"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/tools"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/contrib"
Loading plugins: "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/colors"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/engines"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/extensions"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/tools"
Searching for plugins in “/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/contrib”
The first problem is that this does not automatically load any plugins what
so ever ( I get a message box about it and i cant do anything). Apparently,
the libraries are not put into the Contents folder when everything is built.
I then browsed through the source code of avogadro to find out where stuff
gets loaded. I fell upon these lines in libavogadro/src/pluginmanager.cpp
// If we are in a Mac build dir things are a little different - if the
// expected relative path does not exist try the build dir path
QFileInfo info(QCoreApplication::applicationDirPath()
+ "/../CMakeCache.txt");
if (info.exists()) {// In a build directory
loadPluginDir(QCoreApplication::applicationDirPath()
+ "/../../../../lib", settings);
}
where it is assumed that a CMakeCache.txt file is located (which it
apparently not is since this is skipped) before it attempts to read
alternative locations. If i do
touch CMakeCache.txt
in the MacOS folder. Then the extensions, however, do load but other errors
are encountered:
"Avogadro version: 1.0.0 Git:
LibAvogadro version: 1.0.0 Git: “
Locale: “en_US"
Libavogadro translations not found.
“System has OpenGL support.”
“About to test OpenGL capabilities.”
“OpenGL capabilities found: “
“Double Buffering.”
“Direct Rendering.”
“Antialiasing.“
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/…/…/…/lib”
“libavogadro.1.0.0.dylib” failed to load. “The file
’/Users/administrator/software/build/avogadro-1.0.0/lib/libavogadro.1.0.0.dylib’
is not a valid Qt plugin.”
“libavogadro.1.dylib” failed to load. “The file
’/Users/administrator/software/build/avogadro-1.0.0/lib/libavogadro.1.0.0.dylib’
is not a valid Qt plugin.”
“libavogadro.dylib” failed to load. “The file
’/Users/administrator/software/build/avogadro-1.0.0/lib/libavogadro.1.0.0.dylib’
is not a valid Qt plugin.“
Loading plugins:
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/colors"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/engines"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/extensions"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/tools"
Searching for plugins in
”/Users/administrator/software/build/avogadro-1.0.0/bin/Avogadro.app/Contents/MacOS/…/lib/avogadro/1_0/contrib"
Loading plugins: "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/colors"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/engines"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/extensions"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/tools"
Searching for plugins in "/Users/administrator/Library/Application
Support/avogadro/1_0/Plugins/contrib"
QStackedLayout::setCurrentWidget: Widget 0x1b93270 not contained in stack
Unable to set up and use any force fields.
GLWidget initialisation…
GLWidget initialised…
createObjects()
libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area
where the most fatal one is “Unable to set up and use any force fields.”. So
I can draw molecules. load molecules, but the force-fields do not get loaded
and I simply cant figure out why. On the wiki:
http://avogadro.openmolecules.net/wiki/Compiling_on_Linux_and_Mac_OS_X - the
following lines are the only ones I could hope help
export BABEL_LIBDIR=/usr/local/lib/openbabel/2.2.3/
export BABEL_DATADIR=/usr/local/share/openbabel/2.2.3/
but alas, no effect what so ever.
Now, I have no clue how to continue from here since it appears that
openbabel is working (but not inside avogadro) and avogadro is working with
its tools.
Any help is appreciated
Kind Regards,
Casper Steinmann