Page 1 of 1

[Ubuntu 11.04] Compilation error.

Posted: 15 Aug 2011, 13:51
by lgromanowski
Ghostbird wrote: Hi everybody,

I had been toying with the idea of a Morrowind rewrite in my head for a few years, knowing that I lack any skill whatsoever in computer stuff that such a thing would most likely require. Today I googled my idea and I was surprised to see that people actually were doing such a great thing already. I guess I'm kind of egotistical thinking that I was the only person with such an idea.
I tried compiling it on my machine and after struggling a bit getting all the dependencies, I succeeded in generating a makefile with cmake (I assumed that's what cmake does, I may be wrong).
However when compiling I stumbled across this:

Code: Select all

:~/Downloads/openmw-0.10.0-source$ make
[  9%] Built target caelum
[ 43%] Built target MyGUIEngine
[ 46%] Built target MyGUIOgrePlatform
[ 46%] Building CXX object apps/openmw/CMakeFiles/openmw.dir/__/__/components/bsa/bsa_archive.cpp.o
In file included from /home/user/Downloads/openmw-0.10.0-source/components/bsa/bsa_archive.cpp:30:0:
/home/user/Downloads/openmw-0.10.0-source/./libs/mangle/stream/clients/ogre_datastream.hpp: In member function â??void Mangle::Stream::Mangle2OgreStream::init()â??:
/home/user/Downloads/openmw-0.10.0-source/./libs/mangle/stream/clients/ogre_datastream.hpp:29:9: error: â??mAccessâ?? was not declared in this scope
/home/user/Downloads/openmw-0.10.0-source/./libs/mangle/stream/clients/ogre_datastream.hpp:29:20: error: â??WRITEâ?? is not a member of â??Ogre::DataStreamâ??
/home/user/Downloads/openmw-0.10.0-source/components/bsa/bsa_archive.cpp: In member function â??virtual Ogre::Archive* BSAArchiveFactory::createInstance(const Ogre::String&)â??:
/home/user/Downloads/openmw-0.10.0-source/components/bsa/bsa_archive.cpp:142:31: error: cannot allocate an object of abstract type â??BSAArchiveâ??
/home/user/Downloads/openmw-0.10.0-source/components/bsa/bsa_archive.cpp:37:1: note:   because the following virtual functions are pure within â??BSAArchiveâ??:
/usr/include/OGRE/OgreArchive.h:131:31: note:    virtual Ogre::DataStreamPtr Ogre::Archive::open(const Ogre::String&) const
/home/user/Downloads/openmw-0.10.0-source/components/bsa/bsa_archive.cpp:143:3: warning: control reaches end of non-void function
make[2]: *** [apps/openmw/CMakeFiles/openmw.dir/__/__/components/bsa/bsa_archive.cpp.o] Error 1
make[1]: *** [apps/openmw/CMakeFiles/openmw.dir/all] Error 2
make: *** [all] Error 2
Am I missing a library of Mangle-Ogre bindings (I think that's what it's called)?
I'm quite new to compiling programs larger than 3 files of C code, so I don't really understand how a large program like this is build and how the whole thing is kept together.
In Morrowind terms: "My mind is boggled."

Any help would be appreciated,

Zini wrote: More data please! First think I would check is your OGRE version.
Ghostbird wrote: My OGRE version is 1.7.2 I think.
The relevant (in my eyes) package that I have installed is named libogre1.7-dev but the (I think) corresponding core package is named libogremain1.7-1.7.2. Therefore I think it is version 1.7.2.
Zini wrote: Looks like the missing class members were added between 1.6 and 1.7.
Maybe you have OGRE 1.6 installed somewhere alongside 1.7 and cmake is picking up the old version?
Ghostbird wrote: I guess it did something like that, I guess I'm stupid to assume that it would automatically choose the newest version of OGRE. I removed the 1.6.4 version of OGRE I had also installed.
Now it's missing the OGRE header file though.

Code: Select all

:~/Downloads/openmw-0.10.0-source$ make
Scanning dependencies of target caelum
[  0%] Building CXX object extern/caelum/CMakeFiles/caelum.dir/src/GroundFog.cpp.o
In file included from /home/user/Downloads/openmw-0.10.0-source/extern/caelum/src/GroundFog.cpp:21:0:
/home/user/Downloads/openmw-0.10.0-source/extern/caelum/include/CaelumPrecompiled.h:24:18: fatal error: Ogre.h: No such file or directory
compilation terminated.
make[2]: *** [extern/caelum/CMakeFiles/caelum.dir/src/GroundFog.cpp.o] Error 1
make[1]: *** [extern/caelum/CMakeFiles/caelum.dir/all] Error 2
make: *** [all] Error 2
I muddled around a bit but I didn't understand much of what I did. I hoped someone here might know the problem and the solution.
Zini wrote: Well, it looks like you wiped at least a part of both installed version. I suggest to completely remove OGRE from your system and then reinstall it.

btw. from what I remember multiple versions of OGRE installed on the some box don't play together nicely. I might be wrong about this, but AFAIK the OGRE plugin system in a default installation does not respect versions.

Edit: There is one more thing that could have gone wrong. Maybe cmake still has your old installation path cached. I suggest you first wipe your build directory (assuming you did an out-of-source build) and start building from scratch.
Ghostbird wrote: I didn't do an out of source build as far as I know, unless cmake does that automatically. I just re-downloaded the source, removed everything OGRE and only installed libogre1.7-dev and dependencies. I ran cmake, but now it can't find OGRE at all.

Code: Select all

-- OpenMW pre-built binaries not found.  Using standard locations.
-- checking for one of the modules 'OGRE'
-- checking for module 'OGRE'
--   package 'OGRE' not found
CMake Error at cmake/FindOGRE.cmake:91 (MESSAGE):
  Could not find OGRE
Call Stack (most recent call first):
  CMakeLists.txt:255 (find_package)

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
   used as include directory in directory /home/user/Downloads/openmw

-- Configuring incomplete, errors occurred!
I read the FindOGRE.cmake but I didn't really understand what went wrong.
Zini wrote: The 2nd error message indicates that you are missing a dependency (UUID). I think the package is called uuid-dev.

But no idea why cmake can't find OGRE. Maybe something during the un-/reinstallation process went wrong and you still have some remains of the previous installation somewhere that are confusing cmake.
Ghostbird wrote: Ah, thanks for noticing the UUID thing. I hadn't seen that one yet, since I was only looking at the first error.
I looked trough the FindOGRE.cmake file and I thought that this part goes wrong:

Code: Select all

    # Don't mark REQUIRED, but use PKG_CHECK_MODULES below (otherwise PkgConfig
    # complains even if OGRE_* are set by hand).
More specifically the finding of OGRE by pkg-config.
I did:

Code: Select all

pkg-config --libs OGRE
and it said that it couldn't find OGRE.pc and that I should add the directory containing it to PKG_CONFIG_PATH
I did:

Code: Select all

And noticed that it wasn't set.
I did:

Code: Select all

export $PKG_CONFIG_PATH=/usr/lib/OGRE1.7/pkgconfig/
pkg-config --libs OGRE
And now I got the right information.
Then I executed cmake ./ in the openmw directory and it worked.
OpenMW is compiling as I type this.

EDIT: It successfully compiled. Thanks for the help everyone!