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

Is libusb used on macos? if so, how to statically link it? #6

Closed
naps62 opened this issue Nov 20, 2023 · 1 comment · Fixed by #7
Closed

Is libusb used on macos? if so, how to statically link it? #6

naps62 opened this issue Nov 20, 2023 · 1 comment · Fixed by #7

Comments

@naps62
Copy link

naps62 commented Nov 20, 2023

I'm having trouble using this crate (or rather, ethers-rs ledger support which depends on summa-tx/coins, which depends on this)

I'm compiling a cross-platform binary (windows, linux, macos), and the macos binary fails to run because it is dynamically linked to libusb.

Now, I don't know much about USB itself. from studying this crate's code, my interpretation is that macos only uses libhidapi.a, and libusb is only used for linux & illumos.

so I'd guess the problem is that macos is unnecessarily linking to libusb.
It could also be that it does indeed use it, in which case I'd like to find a way to statically link it, which probably involves a chance in this crate

Would appreciate any pointers. happy to do the heavy lifting myself

dep tree on a macos build:
image

runtime crash:
image

@naps62
Copy link
Author

naps62 commented Nov 23, 2023

Was investigating this further
seems to only happen when building through github actions

as can be seen here: https://github.com/naps62/test-macos-usb-ledger/actions/runs/6973993949

the artifact from that build is a binary that is dynamically linked against libusb.
running the same build on a local macos VM produces a different result (no linking to libusb)

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

Successfully merging a pull request may close this issue.

1 participant