Skip to content

Compiling udev with hwdb support #1377

@tuna-f1sh

Description

@tuna-f1sh

Checklist

Describe your issue

I'm trying to compile a project (cyme) with udev and the 'hwdb' feature.

The project fails to compile when using cross ... --target aarch64-unknown-linux-gnu due to libudev-sys not including the ffi for hwdb because it can't find/call the udev_hwdb_* functions: 'udev-rs' then fails to compile due to this with the 'hwdb' feature enabled: Smithay/udev-rs#23

See https://github.com/tuna-f1sh/cyme/actions/runs/6906556985/job/18791852745 for failing build output. I can fix this with a 'udev_hwdb' feature but I'm wondering if it's possible to achieve this cross build and why cross fails to call that method. It works fine for the native container cross ... --target x86_64-unknown-linux-gnu.

Note that it's not due the to pkg-config setup referenced in the libudev-sys README: I've checked with docker run --rm -it cross-custom-cyme:aarch64-unknown-linux-gnu-5888d-pre-build /bin/bash that:

root@f143beadd080:/# pkg-config libudev --libs
-L/usr/lib/aarch64-linux-gnu -ludev

Also tried even installing udev:aarch64 and that:

root@f320c17fc73d:/# file $(which systemd-hwdb)
/bin/systemd-hwdb: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=14e1a4d9b7e17a494602e355a120f4f2dd9529f4, stripped

I've made a project to reproduce this issue: https://github.com/tuna-f1sh/cross-udev-hwdb

I'm using colima with a colima start --profile amd64 --cpu 4 --memory 8 --arch amd64 VM locally but the shared action shows this fails on Linux with docker so I've ticked that too.

Is it simply because libudev-sys is trying to call a aarch64 lib in the x86_64 container and so not really fixable without changes to that lib?

What target(s) are you cross-compiling for?

aarch64-unknown-linux-gnu

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.5

Example

Checkout: https://github.com/tuna-f1sh/cross-udev-hwdb

cross build --locked --release --all-features --target=aarch64-unknown-linux-gnu --target-dir build

Additional information / notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions