[BUG] OSX specific compiler error in PythonAI.cpp line 312

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

[BUG] OSX specific compiler error in PythonAI.cpp line 312

#1 Post by Vezzra »

When I tried to build FO SVN 4986 today, I could do that perfectly fine on Windows, on OSX a very strange compiler error occured in PythonAI.cpp. Here is the compiler output concerning this error:

Code: Select all

/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/type_id.hpp: In function 'boost::python::type_info boost::python::type_id() [with T = const volatile DiplomaticStatusUpdateInfo&]':
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/converter/registered.hpp:87:   instantiated from 'const boost::python::converter::registration& boost::python::converter::detail::registry_lookup2(T& (*)()) [with T = const volatile DiplomaticStatusUpdateInfo]'
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/converter/registered.hpp:94:   instantiated from 'const boost::python::converter::registration& boost::python::converter::detail::registry_lookup1(boost::type<R>) [with T = const volatile DiplomaticStatusUpdateInfo&]'
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/converter/registered.hpp:105:   instantiated from 'const boost::python::converter::registration& boost::python::converter::detail::registered_base<const volatile DiplomaticStatusUpdateInfo&>::converters'
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/converter/arg_to_python.hpp:209:   instantiated from 'boost::python::converter::detail::value_arg_to_python<T>::value_arg_to_python(const T&) [with T = DiplomaticStatusUpdateInfo]'
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/converter/arg_to_python.hpp:256:   instantiated from 'boost::python::converter::arg_to_python<T>::arg_to_python(const T&) [with T = DiplomaticStatusUpdateInfo]'
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/call.hpp:66:   instantiated from 'typename boost::python::detail::returnable<T>::type boost::python::call(PyObject*, const A0&, boost::type<R>*) [with R = boost::python::api::object, A0 = DiplomaticStatusUpdateInfo]'
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/object_call.hpp:19:   instantiated from 'typename boost::python::detail::dependent<boost::python::api::object, A0>::type boost::python::api::object_operators<U>::operator()(const A0&) const [with A0 = DiplomaticStatusUpdateInfo, U = boost::python::api::object]'
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/../AI/PythonAI.cpp:312:   instantiated from here
/Users/.../SoftwareProjekte/FO/release/FreeOrion/Xcode/dep/local/include/boost/python/type_id.hpp:89: error: invalid use of incomplete type 'struct DiplomaticStatusUpdateInfo'
The code section in boost/python/type_id.hpp referenced in the last line of this error message is:

Code: Select all

template <class T>
inline type_info type_id(BOOST_EXPLICIT_TEMPLATE_TYPE(T))
{
    return type_info(
#  if !defined(_MSC_VER)                                       \
      || (!BOOST_WORKAROUND(BOOST_MSVC, <= 1300)                \
          && !BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700))
        typeid(T)
#  else // strip the decoration which msvc and Intel mistakenly leave in
        python::detail::msvc_typeid((boost::type<T>*)0)
#  endif 
        );
}
Line 89 is the line ");" after the line "# endif".

The respective code section in PythonAI.cpp is:

Code: Select all

void PythonAI::HandleDiplomaticStatusUpdate(const DiplomaticStatusUpdateInfo& u) {
    try {
        // call Python function to inform of diplomatic status update
        object handleDiplomaticStatusUpdatePythonFunction = s_ai_module.attr("handleDiplomaticStatusUpdate");
        handleDiplomaticStatusUpdatePythonFunction(u);
    } catch (error_already_set err) {
        PyErr_Print();
    }
}
Line 312 is line "handleDiplomaticStatusUpdatePythonFunction(u);". By commenting out this line I was able to build FO successfully.

As usual, I'm baffled, confused and clueless - ??? Anyone any ideas?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [BUG] OSX specific compiler error in PythonAI.cpp line 3

#2 Post by Geoff the Medio »

Vezzra wrote:

Code: Select all

/type_id.hpp:89: error: invalid use of incomplete type 'struct DiplomaticStatusUpdateInfo'
Try adding #include "../Empire/EmpireManager.h" to the top of PythonAI.cpp (on the line after #include "../Empire/Empire.h" ).

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: [BUG] OSX specific compiler error in PythonAI.cpp line 3

#3 Post by Vezzra »

Geoff the Medio wrote:Try adding #include "../Empire/EmpireManager.h" to the top of PythonAI.cpp (on the line after #include "../Empire/Empire.h" ).
Yep, that did the trick. Why this only was an issue on OSX and not on Windows seems to be another one of the mysteries of the universe (in the same league as "42 is the answer")...?

Commit 4988: "Added EmpireManager.h to the includes in PythonAI.cpp to prevent a build error on OSX"

Post Reply