[Box Backup] Building Box Backup as Universal Binaries [OS X]

patrick machielse boxbackup@fluffy.co.uk
Wed, 4 Oct 2006 13:30:39 +0200


Op 4-okt-2006, om 13:00 heeft Ben Summers het volgende geschreven:

> You have endian issues. Build two separate arch specific binaries,
> then use lipo to make a universal binary. It will probably be
> necessary to build the binaries on the target architecture because of
> the configure tests.

Hmm, that would be a bit inconvenient, but if there is no other way I  
guess I'll have to. The curious thing is that my ppc binary breaks  
when I include the -arch i386 flag. I can't really explain why that  
would happen. I get a fully functioning ppc binary when I use:

export CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc"
export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch  
ppc"

The inclusion of the -arch i386 shouldn't impact the ppc binary when  
I'm building on a ppc machine, if I understand the process correctly.

Usually, when the configure script produces a config.h file, I can  
modify that file using  compiler variables and handle endian issues  
correctly for both architectures:

/* On Mac OS X, the compiler's -arch flag defines endianness flags
    which we use to build a universal binary from 1 config file
*/
#if __BIG_ENDIAN__
	/* Target processor is big endian. */
	...
#elif __LITTLE_ENDIAN__
	/* Target processor is little endian. */
	...
#endif

Is there a way to use this approach with Box Backup? How does the  
build process take endianness into account?

Thanks,

patrick