[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2] autoconf: check for Python.h header and -lpython* lib
>>> On 20.03.12 at 14:06, "Jan Beulich" <JBeulich@xxxxxxxx> wrote: >>>> On 12.03.12 at 14:35, Roger Pau MonnÃ<roger.pau@xxxxxxxxxxxxx> wrote: >> 2012/3/12 Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>: >>> Roger Pau Monne writes ("[PATCH v2] autoconf: check for Python.h header and >> -lpython* lib"): >>>> autoconf: check for Python.h header and -lpython* lib >>> >>> Right, this is better. >>> >>>> +ac_previous_cppflags=$CPPFLAGS >>> ... >>>> +AC_CHECK_HEADER([Python.h], [], >>>> + [AC_MSG_ERROR([Unable to find Python development headers])],) >>>> +AC_CHECK_LIB($python_lib, PyArg_ParseTuple, [], >>>> + [AC_MSG_ERROR([Unable to find a suitable python development >>>> library])]) >>>> +CPPFLAGS=$ac_previous_cppflags >>>> +LDLFAGS=$ac_previous_ldflags >>> >>> But AFAICT we go to all this effort to find the right python flags and >>> then we throw them away. This is a bit odd. Shouldn't we be passing >>> this in some PYTHON_FOOFLAGS variables for the benefit of tools/python ? >> >> This would only be needed to compile Python C modules, but since >> python uses it's own standart build script (tools/python/setup.py) and >> we already pass to the setup.py script the desired python version to >> use, it already fetches the necessary includes/libs using it's own >> mechanisms. > > I'm sorry to say that, but this change is pretty incompatible: Not only > does Python not provide any python-config prior to 2.5.x, but > additionally was Ian's point above very valid: Stripping all the other > -l options causes a configure failure for me: > > configure:6176: checking for PyArg_ParseTuple in -lpython2.4 > configure:6201: gcc -o conftest -g -O2 -g -O2 -I/usr/include/python2.4 > -I/usr/include/python2.4 > -L/usr/lib/python2.4/config conftest.c -lpython2.4 >&5 > /usr/lib/python2.4/config/libpython2.4.a(posixmodule.o): In function > `posix_tmpnam': > (.text+0x81e): warning: the use of `tmpnam_r' is dangerous, better use > `mkstemp' > /usr/lib/python2.4/config/libpython2.4.a(posixmodule.o): In function > `posix_tempnam': > (.text+0x90c): warning: the use of `tempnam' is dangerous, better use > `mkstemp' > /usr/lib/python2.4/config/libpython2.4.a(complexobject.o): In function > `complex_abs': > (.text+0x54d): undefined reference to `hypot' > /usr/lib/python2.4/config/libpython2.4.a(complexobject.o): In function > `_Py_c_pow': > (.text+0x2418): undefined reference to `hypot' > /usr/lib/python2.4/config/libpython2.4.a(complexobject.o): In function > `_Py_c_pow': > (.text+0x242a): undefined reference to `pow' > /usr/lib/python2.4/config/libpython2.4.a(complexobject.o): In function > `_Py_c_pow': > (.text+0x243f): undefined reference to `atan2' > /usr/lib/python2.4/config/libpython2.4.a(complexobject.o): In function > `_Py_c_pow': > (.text+0x2470): undefined reference to `cos' > /usr/lib/python2.4/config/libpython2.4.a(complexobject.o): In function > `_Py_c_pow': > (.text+0x2483): undefined reference to `sin' > /usr/lib/python2.4/config/libpython2.4.a(complexobject.o): In function > `_Py_c_pow': > (.text+0x24f6): undefined reference to `exp' > /usr/lib/python2.4/config/libpython2.4.a(complexobject.o): In function > `_Py_c_pow': > (.text+0x2507): undefined reference to `log' > /usr/lib/python2.4/config/libpython2.4.a(floatobject.o): In function > `float_rem': > (.text+0x17c8): undefined reference to `fmod' > /usr/lib/python2.4/config/libpython2.4.a(floatobject.o): In function > `float_divmod': > (.text+0x25a8): undefined reference to `fmod' > /usr/lib/python2.4/config/libpython2.4.a(floatobject.o): In function > `float_pow': > (.text+0x296f): undefined reference to `pow' > /usr/lib/python2.4/config/libpython2.4.a(floatobject.o): In function > `float_pow': > (.text+0x2a03): undefined reference to `fmod' > /usr/lib/python2.4/config/libpython2.4.a(dynload_shlib.o): In function > `_PyImport_GetDynLoadFunc': > (.text+0x12e): undefined reference to `dlsym' > /usr/lib/python2.4/config/libpython2.4.a(dynload_shlib.o): In function > `_PyImport_GetDynLoadFunc': > (.text+0x195): undefined reference to `dlopen' > /usr/lib/python2.4/config/libpython2.4.a(dynload_shlib.o): In function > `_PyImport_GetDynLoadFunc': > (.text+0x1c3): undefined reference to `dlsym' > /usr/lib/python2.4/config/libpython2.4.a(dynload_shlib.o): In function > `_PyImport_GetDynLoadFunc': > (.text+0x232): undefined reference to `dlerror' > /usr/lib/python2.4/config/libpython2.4.a(thread.o): In function > `PyThread_release_lock': > (.text+0x49): undefined reference to `sem_post' > /usr/lib/python2.4/config/libpython2.4.a(thread.o): In function > `PyThread_acquire_lock': > (.text+0xc7): undefined reference to `sem_wait' > /usr/lib/python2.4/config/libpython2.4.a(thread.o): In function > `PyThread_acquire_lock': > (.text+0xe2): undefined reference to `sem_trywait' > /usr/lib/python2.4/config/libpython2.4.a(thread.o): In function > `PyThread_free_lock': > (.text+0x1f2): undefined reference to `sem_destroy' > /usr/lib/python2.4/config/libpython2.4.a(thread.o): In function > `PyThread_allocate_lock': > (.text+0x267): undefined reference to `sem_init' > /usr/lib/python2.4/config/libpython2.4.a(thread.o): In function > `PyThread_start_new_thread': > (.text+0x568): undefined reference to `pthread_create' > /usr/lib/python2.4/config/libpython2.4.a(thread.o): In function > `PyThread_start_new_thread': > (.text+0x586): undefined reference to `pthread_detach' > /usr/lib/python2.4/config/libpython2.4.a(posixmodule.o): In function > `posix_forkpty': > (.text+0x3189): undefined reference to `forkpty' > /usr/lib/python2.4/config/libpython2.4.a(posixmodule.o): In function > `posix_openpty': > (.text+0x3218): undefined reference to `openpty' > collect2: ld returned 1 exit status > > As you can see, all unresolved symbols revolve around symbols from > those other libraries - the symbol looked for (PyArg_ParseTuple) is not > among them. A sketched out partial fix for this might be --- a/tools/m4/python_devel.m4 +++ b/tools/m4/python_devel.m4 @@ -2,17 +2,18 @@ AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [ ac_previous_cppflags=$CPPFLAGS CPPFLAGS="$CFLAGS `$PYTHON-config --includes`" ac_previous_ldflags=$LDFLAGS +python_other_libs= for flag in `$PYTHON-config --ldflags` do case $flag in -L*) - LDFLAGS="$LDLFAGS $flag" + LDFLAGS="$LDFLAGS $flag" ;; -lpython*) python_lib=`echo $flag | sed 's/^-l//'` ;; -l*) - # Ignore other libraries, we are only interested in testing python-dev + python_other_libs="$python_other_libs $flag" ;; *) AC_MSG_WARN([Strange ldflag found in $PYTHON-config output: $flag]) @@ -22,7 +23,8 @@ done AC_CHECK_HEADER([Python.h], [], [AC_MSG_ERROR([Unable to find Python development headers])],) AC_CHECK_LIB($python_lib, PyArg_ParseTuple, [], - [AC_MSG_ERROR([Unable to find a suitable python development library])]) + [AC_MSG_ERROR([Unable to find a suitable python development library])], + [$python_other_libs]) CPPFLAGS=$ac_previous_cppflags LDLFAGS=$ac_previous_ldflags ]) I didn't really re-generate tools/configure though (not sure what autoconf version would be required, and surely this wouldn't match the ones I have around), so can't claim this is syntactically correct. For my purposes I instead patched tools/configure manually. Partial because it doesn't address the lack of python-config on pre-2.5 Python (we require >= 2.3). I also wonder whether the -lpython* case shouldn't be cumulative in case there's more than one matching option. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |