Skip to content
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

Improve autotool build (part 1/n) #1681

Merged
merged 25 commits into from
Feb 23, 2024

Conversation

ndim
Copy link
Contributor

@ndim ndim commented Feb 7, 2024

This Draft PR addresses the Autotools build issues named in #1664 and other things.

I will keep this a Draft PR until development with force pushes and surrounding discussions have finished and I can mark it "Ready for review" so it can eventually be merged.

@ndim ndim force-pushed the improve-autotool-build branch 3 times, most recently from 0b87bb0 to 1c51b11 Compare February 7, 2024 20:53
@mcuee mcuee added bug Something isn't working enhancement New feature or request labels Feb 8, 2024
@mcuee
Copy link
Collaborator

mcuee commented Feb 8, 2024

Even though this is still a draft, it already looks very promissing, tested with MSYS2 mingw64.

  1. Much less warnings now.
  2. libreadline status is now correct.
  3. version number git commit ID is correct (but with extra am after)
 MINGW64 /c/work/avr/avrdude_test/avrdude_pr1680/src
$ ./bootstrap
+ rm -rf autom4te.cache
+ LIBTOOLIZE=libtoolize
+ glibtoolize --version
+ export LIBTOOLIZE
+ autoreconf -i
configure.ac:293: warning: Update your code to rely only on HAVE_SYS_TIME_H,
configure.ac:293: then remove this warning and the obsolete code below it.
configure.ac:293: All current systems provide time.h; it need not be checked for.
configure.ac:293: Not all systems provide sys/time.h, but those that do, all allow
configure.ac:293: you to include it and time.h simultaneously.

$ ./configure --prefix=/mingw64
configure: loading site script /etc/config.site
./configure: line 2691: 15cad978: command not found
./configure: line 2692: [15cad978]: command not found
checking build system type... x86_64-w64-mingw32
...

Configuration summary:
----------------------
DO HAVE    libelf
DO HAVE    libusb
DO HAVE    libusb_1_0
DO HAVE    libftdi1
DON'T HAVE libftdi
DO HAVE    libhid
DO HAVE    libhidapi
DO HAVE    libreadline
DO HAVE    libserialport
DO HAVE    pthread
DISABLED   doc
DISABLED   parport
DISABLED   linuxgpio
DISABLED   linuxspi

$ make
make  all-recursive
make[1]: Entering directory '/c/work/avr/avrdude_test/avrdude_pr1680/src'
...
  CC       libavrdude_a-xbee.o
  AR       libavrdude.a
C:\msys64\mingw64\bin\ar.exe: `u' modifier ignored since `D' is the default (see `U')
  CCLD     avrdude.exe
  CC       libavrdude_la-config_gram.lo
...
  CC       libavrdude_la-xbee.lo
  CCLD     libavrdude.la
libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only
make[2]: Leaving directory '/c/work/avr/avrdude_test/avrdude_pr1680/src'
make[1]: Leaving directory '/c/work/avr/avrdude_test/avrdude_pr1680/src'

$ ldd ./avrdude.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffb4ca10000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffb4b150000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffb4a1c0000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffb4c920000)
        HID.DLL => /c/WINDOWS/SYSTEM32/HID.DLL (0x7ffb48560000)
        SETUPAPI.dll => /c/WINDOWS/System32/SETUPAPI.dll (0x7ffb4a760000)
        libftdi1.dll => /mingw64/bin/libftdi1.dll (0x7ffb2e360000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7ffb4bf40000)
        libhidapi-0.dll => /mingw64/bin/libhidapi-0.dll (0x7ffb39020000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7ffb4b2e0000)
        libserialport-0.dll => /mingw64/bin/libserialport-0.dll (0x7ffb18d70000)
        ADVAPI32.dll => /c/WINDOWS/System32/ADVAPI32.dll (0x7ffb4b220000)
        libusb-1.0.dll => /mingw64/bin/libusb-1.0.dll (0x7ffaf30e0000)
        libreadline8.dll => /mingw64/bin/libreadline8.dll (0x7ffaff0a0000)
        sechost.dll => /c/WINDOWS/System32/sechost.dll (0x7ffb4ae10000)
        libusb-0-1-4.dll => /mingw64/bin/libusb-0-1-4.dll (0x7ffafda70000)
        USER32.dll => /c/WINDOWS/System32/USER32.dll (0x7ffb4b4f0000)
        bcrypt.dll => /c/WINDOWS/System32/bcrypt.dll (0x7ffb49fa0000)
        win32u.dll => /c/WINDOWS/System32/win32u.dll (0x7ffb4a610000)
        GDI32.dll => /c/WINDOWS/System32/GDI32.dll (0x7ffb4bdb0000)
        gdi32full.dll => /c/WINDOWS/System32/gdi32full.dll (0x7ffb49e80000)
        msvcp_win.dll => /c/WINDOWS/System32/msvcp_win.dll (0x7ffb4a570000)
        libtermcap-0.dll => /mingw64/bin/libtermcap-0.dll (0x7ffb14930000)
        cfgmgr32.DLL => /c/WINDOWS/SYSTEM32/cfgmgr32.DLL (0x7ffb49a40000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7ffb4a640000)

$ head avrdude.conf
# $Id$ -*- text -*-
#
# AVRDUDE Configuration File
#

avrdude_conf_version = "7.3-20240208 (15cad978) am";

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

$ ls *.a
libavrdude.a

$ ./avrdude.exe
Usage: avrdude [options]
Options:
...
  -?                     Display this usage

avrdude version 7.3-20240208 (15cad978) am, https://github.com/avrdudes/avrdude

@stefanrueger
Copy link
Collaborator

version number git commit ID is correct (but with extra am after)

@mcuee I believe the additional am is deliberate to indicate automake whilst cm is meant for cmake. Neat!

@ndim ndim force-pushed the improve-autotool-build branch 5 times, most recently from 2e6d1af to 96460b0 Compare February 13, 2024 12:41
@ndim ndim force-pushed the improve-autotool-build branch 3 times, most recently from 8544ce1 to 6b551fc Compare February 15, 2024 00:05
@mcuee
Copy link
Collaborator

mcuee commented Feb 15, 2024

This draft PR seems to work pretty well under macOS Homebrew.

Detailed build log under macOS 14.3.1 Homebrew, Mac Mini M1 2020
mcuee@mcuees-Mac-mini src % ./bootstrap 
+ rm -rf autom4te.cache
+ LIBTOOLIZE=libtoolize
+ glibtoolize --version
+ LIBTOOLIZE=glibtoolize
+ export LIBTOOLIZE
+ autoreconf -i

mcuee@mcuees-Mac-mini src % CFLAGS="-I/opt/homebrew/include" LDFLAGS="-L/opt/homebrew/lib" ./configure --prefix=/Users/mcuee/bin
checking build system type... aarch64-apple-darwin23.3.0
checking host system type... aarch64-apple-darwin23.3.0
checking target system type... aarch64-apple-darwin23.3.0
checking for a BSD-compatible install... /opt/homebrew/bin/ginstall -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /opt/homebrew/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking versioninfo item CMAKE_PROJECT_VERSION... 7.3
checking versioninfo item GIT_COMMIT_DATE... 20240215
checking versioninfo item GIT_COMMIT_HASH... 6b551fc3
checking versioninfo item GIT_TAG_HASH... a855692d
checking versioninfo derived PACKAGE_VERSION... 7.3-20240215
checking versioninfo derived AVRDUDE_FULL_VERSION... 7.3-20240215 (6b551fc3) at
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for gawk... (cached) gawk
checking for a sed that does not truncate output... /opt/homebrew/bin/gsed
checking for bison... bison -y
checking for flex... flex
checking for lex output file root... lex.yy
checking for lex library... none needed
checking whether yytext is a pointer... yes
checking for ar... ar
checking the archiver (ar) interface... ar
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /opt/homebrew/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert aarch64-apple-darwin23.3.0 file names to aarch64-apple-darwin23.3.0 format... func_convert_file_noop
checking how to convert aarch64-apple-darwin23.3.0 file names to toolchain format... func_convert_file_noop
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... ld: warning: -single_module is obsolete
no
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin23.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether yylex_destroy is generated by flex... version Apple(flex-34) => yes
checking for WSAStartup in -lws2_32... no
checking for tputs in -ltermcap... yes
checking for tputs in -lncurses... yes
checking for readline in -lreadline... yes
checking for elf_getshdrstrndx in -lelf... yes
checking for libelf.h... no
checking for libelf/libelf.h... yes
checking for library containing gethostent... none required
checking for library containing setsockopt... none required
checking for usb_get_string_simple in -lusb... yes
checking for usb.h... yes
checking for lusb0_usb.h... no
checking for libusb_init in -lusb-1.0... yes
checking for libusb-1.0/libusb.h... yes
checking for libusb.h... no
checking for libusb_init in -lusb... no
checking for libusb.h... (cached) no
checking for library containing hid_init... -lhidapi
checking for hidapi/hidapi.h... yes
checking for sp_open in -lserialport... yes
checking for libserialport.h... yes
checking for ftdi_new in -lftdi1... yes
checking for ftdi_usb_get_strings in -lftdi... no
checking for ftdi_tcioflush... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for fcntl.h... yes
checking for sys/ioctl.h... yes
checking for sys/time.h... yes
checking for termios.h... yes
checking for unistd.h... (cached) yes
checking for ddk/hidsdi.h... no
checking for an ANSI C-conforming const... yes
checking for netinet/in.h... yes
checking for memset... yes
checking for select... yes
checking for strcasecmp... yes
checking for strdup... yes
checking for strerror... yes
checking for strncasecmp... yes
checking for strtol... yes
checking for strtoul... yes
checking for gettimeofday... yes
checking for usleep... yes
checking for getaddrinfo... yes
checking for a Win32 HID library... no
checking for uint_t... no
checking for ulong_t... no
checking for serial device... unknown
checking if gcc accepts -Wno-pointer-sign ... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating doc/Makefile
config.status: creating avrdude.spec
config.status: creating Makefile
config.status: creating GNUmakefile
config.status: creating avrdude.conf.tmp
config.status: creating ac_cfg.h
config.status: executing depfiles commands
config.status: executing libtool commands


Configuration summary:
----------------------
DO HAVE    libelf
DO HAVE    libusb
DO HAVE    libusb_1_0
DO HAVE    libftdi1
DON'T HAVE libftdi
DON'T HAVE libhid
DO HAVE    libhidapi
DO HAVE    libreadline
DO HAVE    libserialport
DO HAVE    pthread
DISABLED   doc
DISABLED   parport
DISABLED   linuxgpio
DISABLED   linuxspi
mcuee@mcuees-Mac-mini src % make
  YACC     config_gram.c
updating config_gram.h
  LEX      lexer.c
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in .
  CC       avrdude-main.o
  CC       avrdude-whereami.o
  CC       avrdude-developer_opts.o
  CC       libavrdude_a-config_gram.o
  CC       libavrdude_a-lexer.o
lexer.c:2434:38: warning: comparison of integers of different signs: 'yy_size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
  CC       libavrdude_a-arduino.o
  CC       libavrdude_a-avr.o
  CC       libavrdude_a-avr910.o
  CC       libavrdude_a-avrcache.o
  CC       libavrdude_a-avrftdi.o
  CC       libavrdude_a-avrftdi_tpi.o
  CC       libavrdude_a-avrintel.o
  CC       libavrdude_a-avrpart.o
  CC       libavrdude_a-bitbang.o
  CC       libavrdude_a-buspirate.o
  CC       libavrdude_a-butterfly.o
  CC       libavrdude_a-ch341a.o
  CC       libavrdude_a-config.o
  CC       libavrdude_a-confwin.o
  CC       libavrdude_a-crc16.o
  CC       libavrdude_a-dfu.o
  CC       libavrdude_a-dryrun.o
  CC       libavrdude_a-fileio.o
  CC       libavrdude_a-flip1.o
  CC       libavrdude_a-flip2.o
  CC       libavrdude_a-ft245r.o
  CC       libavrdude_a-jtagmkI.o
  CC       libavrdude_a-jtagmkII.o
  CC       libavrdude_a-jtag3.o
  CC       libavrdude_a-leds.o
  CC       libavrdude_a-linuxgpio.o
  CC       libavrdude_a-linuxspi.o
  CC       libavrdude_a-lists.o
  CC       libavrdude_a-micronucleus.o
  CC       libavrdude_a-par.o
  CC       libavrdude_a-pgm.o
  CC       libavrdude_a-pgm_type.o
  CC       libavrdude_a-pickit2.o
  CC       libavrdude_a-pindefs.o
  CC       libavrdude_a-ppi.o
  CC       libavrdude_a-ppiwin.o
  CC       libavrdude_a-serbb_posix.o
  CC       libavrdude_a-serbb_win32.o
  CC       libavrdude_a-ser_avrdoper.o
  CC       libavrdude_a-ser_posix.o
  CC       libavrdude_a-ser_win32.o
  CC       libavrdude_a-serialadapter.o
  CC       libavrdude_a-stk500.o
  CC       libavrdude_a-stk500v2.o
  CC       libavrdude_a-stk500generic.o
  CC       libavrdude_a-strutil.o
  CC       libavrdude_a-teensy.o
  CC       libavrdude_a-term.o
  CC       libavrdude_a-usbasp.o
  CC       libavrdude_a-serialupdi.o
  CC       libavrdude_a-updi_link.o
  CC       libavrdude_a-updi_state.o
  CC       libavrdude_a-updi_readwrite.o
  CC       libavrdude_a-updi_nvm.o
  CC       libavrdude_a-updi_nvm_v0.o
  CC       libavrdude_a-updi_nvm_v2.o
  CC       libavrdude_a-updi_nvm_v3.o
  CC       libavrdude_a-updi_nvm_v4.o
  CC       libavrdude_a-updi_nvm_v5.o
  CC       libavrdude_a-urclock.o
  CC       libavrdude_a-usb_hidapi.o
  CC       libavrdude_a-usb_libusb.o
  CC       libavrdude_a-usbtiny.o
  CC       libavrdude_a-update.o
  CC       libavrdude_a-wiring.o
  CC       libavrdude_a-xbee.o
  AR       libavrdude.a
  CCLD     avrdude
ld: warning: search path 'CoreFoundation' not found
  CC       libavrdude_la-config_gram.lo
  CC       libavrdude_la-lexer.lo
lexer.c:2434:38: warning: comparison of integers of different signs: 'yy_size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
        if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
  CC       libavrdude_la-arduino.lo
  CC       libavrdude_la-avr.lo
  CC       libavrdude_la-avr910.lo
  CC       libavrdude_la-avrcache.lo
  CC       libavrdude_la-avrftdi.lo
  CC       libavrdude_la-avrftdi_tpi.lo
  CC       libavrdude_la-avrintel.lo
  CC       libavrdude_la-avrpart.lo
  CC       libavrdude_la-bitbang.lo
  CC       libavrdude_la-buspirate.lo
  CC       libavrdude_la-butterfly.lo
  CC       libavrdude_la-ch341a.lo
  CC       libavrdude_la-config.lo
  CC       libavrdude_la-confwin.lo
  CC       libavrdude_la-crc16.lo
  CC       libavrdude_la-dfu.lo
  CC       libavrdude_la-dryrun.lo
  CC       libavrdude_la-fileio.lo
  CC       libavrdude_la-flip1.lo
  CC       libavrdude_la-flip2.lo
  CC       libavrdude_la-ft245r.lo
  CC       libavrdude_la-jtagmkI.lo
  CC       libavrdude_la-jtagmkII.lo
  CC       libavrdude_la-jtag3.lo
  CC       libavrdude_la-leds.lo
  CC       libavrdude_la-linuxgpio.lo
  CC       libavrdude_la-linuxspi.lo
  CC       libavrdude_la-lists.lo
  CC       libavrdude_la-micronucleus.lo
  CC       libavrdude_la-par.lo
  CC       libavrdude_la-pgm.lo
  CC       libavrdude_la-pgm_type.lo
  CC       libavrdude_la-pickit2.lo
  CC       libavrdude_la-pindefs.lo
  CC       libavrdude_la-ppi.lo
  CC       libavrdude_la-ppiwin.lo
  CC       libavrdude_la-serbb_posix.lo
  CC       libavrdude_la-serbb_win32.lo
  CC       libavrdude_la-ser_avrdoper.lo
  CC       libavrdude_la-ser_posix.lo
  CC       libavrdude_la-ser_win32.lo
  CC       libavrdude_la-serialadapter.lo
  CC       libavrdude_la-stk500.lo
  CC       libavrdude_la-stk500v2.lo
  CC       libavrdude_la-stk500generic.lo
  CC       libavrdude_la-strutil.lo
  CC       libavrdude_la-teensy.lo
  CC       libavrdude_la-term.lo
  CC       libavrdude_la-usbasp.lo
  CC       libavrdude_la-serialupdi.lo
  CC       libavrdude_la-updi_link.lo
  CC       libavrdude_la-updi_state.lo
  CC       libavrdude_la-updi_readwrite.lo
  CC       libavrdude_la-updi_nvm.lo
  CC       libavrdude_la-updi_nvm_v0.lo
  CC       libavrdude_la-updi_nvm_v2.lo
  CC       libavrdude_la-updi_nvm_v3.lo
  CC       libavrdude_la-updi_nvm_v4.lo
  CC       libavrdude_la-updi_nvm_v5.lo
  CC       libavrdude_la-urclock.lo
  CC       libavrdude_la-usb_hidapi.lo
  CC       libavrdude_la-usb_libusb.lo
  CC       libavrdude_la-usbtiny.lo
  CC       libavrdude_la-update.lo
  CC       libavrdude_la-wiring.lo
  CC       libavrdude_la-xbee.lo
  CCLD     libavrdude.la
mcuee@mcuees-Mac-mini src % make install
/Library/Developer/CommandLineTools/usr/bin/make  install-recursive
Making install in .
 /opt/homebrew/bin/gmkdir -p '/Users/mcuee/bin/lib'
 /bin/sh ./libtool   --mode=install /opt/homebrew/bin/ginstall -c   libavrdude.la '/Users/mcuee/bin/lib'
libtool: install: /opt/homebrew/bin/ginstall -c .libs/libavrdude.1.dylib /Users/mcuee/bin/lib/libavrdude.1.dylib
libtool: install: (cd /Users/mcuee/bin/lib && { ln -s -f libavrdude.1.dylib libavrdude.dylib || { rm -f libavrdude.dylib && ln -s libavrdude.1.dylib libavrdude.dylib; }; })
libtool: install: /opt/homebrew/bin/ginstall -c .libs/libavrdude.lai /Users/mcuee/bin/lib/libavrdude.la
libtool: install: /opt/homebrew/bin/ginstall -c .libs/libavrdude.a /Users/mcuee/bin/lib/libavrdude.a
libtool: install: chmod 644 /Users/mcuee/bin/lib/libavrdude.a
libtool: install: ranlib /Users/mcuee/bin/lib/libavrdude.a
 /opt/homebrew/bin/gmkdir -p '/Users/mcuee/bin/bin'
  /bin/sh ./libtool   --mode=install /opt/homebrew/bin/ginstall -c avrdude '/Users/mcuee/bin/bin'
libtool: install: /opt/homebrew/bin/ginstall -c avrdude /Users/mcuee/bin/bin/avrdude
Backing up avrdude.conf in /Users/mcuee/bin/etc
 /opt/homebrew/bin/gmkdir -p '/Users/mcuee/bin/etc'
 /opt/homebrew/bin/ginstall -c -m 644 avrdude.conf '/Users/mcuee/bin/etc'
 /opt/homebrew/bin/gmkdir -p '/Users/mcuee/bin/include'
 /opt/homebrew/bin/ginstall -c -m 644 libavrdude.h '/Users/mcuee/bin/include'
 /opt/homebrew/bin/gmkdir -p '/Users/mcuee/bin/share/man/man1'
 /opt/homebrew/bin/ginstall -c -m 644 avrdude.1 '/Users/mcuee/bin/share/man/man1'

Results:

mcuee@mcuees-Mac-mini src % otool -L ~/bin/bin/avrdude 
/Users/mcuee/bin/bin/avrdude:
	/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib (compatibility version 5.0.0, current version 5.0.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/opt/homebrew/opt/libusb-compat/lib/libusb-0.1.4.dylib (compatibility version 9.0.0, current version 9.4.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 2202.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.61.1)
	/opt/homebrew/opt/libserialport/lib/libserialport.0.dylib (compatibility version 2.0.0, current version 2.0.0)
	/opt/homebrew/opt/hidapi/lib/libhidapi.0.dylib (compatibility version 0.0.0, current version 0.14.0)
	/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
	/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
	/opt/homebrew/opt/libftdi/lib/libftdi1.2.dylib (compatibility version 2.0.0, current version 2.5.0)

mcuee@mcuees-Mac-mini src % ../tools/test-avrdude -e "/Users/mcuee/bin/bin/avrdude" -d0 -p"-cdryrun -pm2560" -p"-cdryrun -pavr64du28"
Testing /Users/mcuee/bin/bin/avrdude version 7.3-20240215 (6b551fc3) at
Prepare "-cdryrun -pm2560" and press 'enter' or 'space' to continue. Press any other key to skip
✅   0.082 s: flash raw format -T/-U write/verify cola-vending-machine.raw
✅   0.071 s: flash extended address and hole test
✅   0.102 s: flash writing binary numbers
✅   0.131 s: flash reading and verifying binary numbers
✅   0.096 s: flash writing octal numbers
✅   0.145 s: flash reading and verifying octal numbers
✅   0.089 s: flash writing decimal numbers
✅   0.141 s: flash reading and verifying decimal numbers
✅   0.093 s: flash writing hexadecimal numbers
✅   0.114 s: flash reading and verifying hexadecimal numbers
✅   0.095 s: flash writing R numbers
✅   0.139 s: flash reading and verifying R numbers
✅   0.090 s: flash writing srec format
✅   0.077 s: flash reading and verifying srec format file
✅   0.068 s: fuse access: clear, set and read eesave fuse bit
✅   0.069 s: fuse access: set eesave fusebit to delete EEPROM on chip erase
✅   0.069 s: chip erase
✅   0.073 s: flash -U write/verify holes_rjmp_loops_262144B.hex
✅   0.073 s: flash -T write/verify holes_rjmp_loops_262144B.hex
✅   0.070 s: eeprom check whether programmer can flip 0s to 1s
✅   0.070 s: eeprom -U write/verify holes_pack_my_box_4096B.hex
✅   0.070 s: eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_4096B.hex
✅   0.073 s: chip erase and spot check flash is actually erased
✅   0.069 s: spot check eeprom is erased, too
Prepare "-cdryrun -pavr64du28" and press 'enter' or 'space' to continue. Press any other key to skip
✅   0.067 s: fuse access: clear, set and read eesave fuse bit
✅   0.069 s: fuse access: set eesave fusebit to delete EEPROM on chip erase
✅   0.069 s: chip erase
✅   0.070 s: flash -U write/verify holes_rjmp_loops_65536B.hex
✅   0.071 s: flash -T write/verify holes_rjmp_loops_65536B.hex
✅   0.069 s: eeprom check whether programmer can flip 0s to 1s
✅   0.070 s: eeprom -U write/verify holes_pack_my_box_256B.hex
✅   0.070 s: eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_256B.hex
✅   0.071 s: chip erase and spot check flash is actually erased
✅   0.069 s: spot check eeprom is erased, too
✅   0.071 s: usersig -T/-U write/read random_data_512B.bin

@mcuee mcuee added this to the AVRDUDE 7.4 milestone Feb 16, 2024
@ndim
Copy link
Contributor Author

ndim commented Feb 16, 2024

Some goals for this first round of fixing the autotools build:

  • consistently name the full version message AVRDUDE_FULL_VERSION in all stages of the build
  • fix libreadline status message in summary output
  • have the git commit hash in the version message just like cmake builds
  • add a marker to the version message distinguishing autotools and cmake builds
  • at least one CI make distcheck build
  • at least one CI tools/test-avrdude check
  • group buildsystem files into subdirectories where possible
  • let autoreconf do the bootstrap job instead of individually calling all the autotools
  • fix the warnings generated at autoreconf time without automake -Wall
  • m4 quote arguments where possible

Concerning both cmake and autotools builds:

  • use commit committer date instead of commit author date for generating the 7.3-20240213 type version messages containing a date (and the year in the windows resources)

@stefanrueger
Copy link
Collaborator

let the default rules automake generates build HTML, PDF, PS from texi

That sounds cool. I am not sure what the best way is to generate these. Here the release procedure that I inherited from @dl8dtl

* update version info:
  CMakeLists.txt
  NEWS: "changes since <oldvers>" => "changes in <newvers>"
  git commit -a

* check autotools build:
  cd src
  ./bootstrap
  ./configure --enable-doc # also prepare for docs
  # doesn't run with -k; doc build asks for libavrdude.a :-]
  make -k distcheck
  result: avrdude-<version>.tar.gz

* build docs
  cd [src/]doc
  make -k
  result: avrdude.pdf, avrdude-html/
  keep them somewhere

* run CMake build
  cd ../..
  ./build.sh
  this is already tested by CI anyway

* git tag v<newvers>
  git push --tags

  CI should prepare Github release now

* update version info:
  NEWS: add template lines for "changes since <newvers>"
  git commit -a
  git push

* update docs:
  git checkout onlinedocs
  mkdir docs/<newrelease>
  cd docs/<newrelease>
  cp ../../src/doc/avrdude-html/* .
  cp ../../src/doc/avrdude.pdf .
  cd ..
  $EDITOR index.html
  add links to new <newvers>/avrdude.html and <newvers>/avrdude.pdf
  git add <newvers>
  git add index.html
  git commit
  git push

  cd ..
  git checkout main

* download source tarballs from Github release area
  verify they are correct (unpack, and compare against local tree ...)
  gpg --sign --detach for the .zip and .tar.gz
  include GPG signatures in release assets

@stefanrueger
Copy link
Collaborator

Other than this: I commend your thorough review of the autotool build process @ndim. Really appreciated.

... and should you get stuck at some point remember "perfect is the enemy of good" (the project is quite happy to merge a number of independent good improvements, they don't have to come in one go)

@mcuee
Copy link
Collaborator

mcuee commented Feb 18, 2024

... and should you get stuck at some point remember "perfect is the enemy of good" (the project is quite happy to merge a number of independent good improvements, they don't have to come in one go)

Indeed. For example, the following two issues can be in another time.

  • make builds on NetBSD succeed out of the box
  • make builds on OpenBSD succeed out of the box

This add some basic CI checks which exercise the autotools build:

  * make targets "all" "install" testing compilation and installation
  * run the same dry-run test-avrdude check as the cmake builds
  * make target "distcheck" testing that dist tarball contains all
    the necessary files
Remove unused unnecessary commented out build code from
"src/configure.ac".

I accidentally left those comments in commit d15c561.
@mcuee
Copy link
Collaborator

mcuee commented Feb 19, 2024

@ndim

Will this PR conflict with PR #1688? If that is the case, we may need to merge #1688 first and then you need to rebase your PR. Thanks.

@mcuee
Copy link
Collaborator

mcuee commented Feb 19, 2024

Some goals for this first round of fixing the autotools build:

  • consistently name the full version message AVRDUDE_FULL_VERSION in all stages of the build
  • fix libreadline status message in summary output
  • have the git commit hash in the version message just like cmake builds
  • add a marker to the version message distinguishing autotools and cmake builds
  • at least one CI make distcheck build
  • at least one CI tools/test-avrdude check
  • group buildsystem files into subdirectories where possible
  • let autoreconf do the bootstrap job instead of individually calling all the autotools
  • fix the warnings generated at autoreconf time without automake -Wall
  • m4 quote arguments where possible

Concerning both cmake and autotools builds:

  • use commit committer date instead of commit author date for generating the 7.3-20240213 type version messages containing a date (and the year in the windows resources)

No issues found under MSYS2 mingw64.

build log under MSYS2 mingw64
 MINGW64 /c/work/avr/avrdude_test/avrdude_pr1681/src
$ ./bootstrap
+ rm -rf autom4te.cache
+ LIBTOOLIZE=libtoolize
+ glibtoolize --version
+ export LIBTOOLIZE
+ autoreconf -i
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'auto-aux'.
libtoolize: copying file 'auto-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'auto-m4'.
libtoolize: copying file 'auto-m4/libtool.m4'
libtoolize: copying file 'auto-m4/ltoptions.m4'
libtoolize: copying file 'auto-m4/ltsugar.m4'
libtoolize: copying file 'auto-m4/ltversion.m4'
libtoolize: copying file 'auto-m4/lt~obsolete.m4'
configure.ac:99: installing 'auto-aux/ar-lib'
configure.ac:93: installing 'auto-aux/compile'
configure.ac:58: installing 'auto-aux/config.guess'
configure.ac:58: installing 'auto-aux/config.sub'
configure.ac:62: installing 'auto-aux/install-sh'
configure.ac:62: installing 'auto-aux/missing'
Makefile.am: installing 'auto-aux/depcomp'
configure.ac: installing 'auto-aux/ylwrap'
doc/Makefile.am:33: installing 'auto-aux/mdate-sh'
doc/Makefile.am:33: installing 'auto-aux/texinfo.tex'

xiaof@LAPTOP-913SIMUD MINGW64 /c/work/avr/avrdude_test/avrdude_pr1681/src
$ ./configure --prefix=/mingw64
configure: loading site script /etc/config.site
checking build system type... x86_64-w64-mingw32
checking host system type... x86_64-w64-mingw32
checking target system type... x86_64-w64-mingw32
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking versioninfo item CMAKE_PROJECT_VERSION... 7.3
checking versioninfo item GIT_COMMIT_DATE... 20240219
checking versioninfo item GIT_COMMIT_HASH... dcc40cf5
checking versioninfo item GIT_TAG_HASH... a855692d
checking versioninfo derived PACKAGE_VERSION... 7.3-20240219
checking versioninfo derived AVRDUDE_FULL_VERSION... 7.3-20240219 (dcc40cf5) at
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for gawk... (cached) gawk
checking for a sed that does not truncate output... /usr/bin/sed
checking for bison... bison -y
checking for flex... flex
checking for lex output file root... lex.yy
checking for lex library... none needed
checking whether yytext is a pointer... yes
checking for ar... ar
checking the archiver (ar) interface... ar
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe
checking if the linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /mingw64/bin/nm -B
checking the name lister (/mingw64/bin/nm -B) interface... BSD nm
checking whether ln -s works... no, using cp -pR
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-w64-mingw32 file names to x86_64-w64-mingw32 format... func_convert_file_msys_to_w32
checking how to convert x86_64-w64-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /mingw64/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (C:/msys64/mingw64/x86_64-w64-mingw32/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether yylex_destroy is generated by flex... version 2.6.4 => yes
checking for WSAStartup in -lws2_32... yes
checking for tputs in -ltermcap... yes
checking for tputs in -lncurses... yes
checking for readline in -lreadline... yes
checking for elf_getshdrstrndx in -lelf... yes
checking for libelf.h... yes
checking for libelf/libelf.h... yes
checking for library containing gethostent... no
checking for library containing setsockopt... none required
checking for usb_get_string_simple in -lusb... yes
checking for usb.h... no
checking for lusb0_usb.h... yes
checking for libusb_init in -lusb-1.0... yes
checking for libusb-1.0/libusb.h... yes
checking for libusb.h... no
checking for libusb_init in -lusb... no
checking for libusb.h... (cached) no
checking for library containing hid_init... -lhidapi
checking for hidapi/hidapi.h... yes
checking for sp_open in -lserialport... yes
checking for libserialport.h... yes
checking for ftdi_new in -lftdi1... yes
checking for ftdi_usb_get_strings in -lftdi... no
checking for ftdi_tcioflush... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for fcntl.h... yes
checking for sys/ioctl.h... no
checking for sys/time.h... yes
checking for termios.h... no
checking for unistd.h... (cached) yes
checking for ddk/hidsdi.h... no
checking for an ANSI C-conforming const... yes
checking for netinet/in.h... no
checking for memset... yes
checking for select... yes
checking for strcasecmp... yes
checking for strdup... yes
checking for strerror... yes
checking for strncasecmp... yes
checking for strtol... yes
checking for strtoul... yes
checking for gettimeofday... yes
checking for usleep... yes
checking for getaddrinfo... yes
checking for a Win32 HID library... yes
checking for uint_t... no
checking for ulong_t... no
checking for serial device... com1
checking if gcc accepts -Wno-pointer-sign ... yes
checking if gcc accepts -mno-cygwin... no
configure: Your compiler does not understand the -mno-cygwin option.
configure: You might want to select an alternative compiler, like
configure:
configure: CC=mingw32-gcc ./configure
configure:
checking if linker accepts -static... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating doc/Makefile
config.status: creating avrdude.spec
config.status: creating Makefile
config.status: creating GNUmakefile
config.status: creating avrdude.conf.tmp
config.status: creating ac_cfg.h
config.status: executing depfiles commands
config.status: executing libtool commands


Configuration summary:
----------------------
DO HAVE    libelf
DO HAVE    libusb
DO HAVE    libusb_1_0
DO HAVE    libftdi1
DON'T HAVE libftdi
DO HAVE    libhid
DO HAVE    libhidapi
DO HAVE    libreadline
DO HAVE    libserialport
DO HAVE    pthread
DISABLED   doc
DISABLED   parport
DISABLED   linuxgpio
DISABLED   linuxspi

xiaof@LAPTOP-913SIMUD MINGW64 /c/work/avr/avrdude_test/avrdude_pr1681/src
$ make
  YACC     config_gram.c
updating config_gram.h
  LEX      lexer.c
make  all-recursive
make[1]: Entering directory '/c/work/avr/avrdude_test/avrdude_pr1681/src'
Making all in .
make[2]: Entering directory '/c/work/avr/avrdude_test/avrdude_pr1681/src'
  CC       avrdude-main.o
  CC       avrdude-whereami.o
  CC       avrdude-developer_opts.o
  CC       libavrdude_a-config_gram.o
  CC       libavrdude_a-lexer.o
  CC       libavrdude_a-arduino.o
  CC       libavrdude_a-avr.o
  CC       libavrdude_a-avr910.o
  CC       libavrdude_a-avrcache.o
  CC       libavrdude_a-avrftdi.o
  CC       libavrdude_a-avrftdi_tpi.o
  CC       libavrdude_a-avrintel.o
  CC       libavrdude_a-avrpart.o
  CC       libavrdude_a-bitbang.o
  CC       libavrdude_a-buspirate.o
  CC       libavrdude_a-butterfly.o
  CC       libavrdude_a-ch341a.o
  CC       libavrdude_a-config.o
  CC       libavrdude_a-confwin.o
  CC       libavrdude_a-crc16.o
  CC       libavrdude_a-dfu.o
  CC       libavrdude_a-dryrun.o
  CC       libavrdude_a-fileio.o
  CC       libavrdude_a-flip1.o
  CC       libavrdude_a-flip2.o
  CC       libavrdude_a-ft245r.o
  CC       libavrdude_a-jtagmkI.o
  CC       libavrdude_a-jtagmkII.o
  CC       libavrdude_a-jtag3.o
  CC       libavrdude_a-leds.o
  CC       libavrdude_a-linuxgpio.o
  CC       libavrdude_a-linuxspi.o
  CC       libavrdude_a-lists.o
  CC       libavrdude_a-micronucleus.o
  CC       libavrdude_a-par.o
  CC       libavrdude_a-pgm.o
  CC       libavrdude_a-pgm_type.o
  CC       libavrdude_a-pickit2.o
  CC       libavrdude_a-pindefs.o
  CC       libavrdude_a-ppi.o
  CC       libavrdude_a-ppiwin.o
  CC       libavrdude_a-serbb_posix.o
  CC       libavrdude_a-serbb_win32.o
  CC       libavrdude_a-ser_avrdoper.o
  CC       libavrdude_a-ser_posix.o
  CC       libavrdude_a-ser_win32.o
  CC       libavrdude_a-serialadapter.o
  CC       libavrdude_a-stk500.o
  CC       libavrdude_a-stk500v2.o
  CC       libavrdude_a-stk500generic.o
  CC       libavrdude_a-strutil.o
  CC       libavrdude_a-teensy.o
  CC       libavrdude_a-term.o
  CC       libavrdude_a-usbasp.o
  CC       libavrdude_a-serialupdi.o
  CC       libavrdude_a-updi_link.o
  CC       libavrdude_a-updi_state.o
  CC       libavrdude_a-updi_readwrite.o
  CC       libavrdude_a-updi_nvm.o
  CC       libavrdude_a-updi_nvm_v0.o
  CC       libavrdude_a-updi_nvm_v2.o
  CC       libavrdude_a-updi_nvm_v3.o
  CC       libavrdude_a-updi_nvm_v4.o
  CC       libavrdude_a-updi_nvm_v5.o
  CC       libavrdude_a-urclock.o
  CC       libavrdude_a-usb_hidapi.o
  CC       libavrdude_a-usb_libusb.o
  CC       libavrdude_a-usbtiny.o
  CC       libavrdude_a-update.o
  CC       libavrdude_a-wiring.o
  CC       libavrdude_a-xbee.o
  AR       libavrdude.a
C:\msys64\mingw64\bin\ar.exe: `u' modifier ignored since `D' is the default (see `U')
  CCLD     avrdude.exe
  CC       libavrdude_la-config_gram.lo
  CC       libavrdude_la-lexer.lo
  CC       libavrdude_la-arduino.lo
  CC       libavrdude_la-avr.lo
  CC       libavrdude_la-avr910.lo
  CC       libavrdude_la-avrcache.lo
  CC       libavrdude_la-avrftdi.lo
  CC       libavrdude_la-avrftdi_tpi.lo
  CC       libavrdude_la-avrintel.lo
  CC       libavrdude_la-avrpart.lo
  CC       libavrdude_la-bitbang.lo
  CC       libavrdude_la-buspirate.lo
  CC       libavrdude_la-butterfly.lo
  CC       libavrdude_la-ch341a.lo
  CC       libavrdude_la-config.lo
  CC       libavrdude_la-confwin.lo
  CC       libavrdude_la-crc16.lo
  CC       libavrdude_la-dfu.lo
  CC       libavrdude_la-dryrun.lo
  CC       libavrdude_la-fileio.lo
  CC       libavrdude_la-flip1.lo
  CC       libavrdude_la-flip2.lo
  CC       libavrdude_la-ft245r.lo
  CC       libavrdude_la-jtagmkI.lo
  CC       libavrdude_la-jtagmkII.lo
  CC       libavrdude_la-jtag3.lo
  CC       libavrdude_la-leds.lo
  CC       libavrdude_la-linuxgpio.lo
  CC       libavrdude_la-linuxspi.lo
  CC       libavrdude_la-lists.lo
  CC       libavrdude_la-micronucleus.lo
  CC       libavrdude_la-par.lo
  CC       libavrdude_la-pgm.lo
  CC       libavrdude_la-pgm_type.lo
  CC       libavrdude_la-pickit2.lo
  CC       libavrdude_la-pindefs.lo
  CC       libavrdude_la-ppi.lo
  CC       libavrdude_la-ppiwin.lo
  CC       libavrdude_la-serbb_posix.lo
  CC       libavrdude_la-serbb_win32.lo
  CC       libavrdude_la-ser_avrdoper.lo
  CC       libavrdude_la-ser_posix.lo
  CC       libavrdude_la-ser_win32.lo
  CC       libavrdude_la-serialadapter.lo
  CC       libavrdude_la-stk500.lo
  CC       libavrdude_la-stk500v2.lo
  CC       libavrdude_la-stk500generic.lo
  CC       libavrdude_la-strutil.lo
  CC       libavrdude_la-teensy.lo
  CC       libavrdude_la-term.lo
  CC       libavrdude_la-usbasp.lo
  CC       libavrdude_la-serialupdi.lo
  CC       libavrdude_la-updi_link.lo
  CC       libavrdude_la-updi_state.lo
  CC       libavrdude_la-updi_readwrite.lo
  CC       libavrdude_la-updi_nvm.lo
  CC       libavrdude_la-updi_nvm_v0.lo
  CC       libavrdude_la-updi_nvm_v2.lo
  CC       libavrdude_la-updi_nvm_v3.lo
  CC       libavrdude_la-updi_nvm_v4.lo
  CC       libavrdude_la-updi_nvm_v5.lo
  CC       libavrdude_la-urclock.lo
  CC       libavrdude_la-usb_hidapi.lo
  CC       libavrdude_la-usb_libusb.lo
  CC       libavrdude_la-usbtiny.lo
  CC       libavrdude_la-update.lo
  CC       libavrdude_la-wiring.lo
  CC       libavrdude_la-xbee.lo
  CCLD     libavrdude.la
libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only
make[2]: Leaving directory '/c/work/avr/avrdude_test/avrdude_pr1681/src'
make[1]: Leaving directory '/c/work/avr/avrdude_test/avrdude_pr1681/src'

Result binary version info is fine. Note: at means autotools build)

$ ./avrdude.exe -c dryrun -p avr64dd32 -t -v

avrdude: Version 7.3-20240219 (dcc40cf5) at
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\work\avr\avrdude_test\avrdude_pr1681\src\avrdude.conf

         Using programmer      : dryrun
         AVR Part              : AVR64DD32
         Programming modes     : UPDI, SPM
         Programmer Type       : Dryrun
         Description           : Emulates programming without a programmer
         Dryrun programmer for avr64dd32
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e961a (probably avr64dd32)

avrdude: processing -t interactive terminal
avrdude> dump fuses
>>> dump fuses 0x0 0x10
Reading | ################################################## | 100% 0.04 s
0000  00 00 00 ff ff d0 08 00  00 ff ff ff ff ff ff ff  |................|
avrdude> quit

avrdude done.  Thank you.

CMake build has the version cm which denotes CMake build.

MINGW64 /c/work/avr/avrdude_test/avrdude_pr1681/build_mingw64_nt-10.0-22631/src
$ ./avrdude.exe -c dryrun -p avr64dd32 -t -v

avrdude: Version 7.3-20240219 (dcc40cf5) cm
         Copyright the AVRDUDE authors;
         see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

         System wide configuration file is C:\work\avr\avrdude_test\avrdude_pr1681\build_mingw64_nt-10.0-22631\src\avrdude.conf

         Using programmer      : dryrun
         AVR Part              : AVR64DD32
         Programming modes     : UPDI, SPM
         Programmer Type       : Dryrun
         Description           : Emulates programming without a programmer
         Dryrun programmer for avr64dd32
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e961a (probably avr64dd32)

avrdude: processing -t interactive terminal
avrdude> dump fuses
>>> dump fuses 0x0 0x10
Reading | ################################################## | 100% 0.04 s
0000  00 00 00 ff ff d0 08 00  00 ff ff ff ff ff ff ff  |................|
avrdude> quit

avrdude done.  Thank you.

@mcuee
Copy link
Collaborator

mcuee commented Feb 19, 2024

Some goals for this first round of fixing the autotools build:

Concerning both cmake and autotools builds:

  • use commit committer date instead of commit author date for generating the 7.3-20240213 type version messages containing a date (and the year in the windows resources)

@ndim

Not so sure if this can be improved or not. It seems to me Windows resources are not used for the mingw autotools build. Since this is not a regression, it can be sorted out in Part 2.

CMake build
Screenshot 2024-02-19 193306

autotools build
Screenshot 2024-02-19 193403

@mcuee
Copy link
Collaborator

mcuee commented Feb 19, 2024

Everything is good under macOS (14.3.1, Mac Mini M1 2020).

@mcuee
Copy link
Collaborator

mcuee commented Feb 19, 2024

I can also see that everything is fine under Linux from the github action run. The document build will be dealt with in part 2 (PR #1695)

@mcuee
Copy link
Collaborator

mcuee commented Feb 19, 2024

@ndim and @stefanrueger

I am happy with this PR -- assuming this PR has no conflicts with PR #1688.

@ndim
Copy link
Contributor Author

ndim commented Feb 19, 2024

Will this PR conflict with PR #1688? If that is the case, we may need to merge #1688 first and then you need to rebase your PR. Thanks.

My test merges have succeed without conflicts. Something like

git checkout main
git merge --no-ff ndim/libavrdude.h
git merge --no-ff ndim/improve-autotool-build

@ndim
Copy link
Contributor Author

ndim commented Feb 19, 2024

Apropos Testing: I have verified this works on Arch Linux, Void Linux with musl, Debian 11, Fedora 39.

The texi doc builds fail on FreeBSD 13.2.

@ndim
Copy link
Contributor Author

ndim commented Feb 19, 2024

Some goals for this first round of fixing the autotools build:

Concerning both cmake and autotools builds:

  • use commit committer date instead of commit author date for generating the 7.3-20240213 type version messages containing a date (and the year in the windows resources)

Not so sure if this can be improved or not. It seems to me Windows resources are not used for the mingw autotools build. Since this is not a regression, it can be sorted out in Part 2.

The cmake builds used the author date %ad for the year it substitutes into the windows resource file, and I have changed that to the committer date %cd. I did the same thing for the date to put into the version message: f8bb561

I have added autotools builds for Windows to the TODO list in Part 2.

I had not tried Windows builds at all. I have no Windows systems, but Fedora has a nice mingw cross compilation environment.

I have just seen the cmake build substitute a year in the RC file, that is what I have mentioned this.

@ndim
Copy link
Contributor Author

ndim commented Feb 19, 2024

The exact markers for the build systems I have chosen so far (cm and at) could certainly be changed, and their placement in the message as well.

I just wanted something short and distinct.

We could also not add a build system marker for cmake and only have a marker for Autotools builds, put the marker in a different place in the string, etc.

Or we could keep AVRDUDE_FULL_VERSION without a build system marker, and add the buildsystem information together with more detailed build information elsewhere, e.g. whether this was built with readline, linuxgpio with or without gpiod, libelf, libusb, etc.

E.g. the gphoto2 tool can print version number and build information for itself and the two libraries from a NULL terminated list of string pointers like

This version of gphoto2 is using the following software versions and options:
gphoto2         2.5.28.1       gcc, popt(m), exif, cdk, aa, jpeg, readline
libgphoto2      2.5.31         NON-STANDARD CAMLIB SET (adc65 agfa_cl20 aox ax203 barbie canon casio_qv clicksmart310 digigr8 digita dimagev dimera3500 directory docupen enigma13 fuji gsmart300 hp215 iclick jamcam jd11 jl2005a jl2005c kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica konica_qm150 largan lg_gsm lumix mars mustek panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 pccam300 pccam600 pentax polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ptp2 ricoh ricoh_g3 samsung sierra sipix_blink sipix_blink2 sipix_web2 smal sonix sony_dscf1 sony_dscf55 soundvision spca50x sq905 st2205 stv0674 stv0680 sx330z template topfield toshiba_pdrm11 tp6801), gcc, no ltdl, EXIF
libgphoto2_port 0.12.2         iolibs: disk ptpip serial usb1 usbdiskdirect usbscsi, gcc, no ltdl, EXIF, USB, serial without locking

Add the GIT_COMMIT_HASH to the version message printed by
"avrdude -?" and in the avrdude.conf avrdude_conf_version line.

So the autotools buildsystem now produces the identical
version message as the cmake buildsystem does.
@stefanrueger
Copy link
Collaborator

Or we could keep AVRDUDE_FULL_VERSION without a build system marker, and add the buildsystem information together with more detailed build information elsewhere, e.g. whether this was built with readline, linuxgpio with or without gpiod, libelf, libusb, etc.

I like that idea! If that is not too complicated, how about having the detailed info as last action in usage(), eg,

  if(verbose) {
    // Print detailed make/configuration information
  }

@ndim
Copy link
Contributor Author

ndim commented Feb 20, 2024

Or we could keep AVRDUDE_FULL_VERSION without a build system marker, and add the buildsystem information together with more detailed build information elsewhere, e.g. whether this was built with readline, linuxgpio with or without gpiod, libelf, libusb, etc.

I like that idea! If that is not too complicated, how about having the detailed info as last action in usage(), eg,

  if(verbose) {
    // Print detailed make/configuration information
  }

Isn't the usage() message already long enough as it is? I would think users run the usage message when they want to find out how to use the avrdude tool they have, not to find out detailed build information.

My idea would be to add a separate CLI parameter along the lines of GNU tools' --version | -V which prints version and copyright information and exits.

With the CLI tool and the library being separate binaries and possibly dynamically linked, it would be interesting to see version and build system info from both library and tool, with the library's info being passed through the ABI so that library users can also display that information.

This makes this whole thing start to look basically like gphoto2's --version message and the code behind it. I wrote (at least a lot of) that, so my brain tends to go there, but there are probably things I have overlooked there.

Anyway, this goes beyond this PR. Let me remove the commit with the buildsystem markers from this PR tomorrow (git revert or force push) when I am back at a computer, and postpone the implementation of a more elaborate build information message for after this PR #1681 and in or possibly even after PR #1695.

Have the autotools place their m4 files into the auto-m4/
subdir to separate them from our own m4 files.

Not using AC_CONFIG_MACRO_DIRS for backwards compatibility.
@mcuee
Copy link
Collaborator

mcuee commented Feb 21, 2024

Anyway, this goes beyond this PR. Let me remove the commit with the buildsystem markers from this PR tomorrow (git revert or force push) when I am back at a computer, and postpone the implementation of a more elaborate build information message for after this PR #1681 and in or possibly even after PR #1695.

I agree. This is a good move.

@stefanrueger
Copy link
Collaborator

along the lines of GNU tools' --version | -V

The project has been reluctant to introduce new options. But here the difficulty is more that the project doesn't have long options (yet), -v has been taken for increase verbosity and -V for do not verify. -b/-B (build info) has been taken too as has -c/-C (compilation info) ...

@ndim
Copy link
Contributor Author

ndim commented Feb 23, 2024

Anyway, the commit adding buildsystem markers to the AVRDUDE_FULL_VERSION string has been removed from this PR.

The whole build information thing (baking some build information into library and tool, and having the tool show both) has been moved to PR #1698.

@stefanrueger stefanrueger merged commit 27fe913 into avrdudes:main Feb 23, 2024
12 checks passed
@ndim ndim deleted the improve-autotool-build branch February 23, 2024 21:12
@dl8dtl
Copy link
Contributor

dl8dtl commented Feb 24, 2024

I'm not sure, but I think this is somehow related to this PR …
Everything works fine when I rund build.sh on a clone of the official AVRDUDE repo.
However, when running it on my private fork (where the official repo is only upstream remote), even with the same source tree as the official repo, I eventually get:

[ 94%] Built target libavrdude
[ 96%] Building C object src/CMakeFiles/avrdude.dir/main.c.o
/home/joerg/src/avrdude/src/main.c:55:23: error: use of undeclared identifier 'AVRDUDE_FULL_VERSION'
char * version      = AVRDUDE_FULL_VERSION;

@mcuee
Copy link
Collaborator

mcuee commented Feb 24, 2024

@dl8dtl

That sounds strange. I have just tried under FreeBSD 14 release and a fresh clone of my fork, no issues to build avrdude using build.sh. Maybe you want to clone your fork again.

mcuee@freebsd14vmn100:~/build $ uname -r
14.0-RELEASE

mcuee@freebsd14vmn100:~/build/avrdude_mcuee $ cmake --version
cmake version 3.26.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

mcuee@freebsd14vmn100:~/build $ git clone https://github.com/mcuee/avrdude.git avrdude_mcuee
Cloning into 'avrdude_mcuee'...
remote: Enumerating objects: 20169, done.
remote: Counting objects: 100% (628/628), done.
remote: Compressing objects: 100% (285/285), done.
remote: Total 20169 (delta 372), reused 541 (delta 335), pack-reused 19541
Receiving objects: 100% (20169/20169), 12.01 MiB | 16.32 MiB/s, done.
Resolving deltas: 100% (14523/14523), done.
mcuee@freebsd14vmn100:~/build $ cd avrdude_mcuee/
mcuee@freebsd14vmn100:~/build/avrdude_mcuee $ ./build.sh
-- The C compiler identification is Clang 16.0.6
-- 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.42.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 - 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 - found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - found
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DO HAVE    libreadline
-- DO HAVE    libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/avrdude_mcuee/build_freebsd
[  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
[ 11%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o
[ 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
[ 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_freebsd --target install

to install.

@mcuee
Copy link
Collaborator

mcuee commented Feb 25, 2024

@dl8dtl

Interestingly I just reproduced your issue under MSYS2 mingw64 with clone from official avrdude, and the solution is the same -- redo the clone. I am not so sure what is the issue though. Occassionally there is the issue of getting wrong version number. And the solution has always the same for me -- to delete the local repo and clone again.

Note: I have delete the build directory before the build but it does not help.

MINGW64 /c/work/avr/avrdude_test/avrdude_main
$ rm -rf build_mingw64_nt-10.0-22631/

$ ./build.sh
-- Building for: Ninja
-- The C compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: C:/msys64/usr/bin/git.exe (found version "2.43.0")
-- Found FLEX: C:/msys64/usr/bin/flex.exe (found version "2.6.4")
-- Found BISON: C:/msys64/usr/bin/bison.exe (found version "3.8.2")
-- Looking for libelf.h
-- Looking for libelf.h - found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - found
-- Looking for usb.h
-- Looking for usb.h - not found
-- Looking for lusb0_usb.h
-- Looking for lusb0_usb.h - found
-- Looking for libusb.h
-- Looking for libusb.h - not found
-- Looking for libusb-1.0/libusb.h
-- Looking for libusb-1.0/libusb.h - found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - found
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DO HAVE    libreadline
-- DO HAVE    libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done (9.3s)
-- Generating done (0.0s)
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631
[64/77] Building C object src/CMakeFiles/avrdude.dir/main.c.obj
FAILED: src/CMakeFiles/avrdude.dir/main.c.obj
C:\msys64\mingw64\bin\cc.exe -DCONFIG_DIR="\"C:/Program Files (x86)/avrdude/etc\"" -IC:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631/src -IC:/work/avr/avrdude_test/avrdude_main -IC:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631 -IC:/work/avr/avrdude_test/avrdude_main/src -IC:/msys64/mingw64/include/libusb-compat -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/avrdude.dir/main.c.obj -MF src\CMakeFiles\avrdude.dir\main.c.obj.d -o src/CMakeFiles/avrdude.dir/main.c.obj -c C:/work/avr/avrdude_test/avrdude_main/src/main.c
C:/work/avr/avrdude_test/avrdude_main/src/main.c:55:23: error: 'AVRDUDE_FULL_VERSION' undeclared here (not in a function)
   55 | char * version      = AVRDUDE_FULL_VERSION;
      |                       ^~~~~~~~~~~~~~~~~~~~
[73/77] Building C object src/CMakeFiles/avrdude.dir/developer_opts.c.obj
ninja: build stopped: subcommand failed.
Build failed.

Once I reclone the repo, it works fine,

MINGW64 /c/work/avr/avrdude_test/avrdude_main
$ ./build.sh
-- Building for: Ninja
-- The C compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: C:/msys64/usr/bin/git.exe (found version "2.43.0")
-- Found FLEX: C:/msys64/usr/bin/flex.exe (found version "2.6.4")
-- Found BISON: C:/msys64/usr/bin/bison.exe (found version "3.8.2")
-- Looking for libelf.h
-- Looking for libelf.h - found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - found
-- Looking for usb.h
-- Looking for usb.h - not found
-- Looking for lusb0_usb.h
-- Looking for lusb0_usb.h - found
-- Looking for libusb.h
-- Looking for libusb.h - not found
-- Looking for libusb-1.0/libusb.h
-- Looking for libusb-1.0/libusb.h - found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - found
-- Looking for ftdi_tcioflush
-- Looking for ftdi_tcioflush - found
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DO HAVE    libreadline
-- DO HAVE    libserialport
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done (6.0s)
-- Generating done (0.0s)
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_main/build_mingw64_nt-10.0-22631
[77/77] Linking C executable src\avrdude.exe

Build succeeded.

Run

sudo cmake --build build_mingw64_nt-10.0-22631 --target install

to install.

@mcuee
Copy link
Collaborator

mcuee commented Feb 25, 2024

@MCUdude and @stefanrueger

Just wondering if you see such issues when using CMake.

  1. build failure due AVRDUDE_FULL_VERSION;
  2. avrdude binary has the wrong date info whereas avrdude.conf has the right date and git commit info.

@mcuee
Copy link
Collaborator

mcuee commented Feb 25, 2024

I do not think this is PR is directly linked to Issue #1706.

It may have something to do with git and avrdude's build script.

As mentioned before, I've encounter below issue as well under MSYS2 mingw64 and macOS Homebrew (Mac Mini M1). Re-clone the repo will sort out the issue.

avrdude binary has the wrong date info whereas avrdude.conf has the right date and git commit info.

@ndim
Copy link
Contributor Author

ndim commented Feb 25, 2024

@MCUdude and @stefanrueger

Just wondering if you see such issues when using CMake.

1. build failure due `AVRDUDE_FULL_VERSION;`

2. avrdude binary has the wrong date info whereas `avrdude.conf` has the right date and git commit info.

This is consistent with a rogue old src/ac_cfg.h lying around while building in build_$ostype/src.

I am reading up on cmake to add a check for such rogue files, and to fix the sequence of directories the C preprocessor looks for ac_cfg.h. Details in #1706.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants