Open
Description
Hi 👋
I'm experiencing this issue on macOS Big Sur when libusb1-sys crate's build.rs
invokes pkg-config
and gets this:
$ pkg-config --static --libs /usr/local/Cellar/libusb/1.0.26/lib/pkgconfig/libusb-1.0.pc
-L/usr/local/Cellar/libusb/1.0.26/lib -lusb-1.0 -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security
rustc seems then proceed to try to link libobjc
:
$ [...] cargo build
Compiling libusb1-sys v0.6.2 (/Users/adaszko/repos/rusb/libusb1-sys)
Compiling rusb v0.9.1
error: could not find native static library `objc`, perhaps an -L flag is missing?
This issue is preventing me from building a statically linked libusb1-sys. Linking itself should still work, it's just that rustc's erroring out prevents the pipeline from getting to the linking step AFAICT.
EDIT: Sorry, I've removed a misleading points about dynamic linking stemming from my misunderstanding of the issue.
Activity
Fix issue rust-lang#96943
cc
, and pass it viaSDKROOT
env var #131477madsmtm commentedon Oct 10, 2024
I suspect this may have been caused by not properly passing the macOS SDK to the linker, which will be fixed by #131477.
In the meantime, could you try doing
xcrun cargo build
, to ensure thatSDKROOT
is set?adaszko commentedon Oct 10, 2024
Sorry, I'm no longer working on this (it's been a while) so won't be able to test it. Unless someone else is affected I think the issue can be closed.