由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Python problem on 64 bit Linux
相关主题
关于Makefile的一个问题Makefile疑问
[合集] MSVS.Net里面怎么才能显示出每一次compile的完全命令?c++ compiler under unix
spent a lot of time try to compile boost问一个link的问题
vc 2008: compilation error about header file[合集] 请问-fno-implicit-templates的用处
third party c/c++ code and compile it on win 7请推荐makefile generator
g++ compilation problem in linuxOne question in C programming
copy constructor 问题gcc compile option
Can LGPL, Boost library be used in commercial software developing?Linux Makefile: How to include cpp files in subfolder for (转载)
相关话题的讨论汇总
话题: bit话题: 64话题: python话题: linux话题: 32
进入Programming版参与讨论
1 (共1页)
k***r
发帖数: 4260
1
I have a shared library file (.so) that I used to call with ctypes.
And that works perfectly on 32 bit Linux. However on this new
64 bit Linux, Python always compiles to 64 bit and ctypes can
not load the 32 bit .so.
The .so uses a 32 bit .a file that I don't have source for,
so I can not compile it to 64 bit.
I tried copying the 32 bit python executable to the 64 bit machine.
However, it loads the 64 bit libraries in /usr/local/lib/python2.5.
I can copy the lib files from the 32 bit machine, to
t****t
发帖数: 6806
2
install 32-bit python and ALL the dependencies in another directory, e.g. /
usr/local32

【在 k***r 的大作中提到】
: I have a shared library file (.so) that I used to call with ctypes.
: And that works perfectly on 32 bit Linux. However on this new
: 64 bit Linux, Python always compiles to 64 bit and ctypes can
: not load the 32 bit .so.
: The .so uses a 32 bit .a file that I don't have source for,
: so I can not compile it to 64 bit.
: I tried copying the 32 bit python executable to the 64 bit machine.
: However, it loads the 64 bit libraries in /usr/local/lib/python2.5.
: I can copy the lib files from the 32 bit machine, to

k***r
发帖数: 4260
3
If I compile from source, it always compiles to 64 bit.
So I guess I'll need to install 32 bit binaries. If I
install with RPM, doesn't it always go to the default
directories? Or is there a way for me to specify that?

e.g. /

【在 t****t 的大作中提到】
: install 32-bit python and ALL the dependencies in another directory, e.g. /
: usr/local32

t****t
发帖数: 6806
4
you don't have to compile to 64bit. e.g. for gcc, you can specifiy -m32 to
compile to 32bit. make sure you have 32bit devel environment installed, such
as glibc-devel.i386 for fedora. the 32bit runtime (e.g. glibc.i386/glibc.
i686) is usually installed by default.
i only use fedora, the package name could be different for other
distributions.

【在 k***r 的大作中提到】
: If I compile from source, it always compiles to 64 bit.
: So I guess I'll need to install 32 bit binaries. If I
: install with RPM, doesn't it always go to the default
: directories? Or is there a way for me to specify that?
:
: e.g. /

k***r
发帖数: 4260
5
Thanks. That sounds like a lot of work :)
I tried a different approach, which isn't trivial either.
I compile python with
--prefix=/usr/local32 --libdir=/usr/local32/lib
Then create /usr/local32 and copy the files over to the
64 bit machine. Python runs now, although I still need
to copy all necessary files, and set LD_LIBRARY_PATH to
make the necessary modules work.

m32 to
installed, such
glibc.i386/glibc.

【在 t****t 的大作中提到】
: you don't have to compile to 64bit. e.g. for gcc, you can specifiy -m32 to
: compile to 32bit. make sure you have 32bit devel environment installed, such
: as glibc-devel.i386 for fedora. the 32bit runtime (e.g. glibc.i386/glibc.
: i686) is usually installed by default.
: i only use fedora, the package name could be different for other
: distributions.

t****t
发帖数: 6806
6
what's the difference...? you can do this on any 64-bit linux by specify the
same configure cmdline, while setting environment "CC=gcc -m32".
BTW, I remember the /usr/local/lib always has 32-bit libraries by default.
64-bit libraries stayes in /usr/local/lib64. You can check with "file".

【在 k***r 的大作中提到】
: Thanks. That sounds like a lot of work :)
: I tried a different approach, which isn't trivial either.
: I compile python with
: --prefix=/usr/local32 --libdir=/usr/local32/lib
: Then create /usr/local32 and copy the files over to the
: 64 bit machine. Python runs now, although I still need
: to copy all necessary files, and set LD_LIBRARY_PATH to
: make the necessary modules work.
:
: m32 to

k***r
发帖数: 4260
7
The difference is, I wasn't sure (still am not) what I need
to install on the 64 bit machine to compile. I use python's
configure and make and I didn't really want to mess with
the generated Makefile. Maybe it's easy. Maybe I should give
it a try next time.
It seems that in my case, the /usr/local/lib/python2.5 files
are all for 64 bit. I checked with file and confirmed this.

specify the
default.
"file".

【在 t****t 的大作中提到】
: what's the difference...? you can do this on any 64-bit linux by specify the
: same configure cmdline, while setting environment "CC=gcc -m32".
: BTW, I remember the /usr/local/lib always has 32-bit libraries by default.
: 64-bit libraries stayes in /usr/local/lib64. You can check with "file".

t****t
发帖数: 6806
8
it's rarely need to mess with the "configure" generated Makefile.
in your case, you can do
configure --prefix=/usr/local32
env CC="gcc -m32" make
make install
also, i believe */lib/python2.*/* is so called python byte-compiled file and
doesn't matter whether it's 32-bit or 64-bit...

【在 k***r 的大作中提到】
: The difference is, I wasn't sure (still am not) what I need
: to install on the 64 bit machine to compile. I use python's
: configure and make and I didn't really want to mess with
: the generated Makefile. Maybe it's easy. Maybe I should give
: it a try next time.
: It seems that in my case, the /usr/local/lib/python2.5 files
: are all for 64 bit. I checked with file and confirmed this.
:
: specify the
: default.

k***r
发帖数: 4260
9
I see. I didn't know the env option. Good to know that.
Inside pyton2.*/lib-dynload there are a whole bunch of
.so files.

file and

【在 t****t 的大作中提到】
: it's rarely need to mess with the "configure" generated Makefile.
: in your case, you can do
: configure --prefix=/usr/local32
: env CC="gcc -m32" make
: make install
: also, i believe */lib/python2.*/* is so called python byte-compiled file and
: doesn't matter whether it's 32-bit or 64-bit...

1 (共1页)
进入Programming版参与讨论
相关主题
Linux Makefile: How to include cpp files in subfolder for (转载)third party c/c++ code and compile it on win 7
C arrayg++ compilation problem in linux
some interview questionscopy constructor 问题
A C++ compiler related interview questionCan LGPL, Boost library be used in commercial software developing?
关于Makefile的一个问题Makefile疑问
[合集] MSVS.Net里面怎么才能显示出每一次compile的完全命令?c++ compiler under unix
spent a lot of time try to compile boost问一个link的问题
vc 2008: compilation error about header file[合集] 请问-fno-implicit-templates的用处
相关话题的讨论汇总
话题: bit话题: 64话题: python话题: linux话题: 32