How to run macos universal built binary on 32 bit boot of macbook pro
Here are the steps I followed:
1) I compiled my application selecting architectures i386 and x86_64 (from xcode).
2) I see application is built as fat binary which supports i386 and x86_64 (using file command).
TestApp: Mach-O universal binary with 2 architectures
TestApp (for architecture x86_64): Mach-O 64-bit executable x86_64
TestApp (for architecture i386): Mach-O executable i386
3) Now the problem is when I boot 32 bit kernel on macbook pro and try to execute my universal binary, it is behaving as 64 bit architecture application( sizeof(long) and sizeof(char *) is coming as 8 bytes).
For this I found a way how to run universal binary selecting architecture:
arch -i386 ./TestApp
This selects i386 architecture from fat binary and runs the application(sizeof(long) and sizeof(char *) is 4 bytes).
However, my requirement is I should run universal binary on i386 as i386 application without using arch command.
Are there any xcode settings to be made to make universal binary run as i386 application on 32 bit macos boot ??? Can we select architectural preferences for running universal binary application ??
Please help.
Regards,
Sumanth
macbook pro, Mac OS X (10.6.4)