2
votes

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.

4
Ok, so I need to build the libraries against the 10.4 sdk, but It seems to be easier said than done? Ive set: export MACOSX_DEPLOYMENT_TARGET=10.4 export CC="gcc-4.0" export LDFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" export CFLAGS="-Os -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" Before running ./configure but they all keep throwing up errors! What am i missing?user210437

4 Answers

2
votes

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.

0
votes

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.

0
votes

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

Edit: Using the 10.4 SDK.

0
votes

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)