[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Cross compiling with interpreter extension library



I'm trying to learn how cross building is supposed to work and have run
into something I just can't figure out.

I'm trying to build 'altos' for arm64 using pbuilder on amd64. I created
my cross pbuilder environment using:

        $ sudo cowbuilder create \
             --basepath /var/cache/pbuilder/base-cross.cow \
             --debootstrap mmdebstrap \
             --debootstrapopts --architectures=amd64,arm64 \
             --debootstrapopts --skip=output/dev \
             --debootstrapopts --variant=buildd \
             --debootstrapopts --include=ca-certificates

All of my package building is done using this command:

        $ GIT_PBUILDER_OPTIONS="--host-arch=arm64 --basepath=/var/cache/pbuilder/base-cross.cow" gbp buildpackage

The set of packages involved are:

 • altos. The test package to cross-build

 • cairo-5c. A nickle extension module

 • libcairo-5c0. The binary library used by cairo-5c

 • libcairo2. The cairo library wrapped by libcairo-5c0

 • libcairo2-dev. The developer bits for libcairo2.

 • nickle. The nickle interpreter language.

 • picolibc-arm-none-eabi. The embedded C library used to create
   firmware images flashed to various devices with ARM Cortex-M socs.

Version 2.104 of the nickle package builds in this cross-build
environment. That version also added 'Multi-Arch: allowed' to the binary
package control fields. Nickle is built with -Wl,-E so that its symbols
will be visible to any module shared library pulled in at runtime with
dlopen, but it is installed in /usr/bin.

libcairo2 and libcairo2-dev already set 'Architecture: any' and
'Multi-Arch: same', so I think they should be all set.

The cairo-5c package contains nickle scripts and docs and depends upon
the libcairo-5c0 package which contains the shared library binary which
links to the underlying libraries including libcairo2.

altos uses nickle with the cairo-5c extension to perform some build-time
graphics operations. Eventually, I think the correct solution will be to
set the build-time dependencies to 'nickle:native' and 'cairo-5c:native'
so that we don't run the arm64 version under qemu, but I want to figure
out how to make the arm64 version work before I do that.

picolibc-arm-none-eabi contains static libraries and headers for
building embedded firmware for ARM microcontrollers, so it is marked
'Architecture: all'. I just uploaded version 1.8.10-3 which adds
'Multi-Arch: foreign'.

*** QUESTION NUMBER 1 ***

When working on cairo-5c, why did I have to add :native to the
Build-Depends: value for libcairo2-dev and ttf-bitstream-vera: in order
to get it to build successfully?

        Source: cairo-5c
        Section: libs
        Priority: optional
        Maintainer: Keith Packard <keithp@keithp.com>
        Rules-Requires-Root: no
        Standards-Version: 4.5.0
        Build-Depends: debhelper-compat (= 12), debhelper (>= 12), libcairo2-dev:native, librsvg2-dev,
         nickle:any (>= 2.73), libx11-dev (>= 2:1.4.99.901), libfreetype6-dev,
         ttf-bitstream-vera:native

If I remove the :native annotations from the Build-Depends field, when cross-building, I get this error:

        The following packages have unmet dependencies:
         builddeps:/build/cairo-5c_1.22.dsc:arm64 : Depends: libcairo2-dev:arm64 but it is not going to be installed
                                                    Depends: librsvg2-dev:arm64 but it is not going to be installed
                                                    Depends: ttf-bitstream-vera:arm64 but it is not installable

*** QUESTION NUMBER 2 ***

When building altos, which depends upon cairo-5c and nickle, why is the
amd64 version of the libcairo-5c0 package installed rather than the
arm64 version? When building the package, I get this error:

        nickle led.5c redoff.svg
        Unhandled exception open_error ("libcairo-5c.so.0: cannot open shared object file: No such file or directory", 25, "libcairo-5c.so.0")
        /usr/share/nickle/cairo.5c:39:     Foreign::load ("libcairo-5c.so.0");
        /usr/share/nickle/builtin.5c:137: non-existant namespace Cairo

That's because we only have the amd64 version of libcairo-5c0 and not
the arm64 version:

        $ dpkg -l libcairo-5c0
        Desired=Unknown/Install/Remove/Purge/Hold
        | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
        |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
        ||/ Name               Version      Architecture Description
        +++-==================-============-============-=================================
        ii  libcairo-5c0:amd64 1.22         amd64        library for cairo nickle bindings

Installing the arm64 version of the library manually solves the problem.

*** QUESTION NUMBER 3 ***

Also when building altos, why did I have to add :native to the
Build-Depends: value for picolibc-arm-none-eabi? Without that, when
cross-building, I get this error:

        The following packages have unmet dependencies:
         builddeps:/build/altos_1.9.22-2.dsc:arm64 : Depends: picolibc-arm-none-eabi:arm64

picolibc is marked 'Architecture: all', 'Multi-Arch: foreign', so
why is it looking for an arm64 specific version?

-- 
-keith

Attachment: signature.asc
Description: PGP signature


Reply to: