[Libreoffice] Robert Nagy: Problems with your python library patch
Robert Nagy
robert at openbsd.org
Wed Apr 20 02:40:22 PDT 2011
On (2011-04-20 10:14), Michael Meeks wrote:
> Hi Andreas,
>
> On Wed, 2011-04-20 at 09:52 +0200, Andreas Becker wrote:
> > Really not.
> > The reason is, that the old version does not always work:
> > For me, print(distutils.sysconfig.get_config_var('VERSION')); prints
> > "3.2", but the library is libpython3.2mu.so.
> ..
> > The absolute path in my patch is always the right one and I do not
> > know any disadvantages of an absolute path.
>
> Clearly, random different linux's can put python in random different
> places [ oh, the joys of anarchy ]. No idea how well an absolute path
> works with LD_LIBRARY_PATH either.
>
> So - in general, surely it is better not to hard-code the paths of the
> libraries if at all possible.
>
> Can we get more detail on cases where it doesn't work ?
>
> ATB,
>
> Michael.
>
> --
> michael.meeks at novell.com <><, Pseudo Engineer, itinerant idiot
>
>
Andreas,
This should make python3 work too. What it basically does
is that it gets the correct library name from the python binary
itself and uses that to link.
diff --git a/configure.in b/configure.in
index 470aa39..430a7da 100755
--- a/configure.in
+++ b/configure.in
@@ -1344,6 +1344,11 @@ if test -z "$GNUTAR"; then
fi
AC_SUBST(GNUTAR)
+AC_PATH_PROG(OBJDUMP, objdump)
+if test -z "$OBJDUMP"; then
+ AC_MSG_ERROR([objdump not found but needed. Install it.])
+fi
+
dnl ===================================================================
dnl Checks for --with-local-solenv invocation
dnl TODO: Is this still required?
@@ -4108,11 +4113,11 @@ elif test -n "$with_system_python" -o -n "$with_system_libs" && \
AM_PATH_PYTHON([2.2])
python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
- python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
+ python_lib=`$OBJDUMP -p $PYTHON | ${SED} -n 's/.*\libpython\(.*\).so.*/python\1/p'`
python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
PYTHON_CFLAGS="-I$python_include"
- PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
+ PYTHON_LIBS="-L$python_libdir -l$python_lib $python_libs"
fi
if test "$with_system_python" = "yes" ; then
SYSTEM_PYTHON=YES
More information about the LibreOffice
mailing list