jparise / php-python

Embedded Python Extension for PHP
http://pecl.php.net/package/python
MIT License
68 stars 16 forks source link

Ported: Bug #61543 installation problems #5

Closed nickl- closed 11 years ago

nickl- commented 12 years ago

Bug #61543 installation problems

Submitted: 2012-03-28 12:58 UTC Modified: 2012-03-28 17:42 UTC
From: str dot pasha at gmail dot com Assigned:
Status: Open Package: python (PECL) PHP Version: 5.3.10 OS: Ubuntu Private report: No CVE-ID:

[2012-03-28 12:58 UTC] str dot pasha at gmail dot com

Description:

..................... checking for embedded Python support... yes, shared checking for Python files in default path... not found configure: error: Please specify path to Python distribution files ERROR: `/tmp/pear/temp/python/configure' failed

Test script:

sudo pecl install python-alpha

[2012-03-28 17:42 UTC] str dot pasha at gmail dot com or phpize ./configure --with-python=/usr/lib/python2.7

............... checking for embedded Python support... yes, shared checking for dlopen in -ldl... yes checking for Py_Initialize in -lpython2.5... no configure: error: wrong Python lib version or lib not found

jparise commented 12 years ago

I replied directly on PHP Bug #61543. I believe the fix involves installing the Ubuntu python-dev package.

pm2845 commented 11 years ago

Hi guys,

I was trying to install this extension for PHP, but I was unable to do so -- either from pecl directly, or from source.

I get the same problem as the other guys -- it can't seem to find the python-dev files (even though they are installed and I pass them through ./configure LDFLAGS="-L/path/to/lib").

My system is ubuntu, for the record.

nickl- commented 11 years ago

You're not giving us much to work with from your report. As always our ability to help you is directly proportional to the amount of information you provide us. I have no error, no php version no python version no platform. What you did provide is some mention of compiler flags yet the documentation asks that you supply tho --with-python configure option so I cannot tell if you did use this or not.

Herewith my scenario that works, it the hope that it may or may not answer a question which you may or may not have. If nothing else hopefully it serves as a template for you to follow should you want more assistance with this. Unfortunately I can't think of anything else that I can do fol you.

Synopsis:

Manual build and install from source checked out from github repository is successful.

Environment:

Mac OS X 10.8.2 php 5.3.19 (self compiled from source) python 2.7.2 (default as installed via xcode command tools)

How to reproduce:

$ git clone git@github.com:jparise/php-python.git
$ cd php-python
$ phpize
$ ./configure --with-python
$ make
$ make install

Enable python.so extension by adding the following to php.ini

extension=python.so

What I found

When I check php info I get the following information about the python extension

$ php -i
....
python

Python Support => enabled
Python Version => 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
Extension Version => 0.9.0-dev
....

What I expected to find.

I expected to find some issue as reported by @pm2845 so that we may address that. Instead to my utter disappointment it compiled without a glitch installed and running the example shell.php seems to work as expected.

$ cd examples
$ php shell.php
Python in PHP (0.9.0-dev)
2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
>>> import sys
>>> print sys.version
2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
>>> for m in sys.modules: print m
copy_reg
sre_compile
_sre
site
__builtin__
sysconfig
__main__
abc
posixpath
linecache
errno
sre_constants
imp
_abcoll
types
_warnings
genericpath
stat
zipimport
warnings
UserDict
sys
re
php
os.path
_weakref
traceback
_weakrefset
posix
sre_parse
os
>>> 

Suggestions

This section is my "going that extra mile" addition to the typical bug report requirements. This is where I

While this is totally optional the other headings are crucial and should always accompany any report as standard. This information allows others to identify your problem, hopefully enables them to reproduce the fault since you provided them with all the building blocks to reproduce your environment but mostly it gives them something to work with and by which to formulate a response that may actually be helpful to you.

My suggestions, have a look at what my discovery unfolded perhaps by following these steps you are able to solve your issue. Please still let us know and do follow this template please, you should take this as a general rule whenever you post on an issue queue or bug tracker. By replying with your success story you help the next person and we are able to close this ticket as resolved.

If by chance you still don't succeed please be so kind as to give us a detailed report, as per this template and in so doing assist us in helping you. Which hopefully saves everyone a whole bunch of unnecessary frustration in the future.

@pm2845 what do you say, will you help us please?

pm2845 commented 11 years ago

Hi, hope this helps:

Synopsis

Manual build from source repository fails at ./configure, as it does says it cannot detect/determine where the python-dev source files are at.

Environment

Ubuntu 12.04.1 LTS PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 18:59:41) Python 2.7.3

The package "python-dev" is installed, and located here: $ dpkg -L python2.7-dev /. /usr /usr/lib /usr/lib/python2.7 /usr/lib/python2.7/distutils /usr/lib/python2.7/distutils/command /usr/lib/python2.7/distutils/command/wininst-9.0.exe /usr/lib/python2.7/distutils/command/wininst-7.1.exe /usr/lib/python2.7/distutils/command/wininst-9.0-amd64.exe /usr/lib/python2.7/distutils/command/wininst-6.0.exe /usr/lib/python2.7/distutils/command/wininst-8.0.exe /usr/lib/python2.7/config /usr/lib/python2.7/config/makesetup /usr/lib/python2.7/config/Setup.config /usr/lib/python2.7/config/config.c.in /usr/lib/python2.7/config/install-sh /usr/lib/python2.7/config/python.o /usr/lib/python2.7/config/libpython2.7-pic.a /usr/lib/python2.7/config/Setup /usr/lib/python2.7/config/Setup.local /usr/lib/python2.7/config/config.c /usr/lib/python2.7/config/libpython2.7.a /usr/lib/pkgconfig /usr/lib/pkgconfig/python-2.7.pc /usr/include /usr/include/python2.7 /usr/include/python2.7/funcobject.h /usr/include/python2.7/complexobject.h /usr/include/python2.7/methodobject.h /usr/include/python2.7/marshal.h /usr/include/python2.7/node.h /usr/include/python2.7/structmember.h /usr/include/python2.7/token.h /usr/include/python2.7/moduleobject.h /usr/include/python2.7/objimpl.h /usr/include/python2.7/intobject.h /usr/include/python2.7/pyctype.h /usr/include/python2.7/genobject.h /usr/include/python2.7/dictobject.h /usr/include/python2.7/pymath.h /usr/include/python2.7/dtoa.h /usr/include/python2.7/cellobject.h /usr/include/python2.7/pymem.h /usr/include/python2.7/traceback.h /usr/include/python2.7/ceval.h /usr/include/python2.7/modsupport.h /usr/include/python2.7/pystate.h /usr/include/python2.7/enumobject.h /usr/include/python2.7/graminit.h /usr/include/python2.7/patchlevel.h /usr/include/python2.7/pythonrun.h /usr/include/python2.7/cStringIO.h /usr/include/python2.7/sliceobject.h /usr/include/python2.7/code.h /usr/include/python2.7/object.h /usr/include/python2.7/py_curses.h /usr/include/python2.7/pyarena.h /usr/include/python2.7/pyport.h /usr/include/python2.7/floatobject.h /usr/include/python2.7/pymactoolbox.h /usr/include/python2.7/classobject.h /usr/include/python2.7/ast.h /usr/include/python2.7/codecs.h /usr/include/python2.7/boolobject.h /usr/include/python2.7/compile.h /usr/include/python2.7/pydebug.h /usr/include/python2.7/pyfpe.h /usr/include/python2.7/bytearrayobject.h /usr/include/python2.7/memoryobject.h /usr/include/python2.7/bytesobject.h /usr/include/python2.7/eval.h /usr/include/python2.7/iterobject.h /usr/include/python2.7/grammar.h /usr/include/python2.7/warnings.h /usr/include/python2.7/pystrtod.h /usr/include/python2.7/pystrcmp.h /usr/include/python2.7/sysmodule.h /usr/include/python2.7/tupleobject.h /usr/include/python2.7/frameobject.h /usr/include/python2.7/rangeobject.h /usr/include/python2.7/structseq.h /usr/include/python2.7/Python.h /usr/include/python2.7/opcode.h /usr/include/python2.7/pgenheaders.h /usr/include/python2.7/bitset.h /usr/include/python2.7/errcode.h /usr/include/python2.7/bytes_methods.h /usr/include/python2.7/asdl.h /usr/include/python2.7/pycapsule.h /usr/include/python2.7/longintrepr.h /usr/include/python2.7/metagrammar.h /usr/include/python2.7/unicodeobject.h /usr/include/python2.7/pygetopt.h /usr/include/python2.7/abstract.h /usr/include/python2.7/import.h /usr/include/python2.7/timefuncs.h /usr/include/python2.7/pymacconfig.h /usr/include/python2.7/setobject.h /usr/include/python2.7/fileobject.h /usr/include/python2.7/listobject.h /usr/include/python2.7/stringobject.h /usr/include/python2.7/pythread.h /usr/include/python2.7/osdefs.h /usr/include/python2.7/descrobject.h /usr/include/python2.7/bufferobject.h /usr/include/python2.7/ucnhash.h /usr/include/python2.7/weakrefobject.h /usr/include/python2.7/longobject.h /usr/include/python2.7/pyerrors.h /usr/include/python2.7/Python-ast.h /usr/include/python2.7/datetime.h /usr/include/python2.7/pyexpat.h /usr/include/python2.7/pgen.h /usr/include/python2.7/intrcheck.h /usr/include/python2.7/parsetok.h /usr/include/python2.7/cobject.h /usr/include/python2.7/symtable.h /usr/share /usr/share/man /usr/share/man/man1 /usr/share/man/man1/python2.7-config.1.gz /usr/share/doc /usr/share/doc/python2.7 /usr/share/doc/python2.7/README.valgrind.gz /usr/share/doc/python2.7/README.maintainers /usr/share/doc/python2.7/gdbinit.gz /usr/share/doc/python2.7/pybench.log.gz /usr/share/doc/python2.7/HISTORY.gz /usr/share/doc/python2.7/test_results.gz /usr/bin /usr/bin/python2.7-config /usr/lib/libpython2.7.so /usr/lib/libpython2.7.a /usr/share/doc/python2.7-dev

How to [try and] reproduce

On Ubuntu, git-clone the php-python repository, and in it do: $ phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626

Then: `$ ./configure --with-python checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib checking for PHP extension directory... /usr/lib/php5/20090626 checking for PHP installed headers prefix... /usr/include/php5 checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... no checking for nawk... nawk checking if nawk is broken... no checking for embedded Python support... yes, shared checking for python-config... /usr/bin/python-config checking for Python includes... -I/usr/include/python2.7 -I/usr/include/python2.7 checking for Python libraries... -L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions checking for pthread_create in -lpthread... yes checking for dlopen in -ldl... yes checking consistency of Python build environment... no configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================`

I have also tried:

`$ ./configure --with-python=/usr/include/python2.7 checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib checking for PHP extension directory... /usr/lib/php5/20090626 checking for PHP installed headers prefix... /usr/include/php5 checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... no checking for nawk... nawk checking if nawk is broken... no checking for embedded Python support... yes, shared checking for python-config... /usr/bin/python-config checking for Python includes... -I/usr/include/python2.7 -I/usr/include/python2.7 checking for Python libraries... -L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions checking for pthread_create in -lpthread... yes checking for dlopen in -ldl... yes checking consistency of Python build environment... no configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================`

And: `$ ./configure --with-python=/usr/lib/python2.7checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib checking for PHP extension directory... /usr/lib/php5/20090626 checking for PHP installed headers prefix... /usr/include/php5 checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... no checking for nawk... nawk checking if nawk is broken... no checking for embedded Python support... yes, shared checking for python-config... /usr/bin/python-config checking for Python includes... -I/usr/include/python2.7 -I/usr/include/python2.7 checking for Python libraries... -L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions checking for pthread_create in -lpthread... yes checking for dlopen in -ldl... yes checking consistency of Python build environment... no configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================`

And: `$ ./configure --with-python=/usr/lib/python2.7/lib checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib checking for PHP extension directory... /usr/lib/php5/20090626 checking for PHP installed headers prefix... /usr/include/php5 checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... no checking for nawk... nawk checking if nawk is broken... no checking for embedded Python support... yes, shared checking for python-config... /usr/bin/python-config checking for Python includes... -I/usr/include/python2.7 -I/usr/include/python2.7 checking for Python libraries... -L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions checking for pthread_create in -lpthread... yes checking for dlopen in -ldl... yes checking consistency of Python build environment... no configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================`

I've also tried: `$ ./configure LDFLAGS="-L/usr/include/python2.7" checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib checking for PHP extension directory... /usr/lib/php5/20090626 checking for PHP installed headers prefix... /usr/include/php5 checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... no checking for nawk... nawk checking if nawk is broken... no checking for embedded Python support... yes, shared checking for python-config... /usr/bin/python-config checking for Python includes... -I/usr/include/python2.7 -I/usr/include/python2.7 checking for Python libraries... -L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions checking for pthread_create in -lpthread... yes checking for dlopen in -ldl... yes checking consistency of Python build environment... no configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, via the LDFLAGS environment variable. Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"

ERROR! You probably have to install the development version of the Python package for your distribution. The exact name of this package varies among them. ============================================================================`

What I found

The php module would not configure, so I was unable to proceed to the next step.

What I expected to find

I expected to be able to configure the module, compile it, and be able to run the example php scripts. etc.

nickl- commented 11 years ago

Ahh I see, now that is fit for a king thank you very buch!

I think the confusion is from lib = /usr/lib/python2.7 and include = /usr/include/python2.7

Have you tried the combination:

$ ./configure --with-python=/usr/include/python2.7 LDFLAGS="-L/usr/lib/python2.7"

perhaps? (or visa versa)

I have a vm instance of ubuntu somewhere and will have a look if it still fires up.

Let us know how it treats you and if you see any difference in response.

jparise commented 11 years ago

Yes, something like ./configure --with-python LDFLAGS="-L/usr/lib/python2.7" will hopefully help. It looks like it's finding your Python development files but failing to build and link the small test program that configure uses to verify the build environment.

The contents of config.log might also be useful. It generally shows the compiler errors for failures like this.

nickl- commented 11 years ago

Considered resolved no response for 11 months