Search code examples
macosuniversal-binarylibjpeg

How to compile LibJpeg in universal binary in Mac OSX 10.4


I want to compile jpeg-8b in universal binary (ppc,i386). It should be supported in 10.4 and later OSs. I could do it in 10.5 and 10.6, but the binary is not compatible with 10.4. Thus I tried to compile it in 10.4, but it fails.

This is my code

cd jpeg-8b

sudo ./configure CC="gcc -arch i386  -arch ppc" CXX="g++ -arch i386 -arch ppc" CPP="gcc -E" CXXCPP="g++ -E" -enable-static=yes -enable-shared=no

It fails with the error configure: error: C compiler cannot create executables

How can I compile jpeg-8b in MacOS 10.4?


Solution

  • Can you try compiling it on 10.5/10.6 with 10.4 SDK installed and using:

    export MACOSX_DEPLOYMENT_TARGET="10.4"
    export OSX_SDK="/Developer/SDKs/MacOSX10.4.sdk"
    export OSX_CFLAGS="-isysroot $OSX_SDK -arch ppc -arch i386"
    export OSX_LDFLAGS="-Wl,-syslibroot,$OSX_SDK -arch ppc -arch i386"
    export CFLAGS="$CFLAGS $OSX_CFLAGS"
    export CXXFLAGS="$CXXFLAGS $OSX_CFLAGS"
    export LDFLAGS="$LDFLAGS $OSX_LDFLAGS"
    export ARCHFLAGS="-arch ppc -arch i386"
    

    and try adding --disable-dependency-tracking to ./configure