#518 error: ‘initfreeOrionLogger’ was not declared in this scope


64-bit Arch Linux
freeorion revision 5096
gcc 4.7.1
boost 1.50.0

When trying to compile, I get this error:

Scanning dependencies of target freeorionca
[ 63%] Building CXX object client/AI/CMakeFiles/freeorionca.dir/__/__/AI/AIInterface.cpp.o
[ 63%] Building CXX object client/AI/CMakeFiles/freeorionca.dir/__/__/AI/PythonAI.cpp.o
/home/alexander/archpackages/community/freeorion/trunk/src/freeorion-build/AI/PythonAI.cpp: In constructor ‘PythonAI::PythonAI()’:
/home/alexander/archpackages/community/freeorion/trunk/src/freeorion-build/AI/PythonAI.cpp:207:29: error: ‘initfreeOrionLogger’ was not declared in this scope
/home/alexander/archpackages/community/freeorion/trunk/src/freeorion-build/AI/PythonAI.cpp:208:34: error: ‘initfreeOrionAIInterface’ was not declared in this scope
make[2]: *** [client/AI/CMakeFiles/freeorionca.dir/__/__/AI/PythonAI.cpp.o] Error 1
make[1]: *** [client/AI/CMakeFiles/freeorionca.dir/all] Error 2
make: *** [all] Error 2


1 2 > >> (Page 1 of 2)
  • Doublechecked, and I could only find the string "initfreeOrionLogger" in AI/PythonAI.cpp

  • Geoff Topping
    Geoff Topping

    initfreeOrionLogger is created by the boost::python macro in PythonAI.cpp, BOOST_PYTHON_MODULE(freeOrionLogger)

    This has been reported on the forums


    and seems to be related to building against the wrong version of Python. It should be 2.7.x.

  • I am setting PYTHON_INCLUDE_DIR:PATH in CMakeCache.txt to /usr/include/python2.7 and PYTHON_LIBRARY:FILEPATH to /usr/lib/libpython2.7.so. So, python 2.7 is installed (and both the directory and file does exists).

    Is changing these values in CMakeCache.txt the wrong approach?


  • Geoff Topping
    Geoff Topping

    I don't know what you need to do to get it to build against a different version of Python than it defaults to, even assuming that's actually the issue. Weird issues like this with CMake is half the reason I don't use it to build on Windows.

    Maybe try checking what PY_MAJOR_VERSION is set to in your build... That might indicate if the expected Python version is being used.

    There's also a patch posted here, which might help: http://www.freeorion.org/forum/viewtopic.php?p=53631#p53631

  • I think I found a way to force cmake to use python "2.7" instead of "3.2mu" (both are installed, python 3 is default on Arch Linux). It's compiling right now. Thanks for the pointers.

  • Geoff Topping
    Geoff Topping

    If it works, please describe the process, as I expect someone else will have similar problems in future.

  • Hi,

    Several tricks were applied to:
    - Find the correct revision that corresponds to the desired version umber
    - Patch cmake to give a message if the wrong version of Python is configured (3 instead of 2)
    - Actually configure cmake to use Python 2.7 instead of 3
    - Tweak the C++ flags in CMakeCache.txt, so that the compilation doesn't use too much memory
    (I have 4GB of memory in the computer I'm sitting at right now, which was no match for the compilation process).
    "-fno-var-tracking" was used for this purpose.
    - Fix the boost TIME_UTC problem
    - Only compile with one thread (make -j1) to help use less memory
    - Configure ogre_plugins.cfg to look in the right place

    An lo and behold, now it actually compiles! I'll compile the official packages for both 64-bit (x86_64) and 32-bit (i686) now and check that it runs too.

    Here's the PKGBUILD textfile that contains all the tweaks and tricks:

    Here's the cmake patch for detecting which python version is configured (from the forums):
    Thanks to "Space Krill" for the patch: http://www.freeorion.org/forum/viewtopic.php?p=53631#p53631

    Attaching the PKGBUILD and patch as well.

    Thanks for the pointers and guidance.

1 2 > >> (Page 1 of 2)