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

Add ability to select libusb commit for built-in libusb #79

Closed
Cu3PO42 opened this issue Jul 18, 2021 · 3 comments
Closed

Add ability to select libusb commit for built-in libusb #79

Cu3PO42 opened this issue Jul 18, 2021 · 3 comments

Comments

@Cu3PO42
Copy link
Contributor

Cu3PO42 commented Jul 18, 2021

Hi,

first of all: thanks for your work on rusb! I'm quite excited to use it in a project. Unfortunately, I ran into these issues in libusb 1.0.24. As of current master, they appear to have been fixed, but no new release has been made yet. I understand that it's not desirable to ship a non-release libusb in a release libusb1-sys, but maybe this problem could be tackled by adding a generic way to select any commit of libusb that should be built.

I am currently not clear on how such a selection mechanism should work. A commit could be passed as an environment variable but that's not very ergonomic. If we can figure out a clean design, I'd be happy to send a pull request. One potential option would be to rely on rust-lang/cargo#9175, which has landed earlier this year, is now available as part of Rust stable, and allows a user to set environment variables in a .cargo/config.toml. This file can be configured per project, so it should provide a satisfactory solution.

EDIT: I have an experimental implementation of this at Cu3PO42/rusb. The primary issue remaining with this is the lack of a proper version string for the commit. I'm not sure what it's used for so I don't know if just using the commit would be fine.

@a1ien
Copy link
Owner

a1ien commented Jul 29, 2021

I think if you want use different version use with rusb it's build this version with /configure --prefix=<path_to_install>, run make install and use PKG_CONFIG_PATH=<path_to_install>/lib/pkgconfig for set place for search when run cargo build

@Cu3PO42
Copy link
Contributor Author

Cu3PO42 commented Aug 21, 2021

I appreciate you getting back to me on this. Unfortunately I had to step away from that particular project for a while. I'm now back at it.

The way you describe should work, but would be mildly painful to execute, especially on Windows. libusb1-sys already provides such a great tool for building libusb cross-platform! I think it would be great if it would be possible to re-use that. With my commit, the following workflow is possible:

  1. A project depends on libusb1-sys, either directly or indirectly through rusb.
  2. The user sets LIBUSB_COMMIT=1a906274a66dd58bf81836db1306902d4a7dc185 in .cargo/config.toml.
  3. Upon building, the specified commit of libusb will be fetched and built.

I think that is quite useful and if you're open to that functionality, I'm happy to send a PR. If you'd rather not include that, I will simply maintain this in a fork.

@a1ien
Copy link
Owner

a1ien commented Sep 2, 2021

This won't work because we upload only one version of libusb submodule to crates.io
And I against of downloading library while in build process. When build.rs was called all code mus be available and not download from internet. So as I say if you want different version build, build it you self.

@a1ien a1ien closed this as completed Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants