Compiling with boost in Xcode 6.0.1

Problems building or running the engine, queries about how to use features etc.
Post Reply
Elendurwen
Gnoblar
Posts: 12
Joined: Sat Mar 15, 2014 7:50 pm

Compiling with boost in Xcode 6.0.1

Post by Elendurwen »

I am trying to compile Ogre3D (C++) using Xcode 6.0.1. Ogre depends on the boost library, which is the problem. As far as I understand it, boost does not build by default in a way that allows Xcode's compiler to use it.

I first tried to install boost through ports, using

Code: Select all

port install boost +universal
as suggested on Ogre forums. When that didn't work, I uninstalled boost, got rid of any references to it from /opt/local/include and /opt/local/lib and tried to install it manually to /Developer/SDKs/boost from the boost web site download, according to their instructions. I even tried the fix suggested on http://stackoverflow.com/questions/8486 ... clang-libc, that is supposed to build boost for compatibility with Xcode but that didn't work either.

I always get errors like:

Code: Select all

Ignoring file /Developer/SDKs/boost/lib/libboost_date_time.a, file was built for archive which is not the architecture being linked (i386): /Developer/SDKs/boost/lib/libboost_date_time.a
    Undefined symbols for architecture i386:
      "boost::this_thread::disable_interruption::disable_interruption()", referenced from:
          boost::shared_mutex::lock() in OgreWorkQueue.o
In Xcode build settings, I have these specifications:

- Architecture: Universal (x86_64,i386)
- Compiler: Apple LLBm 6.0

Xcode's build command output is:

Code: Select all

build/lib/macosx/Debug/Ogre.framework/Versions/1.10.0/Ogre normal x86_64
        cd /Developer/SDKs/OgreSDK_latest
        export MACOSX_DEPLOYMENT_TARGET=10.7
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -dynamiclib -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Developer/SDKs/OgreSDK_latest/build/lib/macosx/Debug -L/opt/local/lib/Debug -L/opt/local/lib -F/Developer/SDKs/OgreSDK_latest/build/lib/macosx/Debug -F/Library/Frameworks -filelist /Developer/SDKs/OgreSDK_latest/build/OgreMain/OGRE.build/Debug/OgreMain.build/Objects-normal/x86_64/Ogre.LinkFileList -install_name @executable_path/../Frameworks/Ogre.framework/Versions/1.10.0/Ogre -mmacosx-version-min=10.7 -framework IOKit -framework Cocoa -framework Carbon -framework OpenGL -framework CoreVideo /Developer/SDKs/boost/lib/libboost_thread.a /Developer/SDKs/boost/lib/libboost_date_time.a /Developer/SDKs/OgreSDK_latest/Dependencies/lib/Debug/libfreeimage.a /Developer/SDKs/OgreSDK_latest/Dependencies/lib/Debug/libzzip.a /usr/lib/libz.dylib -stdlib=libc++ -fobjc-link-runtime -single_module -compatibility_version 1.10.0 -current_version 1.10.0 -Xlinker -dependency_info -Xlinker /Developer/SDKs/OgreSDK_latest/build/OgreMain/OGRE.build/Debug/OgreMain.build/Objects-normal/x86_64/Ogre_dependency_info.dat -o /Developer/SDKs/OgreSDK_latest/build/lib/macosx/Debug/Ogre.framework/Versions/1.10.0/Ogre
I am not sure what to do at this point, did anyone manage to solve this problem?
User avatar
DanielSefton
Ogre Magi
Posts: 1235
Joined: Fri Oct 26, 2007 12:36 am
Location: Mountain View, CA
x 10
Contact:

Re: Compiling with boost in Xcode 6.0.1

Post by DanielSefton »

Sadly don't have enough time to give you a direct answer, but note the difference between compiling it with libc++ and libstdc++, Ogre may be built with the latter by default and it will give you those sort of errors if you mix them.

Plus: You don't have to compile boost with Ogre, only really if you require background resource loading :)

Oh and, it's probably outdated by now, but here's my guide on building boost with Xcode with some pre-existing scripts (which may have been updated since): http://www.danielsefton.com/2012/03/bui ... xcode-4-3/
Elendurwen
Gnoblar
Posts: 12
Joined: Sat Mar 15, 2014 7:50 pm

Re: Compiling with boost in Xcode 6.0.1

Post by Elendurwen »

Thanks for that link, I will go through. I would prefer not to compile with boost, it's been giving me headache! But when I run CMAKE there is no option to remove boost from the project dependencies. Could you please let me know how to do this? Is that a change somewhere in the Xcode project itself?
User avatar
DanielSefton
Ogre Magi
Posts: 1235
Joined: Fri Oct 26, 2007 12:36 am
Location: Mountain View, CA
x 10
Contact:

Re: Compiling with boost in Xcode 6.0.1

Post by DanielSefton »

Setting OGRE_CONFIG_THREADS to 0 in CMake should do the trick.
Elendurwen
Gnoblar
Posts: 12
Joined: Sat Mar 15, 2014 7:50 pm

Re: Compiling with boost in Xcode 6.0.1

Post by Elendurwen »

Ok I think it did - thanks for that!
Now I have another set of compiling errors, which are the same but about libfreeimage :)

Code: Select all

Undefined symbols for architecture x86_64:
  "std::string::find(char const*, unsigned long) const", referenced from:
      Iex::throwErrnoExc(std::string const&, int) in libfreeimage.a
I did build libfree image though mac ports, with +universal so I guess it's a very similar problem. Can you use ogre without this library or is there a way to fix this that you know about?
Post Reply