Thank you!
Probably I think that I have some problems with my compiler. So that because:

[u...@server_name ~/test]$ gcc -m32 sizeof-long.c -o sizeof-long
/usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc

I thought that 32 bit doesn't work because gcc doesn't look under /usr/lib32, so I added lib32 path, but I failed again:

[u...@server_name ~/test]$ gcc -m32 sizeof-long.c -L/lib32 -L/usr/lib32 -L`pwd`/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32 -pthread -fomit-frame-pointer -o sizeof-long /usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/crt1.o' is incompatible with i386 output /usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/crti.o' is incompatible with i386 output /usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/crtbegin.o' is incompatible with i386 output /usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/crtend.o' is incompatible with i386 output /usr/bin/ld: warning: i386:x86-64 architecture of input file `/usr/lib/crtn.o' is incompatible with i386 output /usr/bin/ld: BFD 2.15 [FreeBSD] 2004-05-23 internal error, aborting at /usr/src/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/reloc.c line 4274 in bfd_generic_get_relocated_section_contents

/usr/bin/ld: Please report this bug.

Then I tryed to link the binary myself explicitly against /usr/lib32, and it works:

[u...@server_name ~/test]$ gcc -c -m32 -o sizeof-long.o sizeof-long.c
[u...@server_name ~/test]$ /usr/bin/ld --eh-frame-hdr -m elf_i386_fbsd -V -dynamic-linker /libexec/ld-elf32.so.1 -o sizeof-long /usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/crtbegin.o -L/usr/lib32 sizeof-long.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib32/crtend.o /usr/lib32/crtn.o
GNU ld version 2.15 [FreeBSD] 2004-05-23
  Supported emulations:
   elf_i386_fbsd
   elf_x86_64_fbsd
[u...@server_name ~/test]$ file sizeof-long
sizeof-long: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), for FreeBSD 7.3, dynamically linked (uses shared libs), FreeBSD-style, not stripped
[u...@server_name ~/test]$ ./sizeof-long
*sizeof(long): 4*

Now I'm thinking about how cat I patch pypy source code to compile it with described below "manual" method =)



11.05.2010 20:38, Paolo Giarrusso пишет:
On Tue, May 11, 2010 at 14:08, Shadrin Eugene<[email protected]>  wrote:
Hi!

I tryed to build pypy on the freebsd, 64bit platform, but failed.

First of all I downloaded a 32bit-Python to run pypy.
And then:

[u...@server_name ~/pypy-trunk/pypy/translator/goal]$ ~/py32/bin/python
translate.py -Ojit
[translation:info] Translating target as defined by targetpypystandalone
[platform:execute] gcc -m32 -c -O3 -pthread -fomit-frame-pointer
/var/tmp/usession-trunk-22/gcctest.c -o /var/tmp/usession-trunk-22/gcctest.o
[platform:WARNING] /var/tmp/usession-trunk-22/gcctest.c:28:2: warning: no
newline at end of file
[platform:execute] gcc -m32 /var/tmp/usession-trunk-22/gcctest.o -L/lib32
-L/usr/lib32 -L`pwd`/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32 -pthread
-o /var/tmp/usession-trunk-22/gcctest
printf("sizeof short=%ld\n", (long)sizeof(short));
         printf("sizeof unsigned short=%ld\n", (long)sizeof(unsigned short));
         printf("sizeof int=%ld\n", (long)sizeof(int));
         printf("sizeof unsigned int=%ld\n", (long)sizeof(unsigned int));
         printf("sizeof long=%ld\n", (long)sizeof(long));
         printf("sizeof unsigned long=%ld\n", (long)sizeof(unsigned long));
         printf("sizeof signed char=%ld\n", (long)sizeof(signed char));
         printf("sizeof unsigned char=%ld\n", (long)sizeof(unsigned char));
         printf("sizeof long long=%ld\n", (long)sizeof(long long));
         printf("sizeof unsigned long long=%ld\n", (long)sizeof(unsigned long
long));
         printf("sizeof size_t=%ld\n", (long)sizeof(size_t));
         printf("sizeof time_t=%ld\n", (long)sizeof(time_t));
         printf("sizeof wchar_t=%ld\n", (long)sizeof(wchar_t));
         printf("sizeof mode_t=%ld\n", (long)sizeof(mode_t));
         printf("sizeof pid_t=%ld\n", (long)sizeof(pid_t));
sizeof short=2
sizeof unsigned short=2
sizeof int=4
sizeof unsigned int=4
sizeof long=8
sizeof unsigned long=8
sizeof signed char=1
sizeof unsigned char=1
sizeof long long=8
sizeof unsigned long long=8
sizeof size_t=8
sizeof time_t=8
sizeof wchar_t=4
sizeof mode_t=2
sizeof pid_t=4

Traceback (most recent call last):
   File "translate.py", line 300, in<module>
     main()
   File "translate.py", line 205, in main
     targetspec_dic, translateconfig, config, args =
parse_options_and_load_target()
   File "translate.py", line 153, in parse_options_and_load_target
     targetspec_dic = load_target(targetspec)
   File "translate.py", line 105, in load_target
     mod = __import__(specname)
   File "targetpypystandalone.py", line 5, in<module>
     from pypy.objspace.std.objspace import StdObjSpace
   File "/place/home/hitrobot/pypy-trunk/pypy/objspace/std/__init__.py", line
1, in<module>
     from pypy.objspace.std.objspace import StdObjSpace
   File "/place/home/hitrobot/pypy-trunk/pypy/objspace/std/objspace.py", line
3, in<module>
     from pypy.interpreter import pyframe, function, special
   File "/place/home/hitrobot/pypy-trunk/pypy/interpreter/pyframe.py", line
13, in<module>
     from pypy.rlib import jit, rstack
   File "/place/home/hitrobot/pypy-trunk/pypy/rlib/rstack.py", line 10, in
<module>
     from pypy.rpython.lltypesystem import rffi, lltype
   File "/place/home/hitrobot/pypy-trunk/pypy/rpython/lltypesystem/rffi.py",
line 824, in<module>
     sys.maxint, sizeof(lltype.Signed)))
AssertionError: Mixed configuration of the word size of the machine:
         the underlying Python was compiled with maxint=2147483647,
         but the C compiler says that 'long' is 8 bytes


I got this error, then I added "-m32" flag to gcc argument list (in the
posix.py source file) , but error occured again :(
Your fix was reasonably correct, and the printed command line shows an
-m32 flag passed to gcc, however the subsequent program listing still
says that sizeof(long) is 8 bytes. I'm assuming that the program
getting executed is the one compiled there (gcctest), can you please
verify?
I just double-checked that this result is unreasonable here on Linux
64bit (Ubuntu Karmic 9.10):

$ cat sizeof-long.c
#include<stdio.h>
int main(void) {
     printf("sizeof(long): %zd\n", sizeof(long));
     return 0;
}
$ gcc -m32    sizeof-long.c   -o sizeof-long
$ ./sizeof-long
sizeof(long): 4

That's what you need to get (i.e. sizeof(long) == 4 rather than 8).
Once you get it, you can fix the above error. I rechecked the above
messages, there's nothing strange. Maybe you have some gcc wrapper
silently forcing -m64 on the cmd line?

Does anybody tryed to build pypy-c on the 64bit FreeBsd?
I didn't myself.


--
Шадрин Евгений
Группа разработки активных роботов
Отдел разработки Антиспама
разработчик

_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to