2.5 from source install problem with extensions

F

Florian Demmer

Hi!

I am doing a from source installation of Python 2.5 on some old Debian
machine. As the target directoy I want /opt/somename so i added it to
the configure like so:

../configure --prefix=/opt/somedir

The following make works fine as far as I can see. Then the make
install also actually works and installs python in /opt/somedir with
all its subdirectoris (bin, lib, man, include).
The extensions (*.so) however get put in /usr/local/lib/... and there
also in the wrong python directoy: 2.4

This is a c/p of the make install output:
[...]
running build_scripts
running install_lib
changing mode of /usr/local/lib/python2.4/site-packages/_struct.so to
755
changing mode of /usr/local/lib/python2.4/site-packages/_ctypes.so to
755
[...]

(How) can I change the install_dir for the extensions?
Why does it use python2.4 anyway?! What env var or else is set here
that I cannot find?

thanks!
 
F

Florian Demmer

Hi!

I am doing a from source installation of Python 2.5 on some old Debian
machine. As the target directoy I want /opt/somename so i added it to
the configure like so:

./configure --prefix=/opt/somedir

The following make works fine as far as I can see. Then the make
install also actually works and installs python in /opt/somedir with
all its subdirectoris (bin, lib, man, include).
The extensions (*.so) however get put in /usr/local/lib/... and there
also in the wrong python directoy: 2.4

....and the current /usr/bin/python symlink points to the 2.4
installation (from .deb)
This is a c/p of the make install output:
[...]
running build_scripts
running install_lib
changing mode of /usr/local/lib/python2.4/site-packages/_struct.so to
755
changing mode of /usr/local/lib/python2.4/site-packages/_ctypes.so to
755
[...]

(How) can I change the install_dir for the extensions?
Why does it use python2.4 anyway?! What env var or else is set here
that I cannot find?

thanks!
 
A

Anton Hartl

Hi,


Basically I had the same problem(s).

I've patched setup.py as follows:

--- setup.py.orig Thu Aug 10 01:42:18 2006
+++ setup.py Mon Dec 25 19:05:29 2006
@@ -147,6 +147,14 @@
if ext.name in sys.builtin_module_names:
self.extensions.remove(ext)

+ # so -lpython2.5 works in the build
+ ext.library_dirs.append('.')
+
+ # so shared libs requiring libpython2.5.so work
+ py_instdir = os.environ.get("INSTDIR_PYTHON", None)
+ if py_instdir:
+ ext.library_dirs.append(os.path.join(py_instdir, 'lib'))
+
if platform != 'mac':
# Parse Modules/Setup and Modules/Setup.local to figure out which
# modules are turned on in the file.


Then you have to add INSTDIR_PYTHON to your shell environment, i.e.

INSTDIR_PYTHON=/opt/somedir ; export INSTDIR_PYTHON

or whatever your shell requires.

This works for me. Hope it helps,

Anton
 
F

Florian Demmer

Hi,



Basically I had the same problem(s).


I've patched setup.py as follows:

--- setup.py.orig Thu Aug 10 01:42:18 2006
+++ setup.py Mon Dec 25 19:05:29 2006
@@ -147,6 +147,14 @@
if ext.name in sys.builtin_module_names:
self.extensions.remove(ext)

+ # so -lpython2.5 works in the build
+ ext.library_dirs.append('.')
+
+ # so shared libs requiring libpython2.5.so work
+ py_instdir = os.environ.get("INSTDIR_PYTHON", None)
+ if py_instdir:
+ ext.library_dirs.append(os.path.join(py_instdir, 'lib'))
+
if platform != 'mac':
# Parse Modules/Setup and Modules/Setup.local to figure out which
# modules are turned on in the file.

Then you have to add INSTDIR_PYTHON to your shell environment, i.e.

INSTDIR_PYTHON=/opt/somedir ; export INSTDIR_PYTHON

or whatever your shell requires.

This works for me. Hope it helps,

nice workaround (and it does work), thank you...
at least until when i try to install Python2.6 and forget about that
again ;)

since i was not quite satisfied by the solution (i will have to
install py25 from source on a customer's system that i dont know much
about yet at a later time and that _has_ to work then), i searched for
more reasons why it fails in the first place... and actually found
something:

~/.pydistutils.cfg
--> install_lib = /usr/local/lib/python2.4/site-packages

.... uncommented it and ran make install again --> works! :D

br
Florian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top