ch32-pio-projects icon indicating copy to clipboard operation
ch32-pio-projects copied to clipboard

ch32v103c8t6 upload failed on macOS

Open Ali201409 opened this issue 1 year ago • 4 comments

Program is compiled successfully. when I tried to upload firmware, I got following message: dyld[1034]: Library not loaded: /usr/local/opt/libusb/lib/libusb-1.0.0.dylib Referenced from: /Users/chenli/.platformio/packages/tool-openocd-riscv-wch/bin/openocd Reason: tried: '/usr/local/opt/libusb/lib/libusb-1.0.0.dylib' (code signature in <04015360-D1D9-313C-87B0-05F7AC278738> '/usr/local/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), '/usr/lib/libusb-1.0.0.dylib' (no such file), '/usr/local/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' (code signature in <04015360-D1D9-313C-87B0-05F7AC278738> '/usr/local/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.), '/usr/lib/libusb-1.0.0.dylib' (no such file)

Then I installed libusb through brew, but could not resolve it. Can anybody provide some suggestions ? Thanks!

Ali201409 avatar Apr 28 '24 05:04 Ali201409

'/usr/local/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed

Ok then sign it

https://stackoverflow.com/a/73844905

maxgerhardt avatar Apr 28 '24 09:04 maxgerhardt

@maxgerhardt Thanks for your reply. I tried following commands: codesign -s /usr/local/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib error: The specified item could not be found in the keychain.

codesign -s /usr/local/opt/libusb/lib/libusb-1.0.0.dylib
error: The specified item could not be found in the keychain.

It seems that it has other problem. My macOS version is 12.4.

Ali201409 avatar Apr 29 '24 01:04 Ali201409

Hi guys, I'm having a similar issue on my Mac M3:

Configuring upload protocol...
AVAILABLE: isp, minichlink, wch-link, wlink
CURRENT: upload_protocol = wch-link
Uploading .pio/build/genericCH32V003F4P6/firmware.elf
dyld[69669]: Library not loaded: /opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib
  Referenced from: <6BBF79F9-C1A5-38BD-85E2-6A75FB8D03BD> /Users/andersnelson/.platformio/packages/tool-openocd-riscv-wch/bin/openocd
  Reason: tried: '/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib' (code signature in <8DD5BDC1-E490-325E-957C-BDD4B75715C8> '/opt/homebrew/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib' (no such file), '/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib' (code signature in <8DD5BDC1-E490-325E-957C-BDD4B75715C8> '/opt/homebrew/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/usr/lib/libusb-1.0.0.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' (code signature in <8DD5BDC1-E490-325E-957C-BDD4B75715C8> '/opt/homebrew/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' (no such file), '/opt/homebrew/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' (code signature in <8DD5BDC1-E490-325E-957C-BDD4B75715C8> '/opt/homebrew/Cellar/libusb/1.0.27/lib/libusb-1.0.0.dylib' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/usr/lib/libusb-1.0.0.dylib' (no such file, not in dyld cache)
*** [upload] Error -6

I don't want to mess up my Homebrew libusb library, anything I can try to get past this? Thanks!

ufanders avatar Aug 15 '24 16:08 ufanders

:( I don't have a Mac so I'm not sure what else to do besides googling and giving suggestions. This Mac stuff haunts me. Why are they enforcing code signatures this badly?

maxgerhardt avatar Aug 16 '24 11:08 maxgerhardt