cross compiling, pc files and `PKG_CONFIG_SYSROOT_DIR`

Paul Menzel paulepanter at users.sourceforge.net
Fri Apr 1 02:22:14 PDT 2011


Dear pkg-config folks,


trying to build `python-pygtksourceview_2.10.1.bb` [1] I have the
following problem.

        $ more docs/Makefile.am
        […]
        HTML_STYLE = $(PYGOBJECT_DATADIR)/pygobject/xsl/ref-html-style.xsl
        […]
        build_stamp: $(REFERENCE_DEPS)reference/builddate.xml
        	xsltproc --nonet --xinclude -o $(BUILDDIR)/html/ \
        		 --path $(BUILDDIR)/reference:$(srcdir)/reference \
        		 --stringparam gtkdoc.bookname "pygtksourceview2" \
        		 --stringparam gtkdoc.version ${REF_VERSION} \
        		 $(HTML_STYLE) $(srcdir)/reference/gtksourceview2-ref.xml
        	$(PYGOBJECT_FIXXREF) -i $(PYGOBJECT_PYGDOCS) $(BUILDDIR)/html 
        	touch $@
        […]

        $ more configure.ac
        […]
        PYGOBJECT_DATADIR=`$PKG_CONFIG --variable=datadir pygobject-2.0`
        AC_SUBST(PYGOBJECT_DATADIR)
        […]

This results in the following error

        xsltproc --nonet --xinclude -o ../docs/html/ \
                         --path ../docs/reference:./reference \
                         --stringparam gtkdoc.bookname "pygtksourceview2" \
                         --stringparam gtkdoc.version . \
                         /usr/share/pygobject/xsl/ref-html-style.xsl ./reference/gtksourceview2-ref.xml
        warning: failed to load external entity "/usr/share/pygobject/xsl/ref-html-style.xsl"
        cannot parse /usr/share/pygobject/xsl/ref-html-style.xsl
        make[2]: *** [build_stamp] Error 4

because `pygobject-2.0.pc` [2] has the following content.

        $ ls angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib/pkgconfig/pygobject-2.0.pc 
        angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib/pkgconfig/pygobject-2.0.pc
        $ more angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/lib/pkgconfig/pygobject-2.0.pc
        prefix=/usr
        exec_prefix=/usr
        includedir=/usr/include
        datarootdir=${prefix}/share
        datadir=/usr/share
        libdir=/usr/lib
        
        # you can use the --variable=pygtkincludedir argument to
        # pkg-config to get this value.  You might want to use this to
        # install additional headers.
        pygtkincludedir=${includedir}/pygtk-2.0
        fixxref=${datadir}/pygobject/xsl/fixxref.py
        pygdocs=${datadir}/gtk-doc/html/pygobject
        defsdir=${datadir}/pygobject/2.0/defs
        codegendir=${datadir}/pygobject/2.0/codegen
        
        Name: PyGObject
        Description: Python bindings for GObject
        Requires: gobject-2.0
        Requires.private: libffi
        Version: 2.20.0
        Cflags: -I${pygtkincludedir}

So it is `datadir=/usr/share` but for cross compiling it should be `${PKG_CONFIG_SYSROOT_DIR}/usr/share`.

        $ ls angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/pygobject/xsl/ref-html-style.xsl 
        angstrom-dev/sysroots/armv7a-angstrom-linux-gnueabi/usr/share/pygobject/xsl/ref-html-style.xsl

So what is the rationale that the environment variable
`PKG_CONFIG_SYSROOT_DIR` does not apply to all pkg-config variables?

        $ man pkg-config
        […]
               PKG_CONFIG_SYSROOT_DIR
                      Modify  -I  and -L to use the directories located in target sys‐
                      root.  this option is useful when  crosscompiling  package  that
                      use  pkg-config  to  determine CFLAGS anf LDFLAGS. -I and -L are
                      modified to point to the new system  root.  this  means  that  a
                      -I/usr/include/libfoo will become -I/var/target/usr/include/lib‐
                      foo with a PKG_CONFIG_SYSROOT_DIR  equal  to  /var/target  (same
                      rule apply to -L)
        […]

So I see three solutions.

1. Modify all variables with `PKG_CONFIG_SYSROOT_DIR`.
2. Modify the build files directly in the build frame work.

A way to do that upstream would be best so that all build frame works
could benefit from it.

Please tell me what the recommended way is.


Thanks,

Paul


[1] http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/python/python-pygtksourceview_2.10.1.bb?id=0ec6685f5276cc93a84f979bebbe536cd01e8316
[2] http://git.gnome.org/browse/pygobject/tree/pygobject-2.0.pc.in?id=08af5f99f0838b3584f6a3b210d0a0304811e8ff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/pkg-config/attachments/20110401/5a770bb9/attachment.pgp>


More information about the pkg-config mailing list