user210437
user210437

Reputation:

How to build C++ for OSX 10.4, 10.5 and 10.6 in Xcode with dynamic libraries

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.

Upvotes: 2

Views: 3143

Answers (4)

user210437
user210437

Reputation:

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.

Upvotes: 2

Pieter
Pieter

Reputation: 17705

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)

Upvotes: 0

Cromulent
Cromulent

Reputation: 3818

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

Edit: Using the 10.4 SDK.

Upvotes: 0

Paul R
Paul R

Reputation: 212979

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.

Upvotes: 0

Related Questions