gcc -m32 and int64_t

Steve Kargl sgk at troutmask.apl.washington.edu
Wed Jun 3 04:43:21 UTC 2009


On Wed, Jun 03, 2009 at 11:50:53AM +0800, David Xu wrote:
> It seems there is a problem in /sys/am64/_types.h when cross-compiling a
> 32-bit code in amd64 machine, the following code prints 4 instead of 8:
> 
> /* int64_size.c */
> 
> #include <sys/types.h>
> #include <stdio.h>
> 
> int main()
> {
>     printf("%d\n", sizeof(int64_t));
>     return (0);
> }
> 
> 
> $cc -m32 -o int64_size -B /usr/lib32/ int64_size.c
> $./int64_size
> 4
> 

IIRC, the c compiler in the base system isn't setup 
to be a cross-compiler.  So, there are probably many
more problems than the one shown above.  Peter Wemm
has posted about this previously.

-- 
Steve


More information about the freebsd-amd64 mailing list