views:

644

answers:

4

Hello,

I'm building a C++ command line tool in Xcode. The project contains dylibs for curl, boost and log4cpp.

Ideally id like to build an i386 universal binary that supports 10.4 through to 10.6.

I cant seem to get Xcode to compile, when I target 10.4 it says things like no such file or directory.

When i target 10.6 x_64 it builds ok, but 10.5 i386 complains about my dylibs not being the correct architecture for 10.5?

What version of GCC should i be using?

Also, When i create an install package with PackageMaker, where should the installer place the dylibs that the tool requires?

Many thanks in advance, Toby.

A: 

You should be able to just select the 10.4 SDK and gcc 4.0 and build one executable that will run on anything from 10.4 upwards.

Paul R
Thats exactly what I thought, I have 10.4 selected as Base SDK OSX deployment target, GCC 4.0 set as the compiler. But i get 10428 compile errors, mostly inside the std library?
Toby
+1  A: 

Your libraries are probably only built for X86_64. You need to recompile your libraries as universal binaries.

Edit: Using the 10.4 SDK.

Simon
That makes sense, but how exactly would i do that? For example the boost libraries?
Toby
A: 

In the Project menu, choose Set Active SDK, and pick Mac OS X 10.4 there.

If you get link errors using that SDK, you probably added libraries which were not build for 10.4

Make sure you're using the 10.4 libraries, e.g. libcurl would be found in

/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/libcurl.dylib

You're probably linking with

/usr/lib/libcurl.dylib

which would be the version for your running OS (I assume 10.6)

Pieter
A: 

The 3rd party libraries were built for 10.6 x_64, I needed to rebuild them for 10.4.

I installed the 10.4u sdk by downloading xcode 3.2 and choosing 'install 10.4 support' during the installation process.

After rebuilding each library with GCC 4.0 against the 10.4u sdk, my project compiled successfully.

I also used static libraries so I don't need to include them in the installer.

Toby