Re: Reliable way to determine bitness of the kernel
Re: Reliable way to determine bitness of the kernel
- Subject: Re: Reliable way to determine bitness of the kernel
- From: Dave Zarzycki <email@hidden>
- Date: Tue, 22 Feb 2011 10:18:45 -0800
We support "fat" binaries. Please use them to avoid this problem entirely. You just need to reconfigure your kext project to build both architectures at the same. A simple example from the command line:
/tmp $ cat test.c
#include <stdio.h>
int
main(void)
{
printf("sizeof(void *) == %zu\n", sizeof(void *));
return 0;
}
/tmp $ gcc -arch i386 -arch x86_64 -Wall -Wextra -Werror -Os -o test test.c
/tmp $ file test
test: Mach-O universal binary with 2 architectures
test (for architecture i386): Mach-O executable i386
test (for architecture x86_64): Mach-O 64-bit executable x86_64
/tmp $ ./test
sizeof(void *) == 8
/tmp $ arch -i386 ./test
sizeof(void *) == 4
/tmp $
You can use the file command against to verify that any binary is "fat", just like the above.
davez
On Feb 22, 2011, at 10:09 AM, eveningnick eveningnick wrote:
> hello
> i have a kext (or, rather, 2 kexts - one built with -arch i386, another one
> with -arch x86_64). They should work on both OS X 10.5 and 10.6.
> i have an installing script, which looks like
> if [ `uname -a | grep x86_64 | wc -l` ge 1 ]; then
> cp -R "64bit.kext" "/Library/Extensions/"
> else
> cp -R "32bit.kext" "/Library/Extensions/"
>
> this goes into production code.
> But unfortunately, it seems like it does not work well on all systems.
> What caveats may this method of determining the bitness of the system have?
> It works fine on my Leopard and Snow Leopard (even though my Snow Leo runs
> in 32 bit mode), but other people complain that the driver is not being
> installed.
> Maybe some instances of the system are missing any of the command line
> utilities i used?
> Could you suggest a better way of determining the bitness of the kernel?
> Thanks for any advice!
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden