3582 Build Errors, OS X 10.6

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Message
Author
neuro
Space Squid
Posts: 74
Joined: Sun Mar 07, 2010 10:17 pm

Re: 3582 Build Errors, OS X 10.6

#61 Post by neuro »

Rad, I'll try your fixes!
Also there are new errors in static_move_ptr.hpp:148:
That has to do with Mac OS X defining the method "check" and the static_move_ptr also defining it. You need to update your PathingEngine.h to check for FREEORION_MACOSX and #undef check if it exists.

That's something I solved in an earlier post on this thread :
The file is included several files deep in "PathingEngine.h" in the "FreeOrion/combat" directory.
So I updated it to this, after reviewing other examples of checking for FREEORION_MACOSX:

#ifdef FREEORION_MACOSX
#undef check
#endif

#include <boost/ptr_container/ptr_vector.hpp>

night
Space Kraken
Posts: 102
Joined: Sun Jun 12, 2011 1:21 pm

Re: 3582 Build Errors, OS X 10.6

#62 Post by night »

I also found this thread, but I do not know if that could solve any of our problems...

neuro
Space Squid
Posts: 74
Joined: Sun Mar 07, 2010 10:17 pm

Re: 3582 Build Errors, OS X 10.6

#63 Post by neuro »

Ok I'm confused...
I had to change
ServerNetworking.cpp:420
What did this fix? I implemented what you said, and thought it would fix the 26 issues with concept_check / graph_concepts but I'm still seeing those 26 errors.
Also there are new errors in static_move_ptr.hpp:148:
Did you implement the fix I posted? I no longer have these issues.

I'm going to try to fix those 26 issues by installing a new version of boost via MacPorts like you suggested.
Good link to that post. I think my fix is similar but I'll try that as well, see if it works.

EDIT

That link to the post is already implemented in boost! I found it already in there... so that's good.

night
Space Kraken
Posts: 102
Joined: Sun Jun 12, 2011 1:21 pm

Re: 3582 Build Errors, OS X 10.6

#64 Post by night »

The ServerNetworking.hpp errors were caused by the svn version of Boost I am using - the methods were deprecated. I also implemented your fix and the errors of static_move_ptr are gone now! :D
I did not have much time to have a look at the thread at stackoverflow. Just thought that this might contain some hints to solve those concept errors.
After installing boost from macports I have lots of dylibs now, but I still do not know how to make Xcode use them instead of the include files in dep/local/include/boost.

Hope we get FreeOrion running soon,

night

neuro
Space Squid
Posts: 74
Joined: Sun Mar 07, 2010 10:17 pm

Re: 3582 Build Errors, OS X 10.6

#65 Post by neuro »

Cool, glad the static_move_ptr thing helped.

Just installed boost 1.46 via MacPorts, and copied the files from /opt/local/include/boost and /opt/local/lib (all the boost .a files I need) into the "dep/" respective folders.

Same errors.

Some research I found... :

1. Possibly building boost for iPhone / XCode 4 framework (http://goodliffe.blogspot.com/2010/09/b ... phone.html)
2. Git repos for the framework script (https://gitorious.org/boostoniphone/#more)
3. XCode project with a previous build of boost 1.44 (https://github.com/aleph7/a-coding/downloads)

I'm hoping that what I did with MacPorts to install Boost still didn't give us the correct libraries... Every target builds fine EXCEPT FreeOrionServer and FreeOrionAI (both with the same issues).

Also, after going into the Project settings for these Targets and removing compiled items, I think I've isolated the issue to Universe.cpp. I'm not sure WHERE in there but that seems to be the place that these errors are firing from.

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

Re: 3582 Build Errors, OS X 10.6

#66 Post by Geoff the Medio »

neuro wrote:Also, after going into the Project settings for these Targets and removing compiled items, I think I've isolated the issue to Universe.cpp. I'm not sure WHERE in there but that seems to be the place that these errors are firing from.
night's post has a big list of lengthy Boost errors that appear to be, at least partly, related to boost graph code that's used for pathfinding and distance calculations between objects in the game.

Is there any chance you could use a newer version of GCC? Some reports suggest that GCC 4.2 has this type of problem where things declared in anonymous namespaces don't have "external linkage" (which appears at the end of several of the errors) even though they should. Numerous bits of graph / pathfining code in Universe.cpp is in an anonymous namespace. Apparently GCC 4.3 or later might fix it.

Just to test compiling the offending code, you shouldn't need to recompile any dependencies. (Though if it works, the dependencies might need to be recompiled with the same version of GCC...)

night
Space Kraken
Posts: 102
Joined: Sun Jun 12, 2011 1:21 pm

Re: 3582 Build Errors, OS X 10.6

#67 Post by night »

That's a good idea... I will look into installing a newer version of GCC for Xcode.

EDIT: This could work by using GCC 4.5 from macports. I am now building GCC ... this could take a while :)
EDIT2: It built faster than I thought... not even 20 minutes
EDIT3: Yay I have GCC 4.5 in Xcode now. You have to put the plugin into

Code: Select all

/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins
Then you have to change a part of the info.plist of the plugin from

Code: Select all

<key>CFBundleIdentifier</key>
	<string>com.apple.xcode.compilers.gcc.4_2</string>


to

Code: Select all

<key>CFBundleIdentifier</key>
	<string>com.apple.xcode.compilers.gcc.4_5</string>
in order to be still able to use the standard compilers from Apple.

Then you have to link the macports gcc/g++ binary to the Xcode directory:

Code: Select all

ln /opt/local/bin/gcc-mp-4.5 /Developer/usr/bin/gcc-4.5

ln /opt/local/bin/g++-mp-4.5 /Developer/usr/bin/g++-4.5
Now you can select GCC 4.5 in the C/C++ Compiler Version in the Xcode build settings! :D

There is only a small problem left when I finally try to compile something:

Code: Select all

gcc-4.5: error trying to exec 'cc1': execvp: No such file or directory
Command /Developer/usr/bin/gcc-4.5 failed with exit code 1
I hope we get that fixed,

night

EDIT4:
There could be something wrong with the linking I did. It does not give me an error when I am using /opt/local/bin/gcc-mp-4.5 instead of /opt/local/bin/gcc-mp-4.5

EDIT5: Turned out that I had to change the ExecPath in the GCC 4.5.xspec of the plugin to /opt/local/bin/gcc-mp-4.5.
Now I get this error:

Code: Select all

/Developer/usr/bin/libtool: no library created (no object files in input files matching -arch_only i386)
Command /Developer/usr/bin/libtool failed with exit code 1
EDIT6:
I got GCC 4.5 running now.

FREEALUT:

Code: Select all

/Developer/usr/bin/libtool: no library created (no object files in input files matching -arch_only i386)
Command /Developer/usr/bin/libtool failed with exit code 1
GG:

Code: Select all

/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBundle.h
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBundle.h:147:120: error: format string argument not a string type
Common: Fails but only warnings - no errors

ClientCommon: Fails without any errors/warnings

Everything else: Fails cause dependencies failed

If even GCC 4.5 is not able to compile CoreFoundation and Apple's compilers cannot compile Boost I do not see any way how a mac build of FreeOrion could work with these compilers at all.

Compilers left:

GCC 4. 3/4/6
up-to-date version of LLVM / Clang

I need some sleep now,

night

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

Re: 3582 Build Errors, OS X 10.6

#68 Post by Geoff the Medio »

If you can't find a usable compiler, it's probably possible to put the (seemingly problematic) graph stuff into a non-anonymous namespace, which might get things working.

Edit: Like in the attached patch. Does that fix any of the compile errors? /Edit

That said, is there a reason you need to use the latest XCode with GCC 4.2 or later? What versions were being used previously for building OSX binaries, apparently without problems? Can those not be used still?
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


night
Space Kraken
Posts: 102
Joined: Sun Jun 12, 2011 1:21 pm

Re: 3582 Build Errors, OS X 10.6

#69 Post by night »

Thank you - That patch worked perfectly! :D
The graph errors are gone now. The only problems that are left now are linker problems:

Code: Select all

Undefined symbols for architecture i386:
  "boost::system::system_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in AppInterface.o
      boost::asio::error::get_system_category()    in AppInterface.o
      __static_initialization_and_destruction_0(int, int)in Universe.o
      __static_initialization_and_destruction_0(int, int)in AIClientApp.o
      boost::asio::error::get_system_category()    in AIClientApp.o
      __static_initialization_and_destruction_0(int, int)in camain.o
      boost::asio::error::get_system_category()    in camain.o
      ...
  "boost::system::generic_category()", referenced from:
      __static_initialization_and_destruction_0(int, int)in AppInterface.o
      __static_initialization_and_destruction_0(int, int)in Universe.o
      __static_initialization_and_destruction_0(int, int)in AIClientApp.o
      __static_initialization_and_destruction_0(int, int)in camain.o
      __static_initialization_and_destruction_0(int, int)in PythonAI.o
      __static_initialization_and_destruction_0(int, int)in AIInterface.o
      __static_initialization_and_destruction_0(int, int)in libClientCommon.a(ClientApp.o)
      ...
  "boost::filesystem3::path::wchar_t_codecvt_facet()", referenced from:
      boost::filesystem3::path::codecvt()    in Universe.o
      boost::filesystem3::path::codecvt()    in AIClientApp.o
      boost::filesystem3::path::codecvt()    in PythonAI.o
      boost::filesystem3::path::codecvt()    in libCommon.a(Directories.o)
      boost::filesystem3::path::codecvt()    in libCommon.a(Empire.o)
      boost::filesystem3::path::codecvt()    in libCommon.a(Tech.o)
      boost::filesystem3::path::codecvt()    in libCommon.a(MultiplayerCommon.o)
      ...
  "boost::filesystem3::path::operator/=(boost::filesystem3::path const&)", referenced from:
      boost::filesystem3::operator/(boost::filesystem3::path const&, boost::filesystem3::path const&)in Universe.o
      boost::filesystem3::operator/(boost::filesystem3::path const&, boost::filesystem3::path const&)in AIClientApp.o
      boost::filesystem3::operator/(boost::filesystem3::path const&, boost::filesystem3::path const&)in PythonAI.o
      RelativePath(boost::filesystem3::path const&, boost::filesystem3::path const&)in libCommon.a(Directories.o)
      InitDirs(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libCommon.a(Directories.o)
      boost::filesystem3::operator/(boost::filesystem3::path const&, boost::filesystem3::path const&)in libCommon.a(Directories.o)
      boost::filesystem3::operator/(boost::filesystem3::path const&, boost::filesystem3::path const&)in libCommon.a(Empire.o)
      ...
  "boost::archive::detail::shared_ptr_helper::append(boost::shared_ptr<void const> const&)", referenced from:
      void boost::archive::detail::shared_ptr_helper::reset<ResourcePool>(boost::shared_ptr<ResourcePool>&, ResourcePool*)in libCommon.a(SerializeEmpire.o)
      void boost::archive::detail::shared_ptr_helper::reset<CombatObject>(boost::shared_ptr<CombatObject>&, CombatObject*)in libCommon.a(SerializeOrderSet.o)
      void boost::archive::detail::shared_ptr_helper::reset<Order>(boost::shared_ptr<Order>&, Order*)in libCommon.a(SerializeOrderSet.o)
      void boost::archive::detail::shared_ptr_helper::reset<CombatFighterFormation>(boost::shared_ptr<CombatFighterFormation>&, CombatFighterFormation*)in libCommon.a(SerializePathingEngine.o)
      void boost::archive::detail::shared_ptr_helper::reset<CombatObject>(boost::shared_ptr<CombatObject>&, CombatObject*)in libCommon.a(SerializePathingEngine.o)
      void boost::archive::detail::shared_ptr_helper::reset<CombatFighter>(boost::shared_ptr<CombatFighter>&, CombatFighter*)in libCommon.a(SerializePathingEngine.o)
  "boost::archive::detail::shared_ptr_helper::append(boost_132::shared_ptr<void const> const&)", referenced from:
      void boost::serialization::load<boost::archive::xml_iarchive, ResourcePool>(boost::archive::xml_iarchive&, boost::shared_ptr<ResourcePool>&, unsigned int)in libCommon.a(SerializeEmpire.o)
      void boost::serialization::load<boost::archive::xml_iarchive, CombatObject>(boost::archive::xml_iarchive&, boost::shared_ptr<CombatObject>&, unsigned int)in libCommon.a(SerializeOrderSet.o)
      void boost::serialization::load<boost::archive::xml_iarchive, Order>(boost::archive::xml_iarchive&, boost::shared_ptr<Order>&, unsigned int)in libCommon.a(SerializeOrderSet.o)
      void boost::serialization::load<boost::archive::xml_iarchive, CombatFighterFormation>(boost::archive::xml_iarchive&, boost::shared_ptr<CombatFighterFormation>&, unsigned int)in libCommon.a(SerializePathingEngine.o)
      void boost::serialization::load<boost::archive::xml_iarchive, CombatObject>(boost::archive::xml_iarchive&, boost::shared_ptr<CombatObject>&, unsigned int)in libCommon.a(SerializePathingEngine.o)
      void boost::serialization::load<boost::archive::xml_iarchive, CombatFighter>(boost::archive::xml_iarchive&, boost::shared_ptr<CombatFighter>&, unsigned int)in libCommon.a(SerializePathingEngine.o)
  "boost::filesystem3::detail::dir_itr_close(void*&, void*&)", referenced from:
      boost::filesystem3::detail::dir_itr_imp::~dir_itr_imp()in libCommon.a(MultiplayerCommon.o)
  "boost::filesystem3::detail::directory_iterator_construct(boost::filesystem3::directory_iterator&, boost::filesystem3::path const&, boost::system::error_code*)", referenced from:
      boost::filesystem3::directory_iterator::directory_iterator(boost::filesystem3::path const&)in libCommon.a(MultiplayerCommon.o)
  "boost::filesystem3::path_traits::dispatch(boost::filesystem3::directory_entry const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)", referenced from:
      boost::filesystem3::path::path<boost::filesystem3::directory_entry>(boost::filesystem3::directory_entry const&, boost::enable_if<boost::filesystem3::path_traits::is_pathable<boost::decay<boost::filesystem3::directory_entry>::type>, void>::type*)in libCommon.a(MultiplayerCommon.o)
  "boost::filesystem3::detail::directory_iterator_increment(boost::filesystem3::directory_iterator&, boost::system::error_code*)", referenced from:
      boost::filesystem3::directory_iterator::increment()     in libCommon.a(MultiplayerCommon.o)
  "boost::filesystem3::path::filename() const", referenced from:
      MultiplayerLobbyData::MultiplayerLobbyData(bool)in libCommon.a(MultiplayerCommon.o)
      MultiplayerLobbyData::MultiplayerLobbyData(bool)in libCommon.a(MultiplayerCommon.o)
  "boost::filesystem3::detail::initial_path(boost::system::error_code*)", referenced from:
      boost::filesystem3::initial_path()      in libCommon.a(Directories.o)
  "boost::filesystem3::detail::current_path(boost::system::error_code*)", referenced from:
      boost::filesystem3::current_path()      in libCommon.a(Directories.o)
  "boost::filesystem3::path::m_append_separator_if_needed()", referenced from:
      boost::filesystem3::path& boost::filesystem3::path::append<char [3]>(char const (&) [3], std::codecvt<wchar_t, char, __mbstate_t> const&)in libCommon.a(Directories.o)
      boost::filesystem3::path& boost::filesystem3::path::append<char [23]>(char const (&) [23], std::codecvt<wchar_t, char, __mbstate_t> const&)in libCommon.a(Directories.o)
      boost::filesystem3::path& boost::filesystem3::path::append<char [5]>(char const (&) [5], std::codecvt<wchar_t, char, __mbstate_t> const&)in libCommon.a(Directories.o)
  "boost::filesystem3::path::m_erase_redundant_separator(unsigned long)", referenced from:
      boost::filesystem3::path& boost::filesystem3::path::append<char [3]>(char const (&) [3], std::codecvt<wchar_t, char, __mbstate_t> const&)in libCommon.a(Directories.o)
      boost::filesystem3::path& boost::filesystem3::path::append<char [23]>(char const (&) [23], std::codecvt<wchar_t, char, __mbstate_t> const&)in libCommon.a(Directories.o)
      boost::filesystem3::path& boost::filesystem3::path::append<char [5]>(char const (&) [5], std::codecvt<wchar_t, char, __mbstate_t> const&)in libCommon.a(Directories.o)
  "boost::filesystem3::path::m_path_iterator_increment(boost::filesystem3::path::iterator&)", referenced from:
      boost::filesystem3::path::iterator::increment()   in libCommon.a(Directories.o)
  "boost::filesystem3::absolute(boost::filesystem3::path const&, boost::filesystem3::path const&)", referenced from:
      RelativePath(boost::filesystem3::path const&, boost::filesystem3::path const&)in libCommon.a(Directories.o)
  "boost::filesystem3::path::begin() const", referenced from:
      RelativePath(boost::filesystem3::path const&, boost::filesystem3::path const&)in libCommon.a(Directories.o)
      InitDirs(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libCommon.a(Directories.o)
  "boost::filesystem3::path::end() const", referenced from:
      RelativePath(boost::filesystem3::path const&, boost::filesystem3::path const&)in libCommon.a(Directories.o)
      InitDirs(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libCommon.a(Directories.o)
  "boost::filesystem3::detail::status(boost::filesystem3::path const&, boost::system::error_code*)", referenced from:
      boost::filesystem3::is_directory(boost::filesystem3::path const&)in libCommon.a(Directories.o)
      boost::filesystem3::exists(boost::filesystem3::path const&)in libCommon.a(Directories.o)
      boost::filesystem3::exists(boost::filesystem3::path const&)in libCommon.a(MultiplayerCommon.o)
      boost::filesystem3::is_directory(boost::filesystem3::path const&)in libCommon.a(MultiplayerCommon.o)
  "boost::filesystem3::detail::create_directories(boost::filesystem3::path const&, boost::system::error_code*)", referenced from:
      boost::filesystem3::create_directories(boost::filesystem3::path const&)in libCommon.a(Directories.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
I think we're pretty close to finally compile the entire project. These errors seem to be caused by the new header files we are using and the outdated libraries from the SDK. The linker is not able to find the new methods they implemented in later versions of boost. Using newer libraries could solve the problem.

night

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

Re: 3582 Build Errors, OS X 10.6

#70 Post by Geoff the Medio »

night wrote:These errors seem to be caused by the new header files we are using and the outdated libraries from the SDK.
Uh.. yeah. You shouldn't mix headers and libraries from different boost versions.

neuro
Space Squid
Posts: 74
Joined: Sun Mar 07, 2010 10:17 pm

Re: 3582 Build Errors, OS X 10.6

#71 Post by neuro »

Cool, just woke up and implementing the patch that Geoff submitted (it's 3 a.m. here)

Will let you know how it goes. This is supposed to be done instead of adding the new gcc version right?

The previous version of GCC is 4.0 that was compiling fine with the previous library of boost.

night
Space Kraken
Posts: 102
Joined: Sun Jun 12, 2011 1:21 pm

Re: 3582 Build Errors, OS X 10.6

#72 Post by night »

neuro wrote: Will let you know how it goes. This is supposed to be done instead of adding the new gcc version right?
Yes.

So we have to compile i386/32-Bit binaries for our Boost version. We can build them by following this guide and with these parameters for bjam:

Code: Select all

toolset=darwin architecture=x86 address-model=32

neuro
Space Squid
Posts: 74
Joined: Sun Mar 07, 2010 10:17 pm

Re: 3582 Build Errors, OS X 10.6

#73 Post by neuro »

Ok, built and that namespace changed that Geoff made worked! Awesome.

Just have the 178 errors in FreeOrionAI (all linker issues as night posted above.)

I'm re-building boost library now with ./bjam toolset=darwin architecture=x86 address-model=32.

Which version of boost are you using? 1.45 or 1.46? I think I've built boost about a half-dozen different ways at this point... (MacPorts, bjam, different versions of boost, etc.).

In XCode, I did go into FreeOrion/Dependencies/StaticLibraries/boost and deleted those previous versions of boost. When I'm done with the build, I'll re-link them and test this out.

Also, thanks Geoff for r 3999 commit. Did you want to make the patch to "combat/PathingEngine.h" or should I do it, or do you think it's unnecessary now? I have to dust off how to make patches... The commit is to check for FREEORION_MACOSX and #undef check if it's there. That's right before including a boost library that re-defines / uses check I believe.

i.e.

Code: Select all

// -*- C++ -*-
#ifndef PATHING_ENGINE_H
#define PATHING_ENGINE_H

#include "CombatFighter.h"
#include "CombatShip.h"
#include "PathingEngineFwd.h"
#include "../../universe/Ship.h"

#ifdef FREEORION_MACOSX
#undef check
#endif

#include <boost/ptr_container/ptr_vector.hpp>

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

Re: 3582 Build Errors, OS X 10.6

#74 Post by Geoff the Medio »

neuro wrote:

Code: Select all

#ifdef FREEORION_MACOSX
#undef check
#endif
Would this also work:

Code: Select all

#ifdef FREEORION_MACOSX
#  ifdef check
#    undef check
#  endif
#endif
?

neuro
Space Squid
Posts: 74
Joined: Sun Mar 07, 2010 10:17 pm

Re: 3582 Build Errors, OS X 10.6

#75 Post by neuro »

I believe so, yes that should work.

Post Reply