Closed mcuee closed 1 year ago
Similar problem for other programmers using hidapi.
mcuee@mcuees-Mac-mini avrdude_bin % ./avrdude_git -c xplainedpro_updi -p t817 -t
zsh: segmentation fault ./avrdude_git -c xplainedpro_updi -p t817 -t
mcuee@mcuees-Mac-mini avrdude_bin % lldb ./avrdude_git
(lldb) target create "./avrdude_git"
Current executable set to '/Users/mcuee/build/avr/avrdude_test/avrdude_bin/avrdude_git' (arm64).
(lldb) run -c xplainedpro_updi -p t817 -t
Process 7576 launched: '/Users/mcuee/build/avr/avrdude_test/avrdude_bin/avrdude_git' (arm64)
Process 7576 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x16)
frame #0: 0x00000001001b7200 libhidapi.0.dylib`set_report + 28
libhidapi.0.dylib`set_report:
-> 0x1001b7200 <+28>: ldr w8, [x0, #0x14]
0x1001b7204 <+32>: cbz w8, 0x1001b7210 ; <+44>
0x1001b7208 <+36>: mov w8, #-0x1
0x1001b720c <+40>: b 0x1001b7238 ; <+84>
Target 0: (avrdude_git) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x16)
* frame #0: 0x00000001001b7200 libhidapi.0.dylib`set_report + 28
frame #1: 0x000000010006f164 avrdude_git`usbhid_open(port=<unavailable>, pinfo=<unavailable>, fd=<unavailable>) at usb_hidapi.c:168:5 [opt]
frame #2: 0x0000000100043040 avrdude_git`jtag3_open_common(pgm=0x000000010082b000, port="usb") at jtag3.c:1472:10 [opt]
frame #3: 0x0000000100047ddc avrdude_git`jtag3_open_updi(pgm=0x000000010082b000, port="usb") at jtag3.c:1594:7 [opt]
frame #4: 0x0000000100006a4c avrdude_git`main(argc=<unavailable>, argv=<unavailable>) at main.c:1121:8 [opt]
frame #5: 0x000000018f787e50 dyld`start + 2544
(lldb) quit
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] Y
The output from otool looks suspcicious because of libhid.
mcuee@mcuees-Mac-mini avrdude_bin % otool -L ../avrdude-macos-x86_64/avrdude
../avrdude-macos-x86_64/avrdude:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
/usr/local/opt/libusb/lib/libusb-1.0.0.dylib (compatibility version 4.0.0, current version 4.0.0)
/usr/local/opt/hidapi/lib/libhidapi.0.dylib (compatibility version 0.0.0, current version 0.12.0)
/usr/local/opt/libftdi/lib/libftdi1.2.dylib (compatibility version 2.0.0, current version 2.5.0)
/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
mcuee@mcuees-Mac-mini avrdude_bin % otool -L ./avrdude_git
./avrdude_git:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
/opt/homebrew/opt/libusb-compat/lib/libusb-0.1.4.dylib (compatibility version 9.0.0, current version 9.4.0)
/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib (compatibility version 4.0.0, current version 4.0.0)
/opt/homebrew/opt/libhid/lib/libhid.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/homebrew/opt/hidapi/lib/libhidapi.0.dylib (compatibility version 0.0.0, current version 0.12.0)
/opt/homebrew/opt/libftdi0/lib/libftdi.1.dylib (compatibility version 22.0.0, current version 22.0.0)
/opt/homebrew/opt/libftdi/lib/libftdi1.2.dylib (compatibility version 2.0.0, current version 2.5.0)
/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
Looks like a lingering old homebrew avrdude formular problem.
mcuee@mcuees-Mac-mini avrdude_bin % brew info libhid
==> libhid: stable 0.2.16 (bottled)
Library to access and interact with USB HID devices
https://directory.fsf.org/wiki/Libhid
Deprecated because it is not maintained upstream!
/opt/homebrew/Cellar/libhid/0.2.16 (18 files, 305.5KB) *
Poured from bottle on 2021-03-27 at 12:35:31
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libhid.rb
License: GPL-2.0
==> Dependencies
Build: autoconf ✔, automake ✔, libtool ✔
Required: libusb ✔, libusb-compat ✔
==> Analytics
install: 40 (30 days), 148 (90 days), 8,312 (365 days)
install-on-request: 35 (30 days), 111 (90 days), 386 (365 days)
build-error: 0 (30 days)
mcuee@mcuees-Mac-mini avrdude_bin % brew remove libhid
Error: Refusing to uninstall /opt/homebrew/Cellar/libhid/0.2.16
because it is required by avrdude, which is currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies libhid
mcuee@mcuees-Mac-mini avrdude_bin % brew uninstall --ignore-dependencies libhid
Uninstalling /opt/homebrew/Cellar/libhid/0.2.16... (18 files, 305.5KB)
mcuee@mcuees-Mac-mini avrdude_bin % brew remove avrdude
Uninstalling /opt/homebrew/Cellar/avrdude/HEAD-159d126_2... (13 files, 2MB)
avrdude 7.0_2 is still installed.
To remove all versions, run:
brew uninstall --force avrdude
Warning: The following may be avrdude configuration files and have not been removed!
If desired, remove them manually with `rm -rf`:
/opt/homebrew/etc/avrdude.conf
/opt/homebrew/etc/avrdude.conf.default
mcuee@mcuees-Mac-mini avrdude_bin % rm /opt/homebrew/etc/avrdude.conf
mcuee@mcuees-Mac-mini avrdude_bin % rm /opt/homebrew/etc/avrdude.conf.default
mcuee@mcuees-Mac-mini avrdude_bin % brew uninstall avrdude
Uninstalling /opt/homebrew/Cellar/avrdude/7.0_2... (9 files, 2.4MB)
mcuee@mcuees-Mac-mini avrdude_bin % brew install avrdude
==> Fetching avrdude
==> Downloading https://ghcr.io/v2/homebrew/core/avrdude/manifests/7.0_2
Already downloaded: /Users/mcuee/Library/Caches/Homebrew/downloads/78e02371cdcf49288c566045a40106818630bc2b0dece52d714fcde190b75788--avrdude-7.0_2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/avrdude/blobs/sha256:50c20fe810d534c1c4cea3209ca812d35167c4b51e140f7154d96
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:50c20fe810d534c1c4cea3209ca812d35167c4
######################################################################## 100.0%
==> Pouring avrdude--7.0_2.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/avrdude/7.0_2: 9 files, 2.4MB
==> Running `brew cleanup avrdude`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
mcuee@mcuees-Mac-mini avrdude_bin % brew unlink avrdude
Unlinking /opt/homebrew/Cellar/avrdude/7.0_2... 6 symlinks removed.
mcuee@mcuees-Mac-mini avrdude_bin % brew install avrdude --HEAD
==> Fetching avrdude
==> Cloning https://github.com/avrdudes/avrdude.git
Updating /Users/mcuee/Library/Caches/Homebrew/avrdude--git
==> Checking out branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at 159d126 Update NEWS
==> cmake -S . -B build/shared -DCMAKE_INSTALL_SYSCONFDIR=/opt/homebrew/etc -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_RPATH=@l
==> cmake --build build/shared
==> cmake --install build/shared
==> cmake -S . -B build/static -DCMAKE_INSTALL_SYSCONFDIR=/opt/homebrew/etc
==> cmake --build build/static
🍺 /opt/homebrew/Cellar/avrdude/HEAD-159d126_2: 13 files, 2MB, built in 7 seconds
==> Running `brew cleanup avrdude`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/mcuee/Library/Caches/Homebrew/avrdude--7.0_2... (776.7KB)
mcuee@mcuees-Mac-mini avrdude_bin % brew info libhid
==> libhid: stable 0.2.16 (bottled)
Library to access and interact with USB HID devices
https://directory.fsf.org/wiki/Libhid
Deprecated because it is not maintained upstream!
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libhid.rb
License: GPL-2.0
==> Dependencies
Build: autoconf ✔, automake ✔, libtool ✔
Required: libusb ✔, libusb-compat ✔
==> Analytics
install: 40 (30 days), 148 (90 days), 8,312 (365 days)
install-on-request: 35 (30 days), 111 (90 days), 386 (365 days)
build-error: 0 (30 days)
After the clean-up and rebuild, everything is fine now.
mcuee@mcuees-Mac-mini avrdude_bin % otool -L ./avrdude_git
./avrdude_git:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
/opt/homebrew/opt/libusb-compat/lib/libusb-0.1.4.dylib (compatibility version 9.0.0, current version 9.4.0)
/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib (compatibility version 4.0.0, current version 4.0.0)
/opt/homebrew/opt/hidapi/lib/libhidapi.0.dylib (compatibility version 0.0.0, current version 0.12.0)
/opt/homebrew/opt/libftdi0/lib/libftdi.1.dylib (compatibility version 22.0.0, current version 22.0.0)
/opt/homebrew/opt/libftdi/lib/libftdi1.2.dylib (compatibility version 2.0.0, current version 2.5.0)
/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
mcuee@mcuees-Mac-mini avrdude_bin % ./avrdude_git -c xplainedpro_updi -p t817 -qqt
avrdude> dump fuses
0000 00 00 02 ff 00 c4 04 00 02 |......... |
avrdude> quit
avrdude> %
I will need to debug further why this happened. It may have something to do with my paticular system and not avrdude.
From here:
But github action git main binary is okay. Strange.