Hacker News new | ask | show | jobs
by ValdikSS 38 days ago
It is not exactly well documented, dpkg-buildpackage (debhelper) has cross-compilation wrappers for autoconf, cmake, qmake, meson, ninja, ant, perl/python, maven, gradle, bmake, golang, probably others.

Here'a s quick start for a C++ application compilation with libncurses6 and libtinfo6 dependencies as an example. `apt build-dep` will install armhf library dependencies and native other build dependencies.

    # Adding armhf architecture support to existing system
    dpkg --add-architecture armhf
    apt update
    # Installing cross-compiler for armhf
    apt install crossbuild-essential-armhf

    mkdir nload; cd nload
    apt source nload
    cd nload-0.7.4

    # Download build dependencies for nload package, for armhf
    apt build-dep -aarmhf nload
    apt install libstdc++6:armhf # build-dep misses this one

    # Cross-compiling for armhf, get .deb package for armhf
    dpkg-buildpackage -a armhf -Pcross
That's it. You get nload_0.7.4-2_armhf.deb without the need to compile libtinfo6, libncurses6 armhf first.

Here's all manual process which involves tinkering with your running system, but there are 'proper' compilation tools like sbuild which bootstrap the (container) OS, configure it for cross-compiling, and do all the required steps from a clear start, with just a `sbuild --host=armhf` call more or less.

1 comments

Thanks for the detailed explanation!