nLabs-nScope / nLab

GNU General Public License v3.0
9 stars 2 forks source link

nscope does not connect on intel mac #66

Closed ndm736 closed 4 months ago

ndm736 commented 4 months ago

USB looks good:

Screen Shot 2024-07-09 at 10 52 24 PM Screen Shot 2024-07-09 at 10 52 37 PM

App stays at "Starting nScope"

Screen Shot 2024-07-09 at 10 52 46 PM
davidjmeyer commented 4 months ago

What version of nScope is running here?

davidjmeyer commented 4 months ago

Recent builds from the GitHub CI runners are showing the opposite behavior, where arm64 machines are freezing, but intel machines are working properly. After adding the logging contained in this PR, I was able to find the following error message:

Library not loaded: /opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib
  Referenced from: <CF8B4CAA-6B27-31CC-84F9-8FC8975EF09E> /Applications/nScope.app/Contents/Resources/app.asar.unpacked/app/nscope.node
  Reason: tried: '/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib' (code signature in <F37A1D17-4528-3DD6-B2EA-A49339F798C7> '/opt/homebrew/Cellar/libusb/1.0.26/lib/libusb-1.0.0.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)

We shouldn't be needing to load libusb from a system library, so I'm confused here. I used otool -L to list all library dependencies, and found that the arm64 version had a dependency on libusb, but the x86_64 version didn't.

So I checked the shipping version of nScope and found the exact opposite: the arm64 version doesn't require libusb, but the x86_64 version does... 🤔

My theory here is that the GitHub CI machine recently switched architectures from x86_64 to arm64, and that switched an installed version of libusb as well. Perhaps rusb is vendoring libusb when it cannot find it, but simply linking against it when it can find it. That'd explain why Intel Macs cannot load the shipping version of nScope, and my Apple Silicon Mac cannot load the most recently built versions.

This theory is further evidenced by https://github.com/a1ien/rusb/pull/13