Community-PIO-CH32V / ch32-pio-projects

W.CH CH32 RISC-V Projects using PlatformIO
50 stars 8 forks source link

ch32v103c8t6 upload failed on macOS #7

Open Ali201409 opened 7 months ago

Ali201409 commented 7 months ago

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!

maxgerhardt commented 7 months ago

'/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

Ali201409 commented 7 months ago

@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.

ufanders commented 3 months ago

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!

maxgerhardt commented 3 months ago

:( 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?