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 autotools build (part 2/n) #1695

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

ndim
Copy link
Contributor

@ndim ndim commented Feb 19, 2024

This is a continuation which is based on #1681 to keep the PR sizes manageable both for the submitter and the reviewers.

Starting this as a Draft PR, expect rebases and force-pushing, e.g. rebasing to main after PR #1681 has been merged to main.

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

  • let autotools build use libavrdude VERSION and SOVERSION from cmake build, and define useful rules for the values
  • let the default rules automake generates build HTML, PDF, PS from texi (PostScript? really? does cmake even build avrdude.ps?)
  • deprecate --enable-versioned-doc, have people use --docdir to deviate from the default docdir
  • make the doc builds work for out of tree builds, and therefore the whole thing
  • get rid of recursive make for doc builds, allowing direct building of the generated *.texi files
  • fix the warnings generated at autoreconf runs with the automake -Wall option
  • make builds on NetBSD succeed out of the box
  • make builds on OpenBSD succeed out of the box
  • fix the FreeBSD doc build (texi part), possibly more
  • document the tip to try "gmake" if present
  • get rid of non-libtool library (_LIBRARIES)
  • add resource file to Windows builds
  • support the release process, as described in Improve autotool build (part 1/n) #1681 (comment)

Concerning both cmake and autotools builds:

  • nothing at this time

Optionally, move $top_srcdir/src/configure.ac to $top_srcdir/configure.ac:

  • include README.md, NEWS, and especially COPYING into make dist tarball
  • include 'CMakeLists.txt' etc. to allow cmake builds from the dist tarball
  • have make check run tools/test-avrdude, so make distcheck would cover everything in CI builds and the compile and install stages will only need to run once during make distcheck (about halves the CPU cycles needed for autotools CI builds)
  • allows shipping a dist source tarball after some processing, e.g. with complete version information, for both releases and snapshots
  • have cmake builds use the version information recorded in the dist tarball
  • to distinguish the dist tarballs from the release and snapshot tarballs generated by Github, make the dist tarballs .tar.xz and the Github tarballs .tar.gz
  • generate dist tarballs as part of CI builds for commits and releases, and add the dist tarball to the release assets

@mcuee mcuee added the enhancement New feature or request label Feb 19, 2024
@mcuee
Copy link
Collaborator

mcuee commented Feb 19, 2024

  • let the default rules automake generates build HTML, PDF, PS from texi (PostScript? really? does cmake even build avrdude.ps?)

@ndim

Yes CMake does build ps file.

Example run from git main (Linux x86_64 github action build).
https://github.com/avrdudes/avrdude/actions/runs/7908340304/job/21587300733

[ 65%] Linking C executable avrdude
[ 65%] Built target avrdude
[ 65%] Built target avrdude_binaries
[ 66%] Generating version.texi
[ 67%] Generating programmers.txt
[ 68%] Generating programmers.texi
[ 69%] Generating programmer_types.txt
[ 70%] Generating programmer_types.texi
[ 71%] Generating parts.txt
[ 72%] Generating parts.texi
[ 72%] Generating avrdude.info
[ 72%] Built target info
[ 73%] Generating avrdude.dvi
[ 79%] Built target dvi
[ 80%] Generating avrdude.pdf
[ 86%] Built target pdf
[ 86%] Generating avrdude.ps
[ 93%] Built target ps
[ 94%] Generating avrdude-html/avrdude.html
[100%] Built target html

It also installs ps file.

Run sudo cmake --build build --target install
[  1%] Built target conf
[ 62%] Built target libavrdude
[ 65%] Built target avrdude
[ 65%] Built target avrdude_binaries
[ 72%] Built target info
[ 79%] Built target dvi
[ 86%] Built target pdf
[ 93%] Built target ps
[100%] Built target html
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/bin/avrdude
-- 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
-- Installing: /usr/local/share/info/avrdude.info
-- Installing: /usr/local/share/doc/avrdude/avrdude.dvi
-- Installing: /usr/local/share/doc/avrdude/avrdude.pdf
-- Installing: /usr/local/share/doc/avrdude/avrdude.ps
-- Installing: /usr/local/share/doc/avrdude/avrdude-html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_3.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_4.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_10.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_21.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_31.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_16.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_35.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_24.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_42.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_26.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_17.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_28.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_6.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_43.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_19.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_18.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_41.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_12.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_9.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_34.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_37.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_40.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_abt.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_33.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_29.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_23.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_32.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_11.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_7.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_1.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_5.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_36.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_15.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_toc.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_8.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_2.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_20.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_22.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_25.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_27.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_39.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_30.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_13.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_14.html
-- Installing: /usr/local/share/doc/avrdude/avrdude-html/avrdude_38.html

@mcuee mcuee added this to the AVRDUDE 7.4 milestone Feb 20, 2024
@ndim ndim force-pushed the improve-autotools-build-part-2 branch 2 times, most recently from eb8130a to 849fa5e Compare February 21, 2024 08:36
@mcuee
Copy link
Collaborator

mcuee commented Feb 24, 2024

@ndim

Strange, somehow the auto-tools build is also broken on my FreeBSD 14 Release system (virtual machine under Proxmox PVE 8.0, Intel N100 mini PC).

Two issues.

  1. It can not detect libserialport properly.
  2. The build failed.

And it is the same for git main or avrdude-7.3 release.

I remember it was working last time, probably on another FreeBSD system.

Please check on your FreeBSD system as well. If it is broken, then please add the task to fix FreeBSD autotools build as well.

BTW, I am using latest git main (5c61b9e) and not this PR.

build log under FreeBSD 14 for git main
mcuee@freebsd14vmn100:~/build/avrdude/src $ ./bootstrap
+ rm -rf autom4te.cache
+ LIBTOOLIZE=libtoolize
+ glibtoolize --version
+ export LIBTOOLIZE
+ autoreconf -i
mcuee@freebsd14vmn100:~/build/avrdude/src $ CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure
checking build system type... amd64-unknown-freebsd14.0
checking host system type... amd64-unknown-freebsd14.0
checking target system type... amd64-unknown-freebsd14.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./auto-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
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... 20240224
checking versioninfo item GIT_COMMIT_HASH... 5c61b9e7
checking versioninfo item GIT_TAG_HASH... e599214c
checking versioninfo derived PACKAGE_VERSION... 7.3-20240224
checking versioninfo derived AVRDUDE_FULL_VERSION... 7.3-20240224 (5c61b9e7)
checking for gcc... no
checking for cc... cc
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 cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking whether cc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of cc... gcc3
checking for gawk... (cached) nawk
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 cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 393216
checking how to convert amd64-unknown-freebsd14.0 file names to amd64-unknown-freebsd14.0 format... func_convert_file_noop
checking how to convert amd64-unknown-freebsd14.0 file names to toolchain format... func_convert_file_noop
checking for /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 output from cc 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... mt
checking if mt 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... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd14.0 ld.so
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... 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... yes
checking for libelf/libelf.h... no
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... no
checking for libusb_init in -lusb... yes
checking for libusb.h... yes
checking for library containing hid_init... -lhidapi
checking for hidapi/hidapi.h... yes
checking for sp_open in -lserialport... no
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... /dev/cuad0
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: ac_cfg.h is unchanged
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
DON'T HAVE libserialport
DO HAVE    pthread
DISABLED   doc
DISABLED   parport
DISABLED   linuxgpio
DISABLED   linuxspi

mcuee@freebsd14vmn100:~/build/avrdude/src $ make V=1
/bin/sh ./auto-aux/ylwrap config_gram.y y.tab.c config_gram.c y.tab.h `echo config_gram.c | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/  -e s/c++$/h++/ -e s/c$/h/` y.output config_gram.output -- bison -y -d
updating config_gram.h
/bin/sh ./auto-aux/ylwrap lexer.l lex.yy.c lexer.c -- flex
make  all-recursive
Making all in .
cc -DHAVE_CONFIG_H -I.  -DCONFIG_DIR=\"/usr/local/etc\"  -Wall -Wextra -Wno-unused-parameter -I/usr/local/include -MT avrdude-main.o -MD -MP -MF .deps/avrdude-main.Tpo -c -o avrdude-main.o `test -f 'main.c' || echo './'`main.c
mv -f .deps/avrdude-main.Tpo .deps/avrdude-main.Po
cc -DHAVE_CONFIG_H -I.  -DCONFIG_DIR=\"/usr/local/etc\"  -Wall -Wextra -Wno-unused-parameter -I/usr/local/include -MT avrdude-whereami.o -MD -MP -MF .deps/avrdude-whereami.Tpo -c -o avrdude-whereami.o `test -f 'whereami.c' || echo './'`whereami.c
mv -f .deps/avrdude-whereami.Tpo .deps/avrdude-whereami.Po
cc -DHAVE_CONFIG_H -I.  -DCONFIG_DIR=\"/usr/local/etc\"  -Wall -Wextra -Wno-unused-parameter -I/usr/local/include -MT avrdude-developer_opts.o -MD -MP -MF .deps/avrdude-developer_opts.Tpo -c -o avrdude-developer_opts.o `test -f 'developer_opts.c' || echo './'`developer_opts.c
mv -f .deps/avrdude-developer_opts.Tpo .deps/avrdude-developer_opts.Po
make[2]: don't know how to make ./libavrdude.a. Stop

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

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

Stop.
make: stopped in /home/mcuee/build/avrdude/src

No issues to use CMake.

CMake build log of git main
mcuee@freebsd14vmn100:~/build/avrdude $ ./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/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.

@ndim
Copy link
Contributor Author

ndim commented Feb 24, 2024

One thing to try on systems where GNU make is not the default make tool is always to try GNU make (often called gmake on those systems like FreeBSD or OSX).

Also, the non-libtool library needs to go.

@mcuee
Copy link
Collaborator

mcuee commented Feb 25, 2024

@ndim

Ah, I see. Once I use gmake, the build is fine. Now the only issue is why libserialport is not detected.

mcuee@freebsd14vmn100:~/build/avrdude/src $ pkg-config --cflags libserialport
-I/usr/local/include
mcuee@freebsd14vmn100:~/build/avrdude/src $ pkg-config --libs libserialport
-L/usr/local/lib -lserialport
mcuee@freebsd14vmn100:~/build/libserialport $ cat /usr/local/lib/pkgconfig/libserialport.pc
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libserialport
Description: Cross-platform serial port access library.
URL: http://sigrok.org/wiki/Libserialport
Requires.private: libusb-2.0
Version: 0.1.1
Libs: -L${libdir} -lserialport
Libs.private:
Cflags: -I${includedir}
using gmake and the build is fine
mcuee@freebsd14vmn100:~/build/avrdude $ cd src/
mcuee@freebsd14vmn100:~/build/avrdude/src $ ./bootstrap
+ rm -rf autom4te.cache
+ LIBTOOLIZE=libtoolize
+ glibtoolize --version
+ export LIBTOOLIZE
+ autoreconf -i
mcuee@freebsd14vmn100:~/build/avrdude/src $ CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure
checking build system type... amd64-unknown-freebsd14.0
checking host system type... amd64-unknown-freebsd14.0
checking target system type... amd64-unknown-freebsd14.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./auto-aux/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
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... 20240224
checking versioninfo item GIT_COMMIT_HASH... 5c61b9e7
checking versioninfo item GIT_TAG_HASH... e599214c
checking versioninfo derived PACKAGE_VERSION... 7.3-20240224
checking versioninfo derived AVRDUDE_FULL_VERSION... 7.3-20240224 (5c61b9e7)
checking for gcc... no
checking for cc... cc
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 cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking whether cc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of cc... gcc3
checking for gawk... (cached) nawk
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 cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 393216
checking how to convert amd64-unknown-freebsd14.0 file names to amd64-unknown-freebsd14.0 format... func_convert_file_noop
checking how to convert amd64-unknown-freebsd14.0 file names to toolchain format... func_convert_file_noop
checking for /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 output from cc 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... mt
checking if mt 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... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd14.0 ld.so
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... 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... yes
checking for libelf/libelf.h... no
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... no
checking for libusb_init in -lusb... yes
checking for libusb.h... yes
checking for library containing hid_init... -lhidapi
checking for hidapi/hidapi.h... yes
checking for sp_open in -lserialport... no
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... /dev/cuad0
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: ac_cfg.h is unchanged
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
DON'T HAVE libserialport
DO HAVE    pthread
DISABLED   doc
DISABLED   parport
DISABLED   linuxgpio
DISABLED   linuxspi
mcuee@freebsd14vmn100:~/build/avrdude/src $ gmake
gmake  all-recursive
gmake[1]: Entering directory '/home/mcuee/build/avrdude/src'
Making all in .
gmake[2]: Entering directory '/home/mcuee/build/avrdude/src'
  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
  CCLD     avrdude
  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
gmake[2]: Leaving directory '/home/mcuee/build/avrdude/src'
gmake[1]: Leaving directory '/home/mcuee/build/avrdude/src'
mcuee@freebsd14vmn100:~/build/avrdude/src $ ldd ./avrdude
./avrdude:
        libusb.so.3 => /usr/lib/libusb.so.3 (0x11af344bb000)
        libelf.so.2 => /lib/libelf.so.2 (0x11af34f33000)
        libthr.so.3 => /lib/libthr.so.3 (0x11af359b8000)
        libm.so.5 => /lib/libm.so.5 (0x11af363c6000)
        libhidapi.so.0 => /usr/local/lib/libhidapi.so.0 (0x11af372b0000)
        libreadline.so.8 => /usr/local/lib/libreadline.so.8 (0x11af372cc000)
        libncursesw.so.9 => /lib/libncursesw.so.9 (0x11af37503000)
        libtinfow.so.9 => /lib/libtinfow.so.9 (0x11af392c0000)
        libftdi1.so.2 => /usr/local/lib/libftdi1.so.2 (0x11af3771d000)
        libc.so.7 => /lib/libc.so.7 (0x11af37ebf000)
        libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x11af398cb000)
        [vdso] (0x11af339af000)

@ndim
Copy link
Contributor Author

ndim commented Feb 25, 2024

Not using pkgconfig for anything yet.

@mcuee
Copy link
Collaborator

mcuee commented Feb 25, 2024

Not using pkgconfig for anything yet.

I understand. On the other hand, I do not see why libserialport is special in this aspect, it is the same for other dependancies.

BTW, it is a bit strange that I need to use CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" for FreeBSD. By right you do not need to do anything if the library is located under /usr or /usr/local.

@dl8dtl
Copy link
Contributor

dl8dtl commented Feb 25, 2024

Once I use gmake, the build is fine.

gmake was basically already required before, in particular when trying to run parallel jobs (-j <N>).
I never tried to analyze what was the reason, but given that the auto tools are GNUish, it's probably not surprising that they are only really tested inside the GNU ecosystem.

This transfers the information from the CMakeLists.txt
libavrdude VERSION and SOVERSION into the autotools
configure script and AC_SUBST into every Makefile.

This information is completely unused at this time.
  * move autotools package related files to top_srcdir:
    configure.ac, avrdude.spec.in, bootstrap

  * ship all files required to build with cmake

  * new tar format for dist tarball allowing longer filenames
    for the tools/test_files/*.hex files

  * new dist tarball compression method to make it use a different
    filename `*.tar.xz` than github's snapshot and release
    tarballs `*.tar.gz`
@ndim ndim force-pushed the improve-autotools-build-part-2 branch from 849fa5e to 77edcdb Compare February 29, 2024 07:23
@mcuee mcuee removed this from the AVRDUDE 7.4 milestone May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants