[Buildroot] Building cargo with per-package directories

Thomas Petazzoni thomas.petazzoni at bootlin.com
Tue Dec 11 16:12:52 UTC 2018


Hello Éric,

As you probably know, I'm working on support for per-package
directories, which will allow to do top-level parallel in a reliable
way. As part of this effort, I've started an autobuilder that uses
per-package directories, and one of the package that is failing a lot
is host-cargo.

It fails like this:

  = note: /usr/bin/ld: cannot find -lhttp_parser
          collect2: error: ld returned 1 exit status
          
error: aborting due to previous error
error: Could not compile `cargo`.

The problem is that while libhttp_parser gets built properly, cargo is
not passing the appropriate -L flag to cargo's per-package host/lib
directory. So the linker doesn't find the libhttp_parser library, and
bails out.

I've tried to look into this, but really the cargo build system is very
unique and weird, and I'm having a hard time finding my way. Do you
think you could help me a bit on this topic ?

To reproduce, you need a machine where libhttp_parser is not installed
system-wide (so either remove it from your system, or build in a
chroot/docker/VM). Then, take this branch:

  https://git.bootlin.com/users/thomas-petazzoni/buildroot/log/?h=ppsh-v7-work

And build the following defconfig:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-cortex-a9-glibc-2018.05.tar.bz2"
BR2_TOOLCHAIN_EXTERNAL_GCC_7=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_16=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_CARGO=y

You should get this failure:

  http://code.bulix.org/fxjgrv-520980?raw

Thanks in advance for your support,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


More information about the buildroot mailing list