Compilation errors under OS X 10.6

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

Moderator: Committer

Post Reply
Message
Author
Psilonicus
Space Krill
Posts: 4
Joined: Sat Sep 08, 2012 2:35 am

Compilation errors under OS X 10.6

#1 Post by Psilonicus »

Hi everyone. Sorry my first post to the forum has to do with boring compilation errors. I recently checked out the FreeOrion SDK and have been attempting to build it in XCode following the instructions here:

http://www.freeorion.org/index.php/Compile_In_MacOsX

Now the requisite information for the XCode Project settings
ADDITIONAL_SDKS =
ARCHS = i386
SDKROOT = macosx10.4
ONLY_ACTIVE_ARCH = YES
VALID_ARCHS = i386 ppc ppc64 ppc7400 ppc970 x86_64

GCC_VERSION = 4.0

MACOSX_DEPLOYMENT_TARGET = 10.6

Active Target: FreeOrion
Active Executable: FreeOrion
And my own system:

Model Name: MacBook Pro
Model Identifier: MacBookPro8,2
Processor Name: Intel Core i7
Processor Speed: 2 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
Memory: 4 GB

System Version: Mac OS X 10.6.8 (10K549)
Kernel Version: Darwin 10.8.0
Secure Virtual Memory: Enabled
64-bit Kernel and Extensions: Yes

Applications:
Xcode: 3.2.6 (1761)
Interface Builder: 3.2.6 (851)
Instruments: 2.7 (3017)
Dashcode: 3.0.2 (333)
SDKs:
Mac OS X:
10.4: (8S2167)
10.5: (9L31a)
10.6: (10M2518)
The error I'm getting on compile has to do with placeholder (template) classes in AppInterface.cpp. Specifically:
#ifdef FREEORION_BUILD_SERVER
return GetUniverse().Objects().Object<T>(object_id); [!] expected primary-expression before '<' token
My understanding of templates in C++ is not perfect, but something (probably in my settings) is causing the compiler to interpret '<' as a less-than token rather than as a template identifier. What am I missing?

Cheers, and Thanks

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

Re: Compilation errors under OS X 10.6

#2 Post by Geoff the Medio »

The C++ IRC channel suggests that for some reason the compiler in your case doesn't know about the Object function... So, can you try adding

Code: Select all

#include "../universe/ObjectMap.h"
near the top of AppInterface.cpp

If that doesn't work, and even if it does, can you update your XCode version?

Psilonicus
Space Krill
Posts: 4
Joined: Sat Sep 08, 2012 2:35 am

Re: Compilation errors under OS X 10.6

#3 Post by Psilonicus »

Thanks. It's a bit difficult to locate XCode 4.2 for OSX Snow Leopard; it actually requires that one be a paying registered apple developer. Perhaps the wiki should reflect that the SDK requires XCode 4 or greater?

At any rate, as you undoubtedly predicted, simply updating XCode results in novel compilation errors. Here, again, are the specs for XCode:
ARCHS = i386
SDKROOT = macosx10.6
VALID_ARCHS = i386 x86_64
GCC_VERSION = 4.0
MACOSX_DEPLOYMENT_TARGET = 10.6
I'm getting the error:
Binding of reference to type 'token_value_type' (aka 'boost::spirit::unused_type') to a value of type 'const boost::spirit::unused_type' drops qualifiers
Thanks.

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

Re: Compilation errors under OS X 10.6

#4 Post by Geoff the Medio »

Whatever the problem is that's causing that, I don't think it's specific to something in FreeOrion code... It's definitely not something I can fix, especially without any information abuout what code is leading to the error.

Google a bit perhaps? Try updating the Boost version? (I don't know what comes with the OSX SDK). Make sure you're building against the version that's in the SDK and not some other version on your computer?

Psilonicus
Space Krill
Posts: 4
Joined: Sat Sep 08, 2012 2:35 am

Re: Compilation errors under OS X 10.6

#5 Post by Psilonicus »

Geoff the Medio wrote:Whatever the problem is that's causing that, I don't think it's specific to something in FreeOrion code... It's definitely not something I can fix, especially without any information abuout what code is leading to the error.

Google a bit perhaps? Try updating the Boost version? (I don't know what comes with the OSX SDK). Make sure you're building against the version that's in the SDK and not some other version on your computer?
I agree with your assessment. Clearly this is a rare occurrence with OS X builds of FO. I'll poke around a bit, and I'll update this thread if any resolutions are forthcoming.

Thanks for your help.

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

Re: Compilation errors under OS X 10.6

#6 Post by Vezzra »

Hi Psilonicus,

I'm currently the main maintainer of the FreeOrion OSX SDK. I'm in the process of revising and updating the SDK, and short on time ATM, so I'm a bit behind keeping the Xcode project files updated in SVN. That means if you download the SDK now, pull the head revision of FO from SVN, you'll likely get several errors when trying to build FO.

I'll try to get that wrapped up ASAP, but until then you'll have to be a bit patient ;)

That said, you shouldn't have to update Xcode. I'm working on a MBP with specs very similar to your own, and identical OS and Xcode versions (OSX 10.6.8, Xcode 3.2.6). I've 8GB of RAM however, 4GB is the bare minimum needed to compile FO. I'm not even sure it's sufficient anymore (it was a few months ago, but I didn't check since), so that might become a problem for you.

The error you get isn't what I'd expect however. What's also strange are the settings for the compiler and sdkroot. I assume you downloaded the current SDK (here) and ran bootstrap.sh, right? (If not, then things won't work.) What's the active build configuration? You should use "Release". Don't bother with "Debug", I can't build that one even with my 8GB of RAM. "Release_LLVM" is experimental, and "Release_10_5" and "ReleaseUniversal-OLD" don't work at all.

"Base SDK" should be "Mac OS X 10.6", and "C/C++ compiler version" should be "LLVM GCC 4.2". I don't know why your sdkroot is 10.4, and your compiler apparently gcc 4.0. These settings won't work, they might be the reason for the compile error you got.

Another thing to be aware of is that you must not have boost installed on your system, as a separate boost installation gets in conflict with the one bundled with the SDK.

EDIT: I've just committed an updated Xcode project file (rev 5215). So you should be able to build FO after updating your WC to head revision.

Psilonicus
Space Krill
Posts: 4
Joined: Sat Sep 08, 2012 2:35 am

Re: Compilation errors under OS X 10.6

#7 Post by Psilonicus »

Vezzra wrote: "Base SDK" should be "Mac OS X 10.6", and "C/C++ compiler version" should be "LLVM GCC 4.2". I don't know why your sdkroot is 10.4, and your compiler apparently gcc 4.0. These settings won't work, they might be the reason for the compile error you got.
It appears I didn't carefully read the section headings on the wiki page. I'm using the suggested compiler and sdk root for the *old* Freeorion SDK. However, I only switched to these settings after the default settings failed to compile (out of memory). Sounds like I should switch back and build not-debug.

Post Reply