Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DragonFly BSD support #1656

Closed
mcuee opened this issue Feb 3, 2024 · 9 comments
Closed

DragonFly BSD support #1656

mcuee opened this issue Feb 3, 2024 · 9 comments
Labels
enhancement New feature or request

Comments

@mcuee
Copy link
Collaborator

mcuee commented Feb 3, 2024

There is a patch from DragonFly BSD to support avrdude 7.1 with ther DPorts system.

https://github.com/DragonFlyBSD/DPorts/tree/master/devel/avrdude

--- CMakeLists.txt.orig	2023-01-08 21:28:14 UTC
+++ CMakeLists.txt
@@ -159,7 +159,7 @@ if(HAVE_LIBUSB_1_0)
 endif()
 
 # FreeBSD's library 'libusb' supports both the libusb-0.1 and libusb-1.0 API.
-if (HAVE_LIBUSB AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+if (HAVE_LIBUSB AND CMAKE_SYSTEM_NAME MATCHES "FreeBSD|DragonFly")
     set(HAVE_LIBUSB_1_0 ${HAVE_LIBUSB})
 endif()

This patch makes sense. However, even with the patch, I still have issues building avrdude under DragonFly BSD, after installation of the dependencies. It would be good to fix this.

mcuee@dragonfly622vm:~/build/avrdude % git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bde9304b..58735422 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,7 +163,7 @@ if(HAVE_LIBUSB_1_0)
 endif()

 # FreeBSD's library 'libusb' supports both the libusb-0.1 and libusb-1.0 API.
-if (HAVE_LIBUSB AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+if (HAVE_LIBUSB AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD|DragonFly")
     set(HAVE_LIBUSB_1_0 ${HAVE_LIBUSB})
 endif()

mcuee@dragonfly622vm:~/build/avrdude % ./build.sh
-- The C compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/local/bin/git (found version "2.35.2")
-- Found FLEX: /usr/bin/flex (found version "2.6.4")
-- Found BISON: /usr/local/bin/bison (found version "3.8.2")
-- Looking for libelf.h
-- Looking for libelf.h - not found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - not found
-- Looking for usb.h
-- Looking for usb.h - found
-- Looking for lusb0_usb.h
-- Looking for lusb0_usb.h - not found
-- Looking for libusb.h
-- Looking for libusb.h - found
-- Looking for libusb-1.0/libusb.h
-- Looking for libusb-1.0/libusb.h - not found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - not found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - not found
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DON'T HAVE libusb_1_0
-- DO HAVE    libhidapi
-- DO HAVE    libftdi (but prefer to use libftdi1)
-- DO HAVE    libftdi1
-- DO HAVE    libreadline
-- DO HAVE    libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mcuee/build/avrdude/build_dragonfly
[  1%] Generating avrdude.conf
[  1%] Built target conf
[  2%] [BISON][Parser] Building parser with bison 3.8.2
[  3%] [FLEX][Parser] Building scanner with flex 2.6.4
[  5%] Building C object src/CMakeFiles/libavrdude.dir/arduino.c.o
[  6%] Building C object src/CMakeFiles/libavrdude.dir/avr.c.o
[  7%] Building C object src/CMakeFiles/libavrdude.dir/avr910.c.o
[  9%] Building C object src/CMakeFiles/libavrdude.dir/avrcache.c.o
[ 10%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi.c.o
In file included from /home/mcuee/build/avrdude/src/avrftdi.c:42:
/home/mcuee/build/avrdude/src/avrftdi_private.h:16:10: fatal error: ftdi.h: No such file or directory
 #include <ftdi.h>
          ^~~~~~~~
compilation terminated.
*** Error code 1

Stop.
make[2]: stopped in /home/mcuee/build/avrdude/build_dragonfly
*** Error code 1

Stop.
make[1]: stopped in /home/mcuee/build/avrdude/build_dragonfly
*** Error code 1

Stop.
make: stopped in /home/mcuee/build/avrdude/build_dragonfly
Build failed.
@mcuee mcuee added the enhancement New feature or request label Feb 3, 2024
@mcuee
Copy link
Collaborator Author

mcuee commented Feb 3, 2024

The problem seems to be related to the detection of libusb-1.0 which causes issue with libftdi.

-- DON'T HAVE libusb_1_0

@mcuee
Copy link
Collaborator Author

mcuee commented Feb 3, 2024

I will try out DragonFly BSD 6.4 version later.

Anyway, this should not block avrdude 7.3 release.

@mcuee
Copy link
Collaborator Author

mcuee commented Feb 3, 2024

Dragon BSD 6.2.2 comes with avrdude 7.0. It does not seem to support HIDAPI. And of course there is no libserialport support in avrdude 7.0 version.

mcuee@dragonfly622vm:~ % avrdude
Usage: avrdude [options]
Options:
  -p <partno>                Required. Specify AVR device.
  -b <baudrate>              Override RS-232 baud rate.
  -B <bitclock>              Specify JTAG/STK500v2 bit clock period (us).
  -C <config-file>           Specify location of configuration file.
  -c <programmer>            Specify programmer type.
  -D                         Disable auto erase for flash memory
  -i <delay>                 ISP Clock Delay [in microseconds]
  -P <port>                  Specify connection port.
  -F                         Override invalid signature check.
  -e                         Perform a chip erase.
  -O                         Perform RC oscillator calibration (see AVR053).
  -U <memtype>:r|w|v:<filename>[:format]
                             Memory operation specification.
                             Multiple -U options are allowed, each request
                             is performed in the order specified.
  -n                         Do not write anything to the device.
  -V                         Do not verify.
  -t                         Enter terminal mode.
  -E <exitspec>[,<exitspec>] List programmer exit specifications.
  -x <extended_param>        Pass <extended_param> to programmer.
  -v                         Verbose output. -v -v for more.
  -q                         Quell progress output. -q -q for less.
  -l logfile                 Use logfile rather than stderr for diagnostics.
  -?                         Display this usage.

avrdude version 7.0, URL: <https://github.com/avrdudes/avrdude>

mcuee@dragonfly622vm:~ % ldd /usr/local/bin/avrdude
/usr/local/bin/avrdude:
        libm.so.4 => /lib/libm.so.4 (0x8006cf000)
        libusb.so.2 => /usr/lib/libusb.so.2 (0x8008fa000)
        libftdi1.so.2 => /usr/local/lib/libftdi1.so.2 (0x8004c2000)
        libreadline.so.8 => /usr/local/lib/libreadline.so.8 (0x8004d0000)
        libc.so.8 => /lib/libc.so.8 (0x800b0c000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x800e69000)
        libncurses.so.6 => /usr/local/lib/libncurses.so.6 (0x800527000)
        libtinfo.so.6 => /usr/local/lib/libtinfo.so.6 (0x800562000)

@mcuee
Copy link
Collaborator Author

mcuee commented Feb 3, 2024

Interestingly I have no issues building avrdude git main under DragonFly BSD 6.4 version (latest release). However the version does not seem to be correct. I will try again later.

libftdi support wil still not work due to the detection issue of libusb-1.0.

mcuee@dragonflybsdvm:~/build/avrdude % ./build.sh
-- The C compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/local/bin/git (found version "2.41.0")
-- Found FLEX: /usr/bin/flex (found version "2.6.4")
-- Found BISON: /usr/local/bin/bison (found version "3.8.2")
-- Looking for libelf.h
-- Looking for libelf.h - not found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - not found
-- Looking for usb.h
-- Looking for usb.h - found
-- Looking for lusb0_usb.h
-- Looking for lusb0_usb.h - not found
-- Looking for libusb.h
-- Looking for libusb.h - found
-- Looking for libusb-1.0/libusb.h
-- Looking for libusb-1.0/libusb.h - not found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - not found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - not found
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DON'T HAVE libusb_1_0
-- DO HAVE    libhidapi
-- DO HAVE    libftdi (but prefer to use libftdi1)
-- DO HAVE    libftdi1
-- DO HAVE    libreadline
-- DO HAVE    libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done (0.8s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/avrdude/build_dragonfly
[  1%] Generating avrdude.conf
[  1%] Built target conf
[  2%] [FLEX][Parser] Building scanner with flex 2.6.4
[  3%] [BISON][Parser] Building parser with bison 3.8.2
[  5%] Building C object src/CMakeFiles/libavrdude.dir/arduino.c.o
[  6%] Building C object src/CMakeFiles/libavrdude.dir/avr.c.o
[  7%] Building C object src/CMakeFiles/libavrdude.dir/avr910.c.o
[  9%] Building C object src/CMakeFiles/libavrdude.dir/avrcache.c.o
[ 10%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi.c.o
In file included from /home/mcuee/build/avrdude/src/avrftdi.c:42:
/home/mcuee/build/avrdude/src/avrftdi_private.h:22:2: warning: #warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again. [-Wcpp]
 #warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
  ^~~~~~~
[ 11%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o
In file included from /home/mcuee/build/avrdude/src/avrftdi_tpi.c:14:
/home/mcuee/build/avrdude/src/avrftdi_private.h:22:2: warning: #warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again. [-Wcpp]
 #warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
  ^~~~~~~
[ 13%] Building C object src/CMakeFiles/libavrdude.dir/avrintel.c.o
[ 14%] Building C object src/CMakeFiles/libavrdude.dir/avrpart.c.o
[ 15%] Building C object src/CMakeFiles/libavrdude.dir/bitbang.c.o
[ 17%] Building C object src/CMakeFiles/libavrdude.dir/buspirate.c.o
[ 18%] Building C object src/CMakeFiles/libavrdude.dir/butterfly.c.o
[ 19%] Building C object src/CMakeFiles/libavrdude.dir/ch341a.c.o
[ 21%] Building C object src/CMakeFiles/libavrdude.dir/config.c.o
[ 22%] Building C object src/CMakeFiles/libavrdude.dir/confwin.c.o
[ 23%] Building C object src/CMakeFiles/libavrdude.dir/crc16.c.o
[ 25%] Building C object src/CMakeFiles/libavrdude.dir/dfu.c.o
[ 26%] Building C object src/CMakeFiles/libavrdude.dir/dryrun.c.o
[ 27%] Building C object src/CMakeFiles/libavrdude.dir/fileio.c.o
[ 28%] Building C object src/CMakeFiles/libavrdude.dir/flip1.c.o
[ 30%] Building C object src/CMakeFiles/libavrdude.dir/flip2.c.o
[ 31%] Building C object src/CMakeFiles/libavrdude.dir/ft245r.c.o
/home/mcuee/build/avrdude/src/ft245r.c:89:2: warning: #warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again. [-Wcpp]
 #warning No libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
  ^~~~~~~
[ 32%] Building C object src/CMakeFiles/libavrdude.dir/jtagmkI.c.o
[ 34%] Building C object src/CMakeFiles/libavrdude.dir/jtagmkII.c.o
[ 35%] Building C object src/CMakeFiles/libavrdude.dir/jtag3.c.o
[ 36%] Building C object src/CMakeFiles/libavrdude.dir/leds.c.o
[ 38%] Building C object src/CMakeFiles/libavrdude.dir/linuxgpio.c.o
[ 39%] Building C object src/CMakeFiles/libavrdude.dir/linuxspi.c.o
[ 40%] Building C object src/CMakeFiles/libavrdude.dir/lists.c.o
[ 42%] Building C object src/CMakeFiles/libavrdude.dir/micronucleus.c.o
[ 43%] Building C object src/CMakeFiles/libavrdude.dir/par.c.o
[ 44%] Building C object src/CMakeFiles/libavrdude.dir/pgm.c.o
[ 46%] Building C object src/CMakeFiles/libavrdude.dir/pgm_type.c.o
[ 47%] Building C object src/CMakeFiles/libavrdude.dir/pickit2.c.o
[ 48%] Building C object src/CMakeFiles/libavrdude.dir/pindefs.c.o
[ 50%] Building C object src/CMakeFiles/libavrdude.dir/ppi.c.o
[ 51%] Building C object src/CMakeFiles/libavrdude.dir/ppiwin.c.o
[ 52%] Building C object src/CMakeFiles/libavrdude.dir/serbb_posix.c.o
[ 53%] Building C object src/CMakeFiles/libavrdude.dir/serbb_win32.c.o
[ 55%] Building C object src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.o
[ 56%] Building C object src/CMakeFiles/libavrdude.dir/ser_posix.c.o
[ 57%] Building C object src/CMakeFiles/libavrdude.dir/ser_win32.c.o
[ 59%] Building C object src/CMakeFiles/libavrdude.dir/serialadapter.c.o
[ 60%] Building C object src/CMakeFiles/libavrdude.dir/serialupdi.c.o
[ 61%] Building C object src/CMakeFiles/libavrdude.dir/stk500.c.o
[ 63%] Building C object src/CMakeFiles/libavrdude.dir/stk500v2.c.o
[ 64%] Building C object src/CMakeFiles/libavrdude.dir/stk500generic.c.o
[ 65%] Building C object src/CMakeFiles/libavrdude.dir/strutil.c.o
[ 67%] Building C object src/CMakeFiles/libavrdude.dir/teensy.c.o
[ 68%] Building C object src/CMakeFiles/libavrdude.dir/term.c.o
[ 69%] Building C object src/CMakeFiles/libavrdude.dir/updi_link.c.o
[ 71%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm.c.o
[ 72%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v0.c.o
[ 73%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v2.c.o
[ 75%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v3.c.o
[ 76%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v4.c.o
[ 77%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v5.c.o
[ 78%] Building C object src/CMakeFiles/libavrdude.dir/updi_readwrite.c.o
[ 80%] Building C object src/CMakeFiles/libavrdude.dir/updi_state.c.o
[ 81%] Building C object src/CMakeFiles/libavrdude.dir/urclock.c.o
[ 82%] Building C object src/CMakeFiles/libavrdude.dir/usbasp.c.o
[ 84%] Building C object src/CMakeFiles/libavrdude.dir/usb_hidapi.c.o
[ 85%] Building C object src/CMakeFiles/libavrdude.dir/usb_libusb.c.o
[ 86%] Building C object src/CMakeFiles/libavrdude.dir/usbtiny.c.o
[ 88%] Building C object src/CMakeFiles/libavrdude.dir/update.c.o
[ 89%] Building C object src/CMakeFiles/libavrdude.dir/wiring.c.o
[ 90%] Building C object src/CMakeFiles/libavrdude.dir/xbee.c.o
[ 92%] Building C object src/CMakeFiles/libavrdude.dir/__/lexer.c.o
[ 93%] Building C object src/CMakeFiles/libavrdude.dir/__/config_gram.c.o
[ 94%] Linking C static library libavrdude.a
[ 94%] Built target libavrdude
[ 96%] Building C object src/CMakeFiles/avrdude.dir/main.c.o
[ 97%] Building C object src/CMakeFiles/avrdude.dir/developer_opts.c.o
[ 98%] Building C object src/CMakeFiles/avrdude.dir/whereami.c.o
[100%] Linking C executable avrdude
[100%] Built target avrdude

Build succeeded.

Run

sudo cmake --build build_dragonfly --target install

to install.

mcuee@dragonflybsdvm:~/build/avrdude % git diff
mcuee@dragonflybsdvm:~/build/avrdude % sudo cmake --build build_dragonfly --target install
Password:
[  1%] Built target conf
[ 94%] Built target libavrdude
[100%] Built target avrdude
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/bin/avrdude
-- Set runtime path of "/usr/local/bin/avrdude" to ""
-- Installing: /usr/local/lib/libavrdude.a
-- Installing: /usr/local/include/libavrdude.h
-- Installing: /usr/local/etc/avrdude.conf
-- Installing: /usr/local/share/man/man1/avrdude.1
mcuee@dragonflybsdvm:~/build/avrdude % avrdude
Usage: avrdude [options]
Options:
  -p <partno>            Specify AVR device; -p ? lists all known parts
  -p <wildcard>/<flags>  Run developer options for matched AVR devices,
                         e.g., -p ATmega328P/s or /S for part definition
  -b <baudrate>          Override RS-232 baud rate
  -B <bitclock>          Specify bit clock period (us)
  -C <config-file>       Specify location of configuration file
  -C +<config-file>      Specify additional config file, can be repeated
  -N                     Do not load config file
  -c <programmer>        Specify programmer; -c ? and -c ?type list all
  -c <wildcard>/<flags>  Run developer options for matched programmers,
                         e.g., -c 'ur*'/s for programmer info/definition
  -A                     Disable trailing-0xff removal for file/AVR read
  -D                     Disable auto erase for flash memory; implies -A
  -i <delay>             ISP Clock Delay [in microseconds]
  -P <port>              Connection; -P ?s or -P ?sa lists serial ones
  -r                     Reconnect to -P port after "touching" it; wait
                         400 ms for each -r; needed for some USB boards
  -F                     Override invalid signature or initial checks
  -e                     Perform a chip erase
  -O                     Perform RC oscillator calibration (see AVR053)
  -t                     Run an interactive terminal when it is its turn
  -T <terminal cmd line> Run terminal line when it is its turn
  -U <memstr>:r|w|v:<filename>[:format]
                         Carry out memory operation when it is its turn
                         Multiple -t, -T and -U options can be specified
  -n                     Do not write to the device whilst processing -U
  -V                     Do not automatically verify during -U
  -E <exitsp>[,<exitsp>] List programmer exit specifications
  -x <extended_param>    Pass <extended_param> to programmer, see -xhelp
  -v                     Verbose output; -v -v for more
  -q                     Quell progress output; -q -q for less
  -l logfile             Use logfile rather than stderr for diagnostics
  -?                     Display this usage

avrdude version 7.2-20230720, https://github.com/avrdudes/avrdude

mcuee@dragonflybsdvm:~/build/avrdude % head /usr/local/etc/avrdude.conf
# $Id$ -*- text -*-
#
# AVRDUDE Configuration File
#

avrdude_conf_version = "7.2-20240201 (571a8063)";

# This file contains AVRDUDE's default configuration data describing
# programming hardware pinouts and part definitions. Normally, it
# requires AVRDUDE be of the same or higher version than above string

@mcuee
Copy link
Collaborator Author

mcuee commented Feb 3, 2024

Hmm, I can not get it build with a fresh git checkout.

mcuee@dragonflybsdvm:~/build % git clone https://github.com/avrdudes/avrdude.git
Cloning into 'avrdude'...
remote: Enumerating objects: 19848, done.
remote: Counting objects: 100% (343/343), done.
remote: Compressing objects: 100% (187/187), done.
remote: Total 19848 (delta 182), reused 302 (delta 154), pack-reused 19505
Receiving objects: 100% (19848/19848), 11.59 MiB | 15.14 MiB/s, done.
Resolving deltas: 100% (14307/14307), done.
mcuee@dragonflybsdvm:~/build % cd avrdude
mcuee@dragonflybsdvm:~/build/avrdude % ./build.sh
-- The C compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/local/bin/git (found version "2.41.0")
-- Found FLEX: /usr/bin/flex (found version "2.6.4")
-- Found BISON: /usr/local/bin/bison (found version "3.8.2")
-- Looking for libelf.h
-- Looking for libelf.h - not found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - not found
-- Looking for usb.h
-- Looking for usb.h - found
-- Looking for lusb0_usb.h
-- Looking for lusb0_usb.h - not found
-- Looking for libusb.h
-- Looking for libusb.h - found
-- Looking for libusb-1.0/libusb.h
-- Looking for libusb-1.0/libusb.h - not found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - not found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - not found
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DON'T HAVE libusb_1_0
-- DO HAVE    libhidapi
-- DO HAVE    libftdi (but prefer to use libftdi1)
-- DO HAVE    libftdi1
-- DO HAVE    libreadline
-- DO HAVE    libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done (0.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/avrdude/build_dragonfly
[  1%] Generating avrdude.conf
[  1%] Built target conf
[  2%] [FLEX][Parser] Building scanner with flex 2.6.4
[  3%] [BISON][Parser] Building parser with bison 3.8.2
[  5%] Building C object src/CMakeFiles/libavrdude.dir/arduino.c.o
[  6%] Building C object src/CMakeFiles/libavrdude.dir/avr.c.o
[  7%] Building C object src/CMakeFiles/libavrdude.dir/avr910.c.o
[  9%] Building C object src/CMakeFiles/libavrdude.dir/avrcache.c.o
[ 10%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi.c.o
In file included from /home/mcuee/build/avrdude/src/avrftdi.c:42:
/home/mcuee/build/avrdude/src/avrftdi_private.h:16:10: fatal error: ftdi.h: No such file or directory
 #include <ftdi.h>
          ^~~~~~~~
compilation terminated.
gmake[2]: *** [src/CMakeFiles/libavrdude.dir/build.make:143: src/CMakeFiles/libavrdude.dir/avrftdi.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:128: src/CMakeFiles/libavrdude.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
Build failed.

Applying the following patch does not help.

mcuee@dragonflybsdvm:~/build/avrdude % git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bde9304b..58735422 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,7 +163,7 @@ if(HAVE_LIBUSB_1_0)
 endif()

 # FreeBSD's library 'libusb' supports both the libusb-0.1 and libusb-1.0 API.
-if (HAVE_LIBUSB AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+if (HAVE_LIBUSB AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD|DragonFly")
     set(HAVE_LIBUSB_1_0 ${HAVE_LIBUSB})
 endif()

@mcuee
Copy link
Collaborator Author

mcuee commented Feb 3, 2024

@stefanrueger and @MCUdude
#1656 (comment)

You can see that I have produce an avrdude executable with the version listed as avrdude version 7.2-20230720 but the version of avrdude.conf is correct. This time it is under DragonFly BSD.

I have ecountered same issue with MSYS2 mingw64 build but I can always sorted out the issue by deleting the git repo and carry out the building process again.

This time it is different as I can not build with a fresh checkout. Strange.

@mcuee
Copy link
Collaborator Author

mcuee commented Feb 3, 2024

Assuming the successful build is correct, it does not seem to work well with the tests. So maybe there are deeper problems.

mcuee@dragonflybsdvm:~/build/avrdude/tools % ldd /usr/local/bin/avrdude
/usr/local/bin/avrdude:
        libm.so.4 => /lib/libm.so.4 (0x8008a5000)
        libelf.so.0 => /usr/local/lib/libelf.so.0 (0x800698000)
        libusb.so.2 => /usr/lib/libusb.so.2 (0x800ad0000)
        libhidapi.so.0 => /usr/local/lib/libhidapi.so.0 (0x8006ad000)
        libftdi.so.1 => /usr/local/lib/libftdi.so.1 (0x8006b6000)
        libftdi1.so.2 => /usr/local/lib/libftdi1.so.2 (0x8006bd000)
        libreadline.so.8 => /usr/local/lib/libreadline.so.8 (0x8006cb000)
        libserialport.so.0 => /usr/local/lib/libserialport.so.0 (0x800723000)
        libncurses.so.6 => /usr/local/lib/libncurses.so.6 (0x800730000)
        libc.so.8 => /lib/libc.so.8 (0x800ce2000)
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x80076b000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x801040000)
        libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x800780000)
        libtinfo.so.6 => /usr/local/lib/libtinfo.so.6 (0x80125a000)

mcuee@dragonflybsdvm:~/build/avrdude/tools % head /usr/local/etc/avrdude.conf
# $Id$ -*- text -*-
#
# AVRDUDE Configuration File
#

avrdude_conf_version = "7.2-20240201 (571a8063)";

# This file contains AVRDUDE's default configuration data describing
# programming hardware pinouts and part definitions. Normally, it
# requires AVRDUDE be of the same or higher version than above string.

mcuee@dragonflybsdvm:~/build/avrdude/tools % ./test-avrdude -p "-c dryrun -p m4809"
Testing avrdude version 7.2-20230720
Prepare "-c dryrun -p m4809" and press 'enter' or 'space' to continue. Press any other key to skip
❌   0.102 s: fuse access: clear, set and read eesave fuse bit (failed command below)
$ avrdude -qq -c dryrun -p m4809 -l /tmp/test-avrdude.log.WAsCVF -T "config eesave=0; config eesave=1; config eesave"
❌   0.100 s: fuse access: set eesave fusebit to delete EEPROM on chip erase (failed command below)
$ avrdude -qq -c dryrun -p m4809 -l /tmp/test-avrdude.log.WAsCVF -T "config eesave=ee*erased"
✅   0.105 s: chip erase
✅   0.103 s: flash -U write/verify holes_rjmp_loops_49152B.hex
❌   0.105 s: flash -T write/verify holes_rjmp_loops_49152B.hex (failed command below)
$ avrdude -qq -c dryrun -p m4809 -l /tmp/test-avrdude.log.WAsCVF -T "write flash ./test_files/holes_rjmp_loops_49152B.hex:a"
❌   0.117 s: flash -T write/verify rjmp_loops_for_bootloaders_49152B.hex (failed command below)
$ avrdude -qq -c dryrun -p m4809 -l /tmp/test-avrdude.log.WAsCVF -T "write flash ./test_files/rjmp_loops_for_bootloaders_49152B.hex:a"
✅   0.096 s: eeprom check whether programmer can flip 0s to 1s
✅   0.102 s: eeprom -U write/verify holes_pack_my_box_256B.hex
❌   0.097 s: eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_256B.hex (failed command below)
$ avrdude -qq -c dryrun -p m4809 -l /tmp/test-avrdude.log.WAsCVF -T "write eeprom ./test_files/holes_the_five_boxing_wizards_256B.hex:a" -T flush -T "write eeprom ./test_files/holes_pack_my_box_256B.hex:a"
❌   0.101 s: eeprom -T write/verify lorem_ipsum_256B.srec (failed command below)
$ avrdude -qq -c dryrun -p m4809 -l /tmp/test-avrdude.log.WAsCVF -T "write eeprom ./test_files/lorem_ipsum_256B.srec:a"
✅   0.111 s: chip erase and spot check flash is actually erased
✅   0.116 s: spot check eeprom is erased, too
❌   0.117 s: usersig -T/-U write/read random_data_64B.bin (failed command below)
$ avrdude -qq -c dryrun -p m4809 -l /tmp/test-avrdude.log.WAsCVF -T "erase usersig; write usersig ./test_files/random_data_64B.bin" -T flush -U usersig:r:/tmp/test-avrdude.tmp.L8gokN:r -U usersig:v:/tmp/test-avrdude.tmp.L8gokN:r -T "erase usersig" -T flush -U usersig:v:./test_files/0xff_64B.hex:i

One or more AVRDUDE "-c dryrun -p m4809" tests failed. Do you want to retry this particular test? (y/n): n

@mcuee
Copy link
Collaborator Author

mcuee commented Feb 3, 2024

BTW, DragonFly BSD 6.4 has avrdude 7.1, it does not support hidapi and libserialport.

mcuee@dragonflybsdvm:~/build/avrdude_bin % ldd ./avrdude71
./avrdude71:
        libm.so.4 => /lib/libm.so.4 (0x80071b000)
        libusb.so.2 => /usr/lib/libusb.so.2 (0x800946000)
        libftdi1.so.2 => /usr/local/lib/libftdi1.so.2 (0x80050e000)
        libreadline.so.8 => /usr/local/lib/libreadline.so.8 (0x80051c000)
        libc.so.8 => /lib/libc.so.8 (0x800b58000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x800eb6000)
        libncurses.so.6 => /usr/local/lib/libncurses.so.6 (0x800574000)
        libtinfo.so.6 => /usr/local/lib/libtinfo.so.6 (0x8005af000)

@mcuee
Copy link
Collaborator Author

mcuee commented Feb 8, 2024

Move this to discussion for now. We may have to rely on people who are interested to help out.

@avrdudes avrdudes locked and limited conversation to collaborators Feb 8, 2024
@mcuee mcuee converted this issue into discussion #1682 Feb 8, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant