Cross compilation with debuild

Loïc Minier loic.minier at
Tue Aug 24 18:25:08 BST 2010

 So I gave a try to cross-compiling gstreamer0.10 and it some
 interesting issues.

 First, I used an i386 chroot instead of an amd64 chroot since I thought
 that might help a bit with package names; I'm not actually sure that
 was needed, but it might influence results.

 Second, here is how I ran xdeb:
    % xdeb -a armel --apt-source --only-explicit gstreamer0.10

 The first thing which failed here are downloads of biarch libraries for
 cross import.
   Currently, xdeb imports binary packages source package by source
 package (native_import() acts on a source package), and checks for all
 binary packages of the source package whether they are visible on the
 build architecture with "apt-cache show <package name>".  However a
 bunch of packages are architecture-specific, so this might miss
 packages which are only available on the host architecture, and not on
 the build architecture, and this might try downloading packages which
 are only available for the build architecture, and hence might fail.
   The proper fix is to have xdeb look at an APT cache for the build
 architecture rather than the host one, and filter based on that.  This
 is LP #616617.
   However I found a workaround by not caring about biarch:
 - I changed is_crossable() to return False for packages with "lib32"
   and "lib64"
 - I changed native_import() to skip (don't download) packages which
   aren't crossable -- these weren't imported anyway!

 This got me to the point where I could install build-deps, I probably
 fiddled with the blacklist a bit too (I listed gir1.0-glib-2.0 IIRC).

 Next, the gstreamer0.10 cross-build started but promptly failed trying
 to link to libxml2; this was the PKG_CONFIG_LIBDIR issue you mentioned.
 I added:
    buildpackage.append('-ePKG_CONFIG_LIBDIR=/usr/%s/lib/pkgconfig' % deb_host_gnu_type)

 This is LP #623478 which you filed.

 Interestingly, the build broke because it couldn't find gtk-doc
 anymore; I didn't add /usr/share/pkgconfig, but it does show that host
 versus build pkg-config dependencies are a problem, and we need a
 $triplet-pkg-config to solve this!

 So I patched the gstreamer build to turn off docs; I think
 gstreamer0.10 should --disable-gtk-doc when cross-compiling; in fact,
 this should be done in gtk-doc upstream.

 This got quite far in the build:
make[4]: Entering directory `/home/lool/gstreamer0.10/gstreamer0.10/gst'
libtool: link: arm-linux-gnueabi-ranlib .libs/libgstreamer-0.10.a
libtool: link: rm -fr .libs/libgstreamer-0.10.lax
libtool: link: ( cd ".libs" && rm -f "" && ln -s "../" "" )
/usr/bin/g-ir-scanner -v --namespace Gst \
                --nsversion=0.10 \
                -I.. \
                -I.. \
                -DIN_GOBJECT_INTROSPECTION=1 \
                --c-include='gst/gst.h' \
                --include=GLib-2.0 \
                --include=GObject-2.0 \
                --include=GModule-2.0 \
                --include=libxml2-2.0 \
                --libtool="../libtool" \
                --pkg glib-2.0 \
                --pkg gobject-2.0 \
                --pkg gmodule-no-export-2.0 \
                --pkg gthread-2.0 \
                --pkg libxml-2.0 \
                --output Gst-0.10.gir \
                ./gst.h ./glib-compat.h ./gstobject.h ./gstbin.h ./gstbuffer.h ./gstbufferlist.h ./gstbus.h ./gstcaps.h ./gstchildproxy.h ./gstclock.h ./gstcompat.h ./gstdebugutils.h ./gstelement.h ./gstelementfactory.h ./gsterror.h ./gstevent.h ./gstfilter.h ./gstformat.h ./gstghostpad.h ./gstindex.h ./gstindexfactory.h ./gstinfo.h ./gstinterface.h ./gstiterator.h ./gstmacros.h ./gstmessage.h ./gstminiobject.h ./gstpad.h ./gstpadtemplate.h ./gstparamspecs.h ./gstpipeline.h ./gstplugin.h ./gstpluginfeature.h ./gstpoll.h ./gstpreset.h ./gstquery.h ./gstsegment.h ./gststructure.h ./gstsystemclock.h ./gsttaglist.h ./gsttagsetter.h ./gsttask.h ./gsttaskpool.h ./gsttrace.h ./gsttypefind.h ./gsttypefindfactory.h ./gsturi.h ./gstutils.h ./gstvalue.h ./gstregistry.h ./gstparse.h ./gstxml.h \
                ./gst.c ./gstobject.c ./gstbin.c ./gstbuffer.c ./gstbufferlist.c ./gstbus.c ./gstcaps.c ./gstchildproxy.c ./gstclock.c ./gstdebugutils.c ./gstelement.c ./gstelementfactory.c ./gsterror.c ./gstevent.c ./gstfilter.c ./gstformat.c ./gstghostpad.c ./gstindex.c ./gstindexfactory.c ./gstinfo.c ./gstinterface.c ./gstiterator.c ./gstmessage.c ./gstminiobject.c ./gstpad.c ./gstpadtemplate.c ./gstparamspecs.c ./gstpipeline.c ./gstplugin.c ./gstpluginfeature.c ./gstpluginloader.c ./gstpoll.c ./gstpreset.c ./gstquark.c ./gstquery.c ./gstregistry.c ./gstregistrychunks.c ./gstsegment.c ./gststructure.c ./gstsystemclock.c ./gsttaglist.c ./gsttagsetter.c ./gsttask.c ./gsttaskpool.c ./gsttrace.c ./gsttypefind.c ./gsttypefindfactory.c ./gsturi.c ./gstutils.c ./gstvalue.c ./gstparse.c ./gstregistrybinary.c ./gstxml.c
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/bin/ld: warning:, needed by ./.libs/, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/arm-linux-gnueabi/4.4.5/../../../../arm-linux-gnueabi/bin/ld: warning:, needed by ./.libs/, not found (try using -rpath or -rpath-link)
Traceback (most recent call last):
  File "/usr/bin/g-ir-scanner", line 38, in <module>
  File "/usr/lib/gobject-introspection/giscanner/", line 330, in scanner_main
  File "/usr/lib/gobject-introspection/giscanner/", line 246, in compile_introspection_binary
  File "/usr/lib/gobject-introspection/giscanner/", line 132, in run
    self._link(bin_path, o_path)
  File "/usr/lib/gobject-introspection/giscanner/", line 241, in _link
  File "/usr/lib/python2.6/", line 488, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['../libtool', '--mode=link', '--tag=CC', '--silent', 'arm-linux-gnueabi-gcc', '-o', '/home/lool/gstreamer0.10/gstreamer0.10/gst/tmp-introspectOGdeJg/Gst-0.10', '-g', '-O2', '-g', '-Wall', '-O2', '-Wno-error', '-L.', '-Wl,--export-dynamic', '-pthread', '-L/usr/arm-linux-gnueabi/lib', '-lgirepository-1.0', '-lgobject-2.0', '-lgmodule-2.0', '-lffi', '-lgthread-2.0', '-lrt', '-lglib-2.0', '', '-pthread', '-Wl,--export-dynamic', '-L/usr/arm-linux-gnueabi/lib', '-lgio-2.0', '-lgirepository-1.0', '-lgobject-2.0', '-lgmodule-2.0', '-lffi', '-lgthread-2.0', '-lrt', '-lglib-2.0', '/home/lool/gstreamer0.10/gstreamer0.10/gst/tmp-introspectOGdeJg/Gst-0.10.o']' returned non-zero exit status 1
make[5]: *** [Gst-0.10.gir] Error 1
make[5]: Leaving directory `/home/lool/gstreamer0.10/gstreamer0.10/gst'

 So the issue is that g-ir-scanner is broken for cross-builds.

 I stopped looking into it at this point

Loïc Minier

More information about the Linaro-dev mailing list