py 2.7.1 & openssl

nirinA nirina.raseliarison at gmail.com
Fri Apr 1 08:35:36 EDT 2011


hi,

> Yes, _md5 is enabled but I get a very long list under
>  Failed to build these modules:
> ... list of mostly all extension modules ...
> This list was empty earlier.

at some point, the compilation failed to detect
needed headers or libraries files.
i suggest you to try something simple in order to
see  what is wrong in the compilation step.

first, when compiling openssl.
your wrote in original post:

> I installed openssl-1.0.0d.tar.gz on my RHEL 5 box using:
>         ./config --prefix=/usr/local --openssldir=/usr/local/openssl
> shared zlib
>         make
>         sudo make install

just try:

	./config
	make
	make install

and nothing else.
do su root, when you install, not sudo.
don't use any --prefix=xxx nor --openssldir=xxx.
use the default location, that is /usr/local/ssl
as this is the location where Python looks for
ssl headers and libraries.
don't use shared. Python uses static libraries and
as far as i can tell, shared libraries are not
supported yet on x86_64 platform.
with openssl-1.0.0d, i think you don't even need
to specify the -fPIC flag, but using it doesn't hurt.

you also wrote:

> And, the following files are created in /usr/local/lib64:
> libssl.a, libssl.so, libcrypto.a, libcrypto.so.  Also, the binary
> openssl is created in the bin directory.

these files aren't used at all, unless you change the setup.py
file to build _ssl extension.
i repeat: Python uses /usr/local/ssl directory
(or /usr/contrib/ssl/) to look for ssl headers and libraries.

secondly, when compiling Python:

> Then I installed python 2.7.1 using
>         PYHOME=/usr/local/Python-2.7.1; export PYHOME
>         LD_RUN_PATH=$PYHOME/lib; export LD_RUN_PATH
>         LDFLAGS="-L /usr/local/lib64 -L /usr/local/lib"; export
> LDFLAGS
>         CPPFLAGS="-I /usr/local/include -I /usr/local/include/
> openssl"; export CPPFLAGS
>         ./configure --enable-shared --prefix=$PYHOME > log_cfg 2>&1
>         make > log_mk 2>&1
>         sudo make install > log_mk_i 2>&1

try something simple instead of these messy configurations!
just try:

	./configure
	make
	make install

if you want to install Python in a specific directory,
e.g. /usr/local/Python-2.7.1 , use:

	make install DESTDIR=/usr/local/Python-2.7.1

and then, you play with:

	export LD_LIBRARY_PATH=/usr/local/Python-2.7.1/lib
	/usr/local/Python-2.7.1/bin/python

if you really want to specify some libraries and include files,
but usually you don't, Python is smart enough to find them,
don't use :

>  LDFLAGS="-L /usr/local/lib64 -L /usr/local/lib"; export
> LDFLAGS
>  CPPFLAGS="-I /usr/local/include -I /usr/local/include/
> openssl"; export CPPFLAGS

pass them in the configuration line instead:

	CPPFLAGS="-I/usr/local/include/openssl" \
	LDFLAGS="-L/usr/local/lib64" \
	./configure

notice that there is no space between
the -I or -L and the directory name.
and the backslash to continue long line.

finally, don't use sudo.
try to log as root if possible.
may be you cannot access some
files needed for compilation
as a simple user.
and some LD*** and CPP*** flags
are reset when you use sudo.

hope this helps

nirinA
--
Simple is better than complex.



More information about the Python-list mailing list