All of lore.kernel.org
 help / color / mirror / Atom feed
* OT: determining in `Makefile.in` the Python version/path
@ 2011-01-09 21:07 Paul Menzel
  2011-01-09 22:17 ` Andreas Oberritter
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Menzel @ 2011-01-09 21:07 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 1791 bytes --]

Dear OE folks,


when compiling XBMC for the ARM architecture it hard codes Python 2.5
[1] and a patch in the OE repository changes this to Python 2.6 [2].

I tried to use `python-config` to determine the Python version [3].

        ifeq (arm, $(ARCH))
        -# Force external python2.5 for now!
        -LIBS +=-lpython2.5
        +# Force external Python for now!
        +LIBS += $(shell python-config --libs)
         endif

This fails with the following error though documented in `log.do_compile`.

        Traceback (most recent call last):
          File "/oe/build/angstrom-dev/sysroots/i686-linux/usr/bin/python-config", line 6, in <module>
            from distutils import sysconfig
          File "/oe/build/angstrom-dev/sysroots/i686-linux/usr/lib/python2.6/distutils/sysconfig.py", line 22, in <module>
            PREFIX = os.path.normpath(sys.prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )

Do you know of an easy way to fix this with just adapting `Makefile.in`?
Or is using a separate variable as `PYTHON_LIBS` [4] the only option
besides hard coding and patching?

        ifeq (arm, $(ARCH))
         # Force external Python for now!
        -LIBS += $(shell python-config --libs)
        +PYTHON_LIBS ?= $(shell python-config --libs)
        +LIBS += $(PYTHON_LIBS)
         endif


Thanks,

Paul


[1] https://github.com/xbmc/xbmc/#L470
[2] http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/xbmc/xbmc/0006-Hardcode-python2.6-for-now.patch?id=0cc02ded7bd429208ccb0e0e0aa3e43aec8a4722
[3] http://trac.xbmc.org/ticket/11041 (Please notice the updated patch where `($` is changed to `$(`.)
[4] http://trac.xbmc.org/ticket/11042 (Please notice the updated patch where `($` is changed to `$(`.)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: OT: determining in `Makefile.in` the Python version/path
  2011-01-09 21:07 OT: determining in `Makefile.in` the Python version/path Paul Menzel
@ 2011-01-09 22:17 ` Andreas Oberritter
  2011-01-10 10:46   ` Paul Menzel
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Oberritter @ 2011-01-09 22:17 UTC (permalink / raw)
  To: openembedded-devel

On 01/09/2011 10:07 PM, Paul Menzel wrote:
> I tried to use `python-config` to determine the Python version [3].
> 
>         ifeq (arm, $(ARCH))
>         -# Force external python2.5 for now!
>         -LIBS +=-lpython2.5
>         +# Force external Python for now!
>         +LIBS += $(shell python-config --libs)
>          endif
> 
> This fails with the following error though documented in `log.do_compile`.
> 
>         Traceback (most recent call last):
>           File "/oe/build/angstrom-dev/sysroots/i686-linux/usr/bin/python-config", line 6, in <module>
>             from distutils import sysconfig
>           File "/oe/build/angstrom-dev/sysroots/i686-linux/usr/lib/python2.6/distutils/sysconfig.py", line 22, in <module>
>             PREFIX = os.path.normpath(sys.prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
> 

For OE's Python, you need to set some variables in your recipe, e.g.:

EXTRA_OECONF = " \
        BUILD_SYS=${BUILD_SYS} \
        HOST_SYS=${HOST_SYS} \
        STAGING_INCDIR=${STAGING_INCDIR} \
        STAGING_LIBDIR=${STAGING_LIBDIR} \
"

Regards,
Andreas



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: OT: determining in `Makefile.in` the Python version/path
  2011-01-09 22:17 ` Andreas Oberritter
@ 2011-01-10 10:46   ` Paul Menzel
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Menzel @ 2011-01-10 10:46 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 3800 bytes --]

Am Sonntag, den 09.01.2011, 23:17 +0100 schrieb Andreas Oberritter:
> On 01/09/2011 10:07 PM, Paul Menzel wrote:
> > I tried to use `python-config` to determine the Python version [3].
> > 
> >         ifeq (arm, $(ARCH))
> >         -# Force external python2.5 for now!
> >         -LIBS +=-lpython2.5
> >         +# Force external Python for now!
> >         +LIBS += $(shell python-config --libs)
> >          endif
> > 
> > This fails with the following error though documented in `log.do_compile`.
> > 
> >         Traceback (most recent call last):
> >           File "/oe/build/angstrom-dev/sysroots/i686-linux/usr/bin/python-config", line 6, in <module>
> >             from distutils import sysconfig
> >           File "/oe/build/angstrom-dev/sysroots/i686-linux/usr/lib/python2.6/distutils/sysconfig.py", line 22, in <module>
> >             PREFIX = os.path.normpath(sys.prefix).replace( os.getenv("BUILD_SYS"), os.getenv("HOST_SYS") )
> > 
> 
> For OE's Python, you need to set some variables in your recipe, e.g.:
> 
> EXTRA_OECONF = " \
>         BUILD_SYS=${BUILD_SYS} \
>         HOST_SYS=${HOST_SYS} \
>         STAGING_INCDIR=${STAGING_INCDIR} \
>         STAGING_LIBDIR=${STAGING_LIBDIR} \
> "

Andreas, thank you very much. At first it did not work and I got the
same error. Then I tried to put it into `EXTRA_OEMAKE`, since the error
was during task `compile`. That did not work either and I got the same
error again.

With a manual test recipe (attached, `git am --scissors`) manually
running

	python-config --libs

worked, so I think the problem is, that the environment variables are
not passed to the shell(?) opened by `$(shell …)`.

Searching for `'BUILD_SYS=${BUILD_SYS}'` through the repository I found
that sometimes those variables are exported and tried the following

        do_configure_prepend() {
               export BUILD_SYS=${BUILD_SYS}
               export HOST_SYS=${HOST_SYS}
               export STAGING_INCDIR=${STAGING_INCDIR}
               export STAGING_LIBDIR=${STAGING_LIBDIR}
        }
        
        […]
        
        do_compile_prepend() {
               export BUILD_SYS=${BUILD_SYS}
               export HOST_SYS=${HOST_SYS}
               export STAGING_INCDIR=${STAGING_INCDIR}
               export STAGING_LIBDIR=${STAGING_LIBDIR}
        }

which seems to work. Is that the right explanation and is there an
easier way to do this?


Thanks,

Paul

8<-------------------------------------------------------------------->8
From dbf2af72601e5998af0d3cc0f0dc4abcc5d4fa6e Mon Sep 17 00:00:00 2001
From: Paul Menzel <paulepanter@users.sourceforge.net>
Date: Mon, 10 Jan 2011 11:00:45 +0100
Subject: [PATCH] test-python-config: add test program for `python-config`

http://lists.linuxtogo.org/pipermail/openembedded-devel/2011-January/028563.html

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
---
 recipes/helloworld/test-python-config_1.0.0.bb |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
 create mode 100644 recipes/helloworld/test-python-config_1.0.0.bb

diff --git a/recipes/helloworld/test-python-config_1.0.0.bb b/recipes/helloworld/test-python-config_1.0.0.bb
new file mode 100644
index 0000000..89c89e9
--- /dev/null
+++ b/recipes/helloworld/test-python-config_1.0.0.bb
@@ -0,0 +1,18 @@
+DESCRIPTION = "run `python-config --libs`"
+LICENSE = "GPLv3"
+PR = "r0"
+DEPENDS = "python"
+
+S = "${WORKDIR}/${P}"
+
+do_fetch () {
+	mkdir -p ${WORKDIR}/${P}
+	cd ${WORKDIR}/${P}
+}
+
+do_compile () {
+	BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} STAGING_INCDIR=${STAGING_INCDIR} STAGING_LIBDIR=${STAGING_LIBDIR} python-config --libs
+}
+
+do_install () {
+}
-- 
1.7.2.3

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-10 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-09 21:07 OT: determining in `Makefile.in` the Python version/path Paul Menzel
2011-01-09 22:17 ` Andreas Oberritter
2011-01-10 10:46   ` Paul Menzel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.