Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] libusb cross-compiling #9773

Open
steffenhk opened this issue Mar 14, 2022 · 4 comments
Open

[question] libusb cross-compiling #9773

steffenhk opened this issue Mar 14, 2022 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@steffenhk
Copy link

I'm cross-building libusb for ARM using a Yocto generated SDK toolchain which provides the libudev I want to use, but the validate method in the libusb recipe does not allow cross-compiling when "enable_udev" is True.

Why is it that cross-compiling should raise an error?
https://github.com/conan-io/conan-center-index/blob/master/recipes/libusb/all/conanfile.py#L65

Since I am cross-compiling Linux:x86_64 to Linux:armv8 it worked before (when I used the "CONAN_SYSREQUIRES_MODE=disabled" env variable), but after this pull-request #7940 that no longer works, and from the comments on that pull-request it seems like that was the intention all along.

@steffenhk steffenhk added the question Further information is requested label Mar 14, 2022
@uilianries
Copy link
Member

Hello @steffenhk !

Really good to know that someone is using Yocto with Conan!

We can not use system package tools in CCI recipes, instead, we need to separate them as packages. More info https://github.com/conan-io/conan-center-index/blob/master/docs/faqs.md#can-i-install-packages-from-the-system-package-manager

The libusb is old, and was outdated, now it consumed libudev from system. As you should know, libudev is hard to build separated from systemd. As it's a system library, it will not install to the target arch (maybe yes, depending the distribution and support), then, makes no sense supporting cross-building.

The current change is listed here: 066ea9c

But your case is different, Yocto SDK can solve libudev as dependency directly in your configuration, so you don't need to use Conan. I think a possible fix is removing that statement, making possible to cross-build libusb, but insert the condition on libudev system package, so when disabling its installation, it should not break your build.

As possible workaround, I suggest you using lockfiles, so you can use the past revision, which did not have this breaking change.

@steffenhk
Copy link
Author

Thank you @uilianries for the quick answer.

I will look into using lockfiles, to use the previous revision, as a first step.

I would prefer not to have to make my own variant of the libusb conanfile.

I'm still not sure I understand why it is necessary to raise that error when cross-compiling.
Seen from my perspective it would make sense for libusb recipe to just have a dependency on "libudev/system" (like it has).
The libudev recipe is then responsible for installing or making sure that the libudev system packages are installed in the system, in whatever way it can.

I guess my question is why is it the responsibility of the consuming recipe (e.g. libusb) to determine if we are cross-compiling and whether dependencies (e.g. libudev) support that?

I hope my question makes sense :)

@uilianries
Copy link
Member

Your question makes sense. Like I said, it needs a recipe update, meanwhile, you can use lockfiles.

@uilianries
Copy link
Member

@steffenhk I created the PR #9780, where those limitations are no longer managed by libusb. They should be moved to libudev package instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants