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

Enhance CMake to be able to support static link for Linux and macOS #1159

Open
mcuee opened this issue Oct 25, 2022 · 62 comments
Open

Enhance CMake to be able to support static link for Linux and macOS #1159

mcuee opened this issue Oct 25, 2022 · 62 comments
Labels
enhancement New feature or request

Comments

@mcuee
Copy link
Collaborator

mcuee commented Oct 25, 2022

Ref:

#962 has been merged and the option to use static lib or dynamic lib was added. But it has not been implemented yet.

@mariusgreuel wrote in the pull request comments.

Note that the CMake files now include the option USE_STATIC_LIBS, which people can use to select either static or dynamic linking. Note, however, that I leave the implementation for somebody else in a separate PR. The current implementation will not work for non-defaults, i.e. statically linking for Linux or dynamically on Windows.

Indeed git main static link build for Linux and macOS failed. This may pose some challenges for Arduino people. Maybe @umbynos wants to take a look. I think the fix may not be too complicated but it does involve changing CMake files.

Failed build log:
https://github.com/mcuee/avrdude/actions/runs/3312632411

This will also help the following issue.

Take note this issue is different from the following issue.

Therefore the following pull-request will not help.
* https://github.com/avrdudes/avrdude/

@mcuee mcuee added the enhancement New feature or request label Oct 25, 2022
@mcuee
Copy link
Collaborator Author

mcuee commented Oct 25, 2022

We can see that Arduino is using the following patch on top of avrdude 7.0 release to link to static libraries. But it does not seem to work with git main as of now.
https://github.com/arduino/avrdude-packing/blob/main/patches/0005-Cmake-always-prefer-static-libraries.patch

@danapplegate
Copy link
Contributor

I can try to do some digging into this tonight for MacOS. I don't know much about cmake, but I did have a lot of trouble building on MacOS (using homebrew) recently when trying to solve another issue.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 25, 2022

I can try to do some digging into this tonight for MacOS. I don't know much about cmake, but I did have a lot of trouble building on MacOS (using homebrew) recently when trying to solve another issue.

@danapplegate
Thanks a lot for the help. The issue is how to pull in the necessary dependancies of the static libraries (libelf, libusb-1.0, libusb-compat-0.1, libftdi, hidapi, readline). Unfortunately I do not know enough CMake to fix this issue.

Please also give the current git main and the following PR a try as well. Thanks.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 26, 2022

Just an example under Linux.

 $ cmake -D DEBUG_CMAKE=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo -D USE_STATIC_LIBS=ON 
-D CMAKE_VERBOSE_MAKEFILE=ON  -B build_static
 $ cmake --build build_static
...
[ 98%] Linking C executable avrdude
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/usr/bin/cc -O2 -g -DNDEBUG   CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/term.c.o 
CMakeFiles/avrdude.dir/avrintel.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o  
-o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a 
/usr/local/lib/libhidapi-libusb.a /usr/lib/x86_64-linux-gnu/libftdi.a /usr/local/lib/libftdi1.a 
/usr/lib/x86_64-linux-gnu/libreadline.a 
...

We can see that the dependancies are not pulled in, like libudev, pthread, etc. Please also take note that pkg-config is also not very reliable for static build.

$ pkg-config --static --libs libusb
-L/usr/local/lib -lusb -lusb-1.0 -ludev -lpthread

$ pkg-config --static --libs libftdi1
-L/usr/local/lib -lftdi1 -lusb-1.0 -ludev -lpthread

$ pkg-config --static --libs readline
-lreadline -Wl,-Bsymbolic-functions -ltinfo

$ pkg-config --static --libs hidapi-libusb 
-L/usr/local/lib -lhidapi-libusb

$ pkg-config --static --libs hidapi-hidraw 
-L/usr/local/lib -lhidapi-hidraw

$ pkg-config --static --libs libelf
-lelf -lz

Once we add them, it will work.

$ /usr/bin/cc -O2 -g -DNDEBUG   CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/term.c.o CMakeFiles/avrdude.dir/avrintel.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o  -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/lib/x86_64-linux-gnu/libftdi.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a -lz -ludev -lpthread -ltinfo -lz

$ ldd avrdude
	linux-vdso.so.1 (0x00007ffc5ad9d000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe17e69f000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fe17e683000)
	libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007fe17e656000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe17e633000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fe17e603000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe17e411000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fe17e967000)


@danapplegate
Copy link
Contributor

@mcuee Ok, calling it quits for tonight, but I was able to get through compilation using USE_STATIC_LIBS=ON. Unfortunately, I'm now getting some gnarly failures in the linker step.

First, I noticed that it appeared that CMake was not properly finding the header files installed by Homebrew in /usr/local/include.

Example output from cmake configure step

applegatedt@Daniels-MBP-2 avrdude % cmake -D DEBUG_CMAKE=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_static
-- The C compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/local/bin/git (found version "2.35.1")
-- Found FLEX: /usr/bin/flex (found version "2.6.4")
-- Found BISON: /usr/bin/bison (found version "2.3")
-- Looking for libelf.h
-- Looking for libelf.h - not found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - not found
-- Looking for usb.h
-- Looking for usb.h - not found
-- Looking for lusb0_usb.h
-- Looking for lusb0_usb.h - not 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 - not found
-- Looking for hidapi/hidapi.h
-- Looking for hidapi/hidapi.h - not found
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Darwin-20.6.0
-- CMAKE_SYSTEM: Darwin-20.6.0
-- CMAKE_FIND_ROOT_PATH:
-- CMAKE_C_COMPILER: /Library/Developer/CommandLineTools/usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.0-20221024 (5862a5b)
-- USE_EXTERNAL: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /usr/local/lib/libelf.a
-- HAVE_LIBUSB: /usr/local/lib/libusb.a
-- HAVE_LIBUSB_1_0: /usr/local/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHID: /usr/local/lib/libhid.dylib
-- HAVE_LIBHIDAPI: /usr/local/lib/libhidapi.dylib
-- HAVE_LIBFTDI: /usr/local/lib/libftdi.a
-- HAVE_LIBFTDI1: HAVE_LIBFTDI1-NOTFOUND
-- HAVE_LIBREADLINE: HAVE_LIBREADLINE-NOTFOUND
-- HAVE_LIBELF_H:
-- HAVE_LIBELF_LIBELF_H:
-- HAVE_USB_H:
-- HAVE_LUSB0_USB_H:
-- HAVE_LIBUSB_H:
-- HAVE_LIBUSB_1_0_LIBUSB_H:
-- HAVE_HIDAPI_HIDAPI_H:
-- LIBUSB_COMPAT_DIR:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DO HAVE    libftdi
-- DON'T HAVE libftdi1
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/applegatedt/workspace/avrdude/build_static

I fixed this by setting -D CMAKE_C_FLAGS=-I/usr/local/include to tell cmake to look at the correct directory for include files.

Configure step output with CMAKE_C_FLAGS=-I/usr/local/include

applegatedt@Daniels-MBP-2 avrdude % cmake -D DEBUG_CMAKE=1 -D CMAKE_BUILD_TYPE=RelWithDebInfo -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -D CMAKE_C_FLAGS=-I/usr/local/include -B build_static
-- The C compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/local/bin/git (found version "2.35.1")
-- Found FLEX: /usr/bin/flex (found version "2.6.4")
-- Found BISON: /usr/bin/bison (found version "2.3")
-- Looking for libelf.h
-- Looking for libelf.h - not found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - 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 - 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
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Darwin-20.6.0
-- CMAKE_SYSTEM: Darwin-20.6.0
-- CMAKE_FIND_ROOT_PATH:
-- CMAKE_C_COMPILER: /Library/Developer/CommandLineTools/usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.0-20221024 (5862a5b)
-- USE_EXTERNAL: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /usr/local/lib/libelf.a
-- HAVE_LIBUSB: /usr/local/lib/libusb.a
-- HAVE_LIBUSB_1_0: /usr/local/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHID: /usr/local/lib/libhid.dylib
-- HAVE_LIBHIDAPI: /usr/local/lib/libhidapi.dylib
-- HAVE_LIBFTDI: /usr/local/lib/libftdi.a
-- HAVE_LIBFTDI1: HAVE_LIBFTDI1-NOTFOUND
-- HAVE_LIBREADLINE: HAVE_LIBREADLINE-NOTFOUND
-- HAVE_LIBELF_H:
-- HAVE_LIBELF_LIBELF_H: 1
-- HAVE_USB_H: 1
-- HAVE_LUSB0_USB_H:
-- HAVE_LIBUSB_H:
-- HAVE_LIBUSB_1_0_LIBUSB_H: 1
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DO HAVE    libftdi
-- DON'T HAVE libftdi1
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/applegatedt/workspace/avrdude/build_static

Now, I am getting "Undefined symbols for architecture x86_64" from trying to link the libusb-1.0.a(darwin_usb.o) library:

[100%] Linking C executable avrdude
cd /Users/applegatedt/workspace/avrdude/build_static/src && /usr/local/Cellar/cmake/3.24.2/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.6 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/binutils/lib -L/usr/local/opt/[email protected]/lib CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/term.c.o CMakeFiles/avrdude.dir/avrintel.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /usr/local/lib/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhid.dylib /usr/local/lib/libhidapi.dylib /usr/local/lib/libftdi.a
Undefined symbols for architecture x86_64:
  "_CFBooleanGetTypeID", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
  "_CFBooleanGetValue", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
  "_CFDataGetBytes", referenced from:
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
  "_CFDataGetLength", referenced from:
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
  "_CFDataGetTypeID", referenced from:
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
  "_CFDictionaryCreateMutable", referenced from:
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
  "_CFDictionarySetValue", referenced from:
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
  "_CFGetTypeID", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(darwin_usb.o)
  "_CFNumberCreate", referenced from:
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
  "_CFNumberGetTypeID", referenced from:
      _get_ioregistry_value_number in libusb-1.0.a(darwin_usb.o)
  "_CFNumberGetValue", referenced from:
      _get_ioregistry_value_number in libusb-1.0.a(darwin_usb.o)
  "_CFRelease", referenced from:
      _darwin_close in libusb-1.0.a(darwin_usb.o)
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(darwin_usb.o)
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
      ...
  "_CFRetain", referenced from:
      _darwin_open in libusb-1.0.a(darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_CFRunLoopAddSource", referenced from:
      _darwin_open in libusb-1.0.a(darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(darwin_usb.o)
  "_CFRunLoopGetCurrent", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_CFRunLoopRemoveSource", referenced from:
      _darwin_close in libusb-1.0.a(darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(darwin_usb.o)
  "_CFRunLoopRun", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_CFRunLoopSourceCreate", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_CFRunLoopSourceSignal", referenced from:
      _darwin_exit in libusb-1.0.a(darwin_usb.o)
  "_CFRunLoopStop", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_CFRunLoopWakeUp", referenced from:
      _darwin_exit in libusb-1.0.a(darwin_usb.o)
  "_CFUUIDGetConstantUUIDWithBytes", referenced from:
      _darwin_device_from_service in libusb-1.0.a(darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(darwin_usb.o)
  "_CFUUIDGetUUIDBytes", referenced from:
      _darwin_device_from_service in libusb-1.0.a(darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(darwin_usb.o)
  "_IOCreatePlugInInterfaceForService", referenced from:
      _darwin_device_from_service in libusb-1.0.a(darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(darwin_usb.o)
  "_IOIteratorNext", referenced from:
      _darwin_init in libusb-1.0.a(darwin_usb.o)
      _process_new_device in libusb-1.0.a(darwin_usb.o)
      _darwin_devices_detached in libusb-1.0.a(darwin_usb.o)
      _darwin_devices_attached in libusb-1.0.a(darwin_usb.o)
      _darwin_clear_iterator in libusb-1.0.a(darwin_usb.o)
      _darwin_get_interface in libusb-1.0.a(darwin_usb.o)
  "_IOKitWaitQuiet", referenced from:
      _darwin_hotplug_poll in libusb-1.0.a(darwin_usb.o)
  "_IONotificationPortCreate", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_IONotificationPortDestroy", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_IONotificationPortGetRunLoopSource", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_IOObjectRelease", referenced from:
      _darwin_init in libusb-1.0.a(darwin_usb.o)
      _darwin_kernel_driver_active in libusb-1.0.a(darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
      _process_new_device in libusb-1.0.a(darwin_usb.o)
      _darwin_devices_detached in libusb-1.0.a(darwin_usb.o)
      _darwin_devices_attached in libusb-1.0.a(darwin_usb.o)
      ...
  "_IOObjectRetain", referenced from:
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
  "_IORegistryEntryCreateCFProperty", referenced from:
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(darwin_usb.o)
  "_IORegistryEntryGetChildEntry", referenced from:
      _darwin_kernel_driver_active in libusb-1.0.a(darwin_usb.o)
  "_IORegistryEntryGetParentEntry", referenced from:
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
  "_IOServiceAddMatchingNotification", referenced from:
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
  "_IOServiceAuthorize", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
  "_IOServiceGetMatchingService", referenced from:
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
  "_IOServiceGetMatchingServices", referenced from:
      _darwin_init in libusb-1.0.a(darwin_usb.o)
  "_IOServiceMatching", referenced from:
      _darwin_init in libusb-1.0.a(darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
  "_SecTaskCopyValueForEntitlement", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
  "_SecTaskCreateFromSelf", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
  "___CFConstantStringClassReference", referenced from:
      CFString in libusb-1.0.a(darwin_usb.o)
      CFString in libusb-1.0.a(darwin_usb.o)
      CFString in libusb-1.0.a(darwin_usb.o)
      CFString in libusb-1.0.a(darwin_usb.o)
      CFString in libusb-1.0.a(darwin_usb.o)
      CFString in libusb-1.0.a(darwin_usb.o)
      CFString in libusb-1.0.a(darwin_usb.o)
      ...
  "_kCFAllocatorDefault", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
      _get_ioregistry_value_number in libusb-1.0.a(darwin_usb.o)
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
  "_kCFAllocatorSystemDefault", referenced from:
      _darwin_device_from_service in libusb-1.0.a(darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(darwin_usb.o)
  "_kCFRunLoopCommonModes", referenced from:
      _darwin_open in libusb-1.0.a(darwin_usb.o)
  "_kCFRunLoopDefaultMode", referenced from:
      _darwin_close in libusb-1.0.a(darwin_usb.o)
      _darwin_event_thread_main in libusb-1.0.a(darwin_usb.o)
      _darwin_release_interface in libusb-1.0.a(darwin_usb.o)
      _darwin_claim_interface in libusb-1.0.a(darwin_usb.o)
  "_kCFTypeDictionaryKeyCallBacks", referenced from:
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
  "_kCFTypeDictionaryValueCallBacks", referenced from:
      _usb_find_interface_matching_location in libusb-1.0.a(darwin_usb.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/avrdude] Error 1
make[1]: *** [src/CMakeFiles/avrdude.dir/all] Error 2
make: *** [all] Error 2

If anyone has any suggestions, I'm all ears.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 26, 2022

@danapplegate You need to specify the CMake option as per here.

Default dynamic link option:
https://github.com/avrdudes/avrdude/wiki/Building-AVRDUDE-for-macOS

cmake -D CMAKE_C_FLAGS=-I/usr/local/include 
-D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar 
-D CMAKE_BUILD_TYPE=RelWithDebInfo 
-B build_macos

For static link option, and for debugging, I will suggest you use the following option (it will fail in the last step, similar to my build log here: https://github.com/mcuee/avrdude/actions/runs/3312632411/jobs/5469546749).

cmake -D CMAKE_C_FLAGS=-I/usr/local/include 
-D CMAKE_EXE_LINKER_FLAGS=-L/usr/local/Cellar 
-D CMAKE_BUILD_TYPE=RelWithDebInfo 
-D DEBUG_CMAKE=1 
-D USE_STATIC_LIBS=ON 
-D CMAKE_VERBOSE_MAKEFILE=ON  
-B build_macos

@danapplegate
Copy link
Contributor

@mcuee Yeah, even with CMAKE_EXE_LINKER_FLAGS provided, I'm still getting the "Undefined symbols" messages.

[100%] Linking C executable avrdude
cd /Users/applegatedt/workspace/avrdude/build_static/src && /usr/local/Cellar/cmake/3.24.2/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.6 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/Cellar CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/term.c.o CMakeFiles/avrdude.dir/avrintel.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /usr/local/lib/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhid.dylib /usr/local/lib/libhidapi.dylib /usr/local/lib/libftdi.a
Undefined symbols for architecture x86_64:
  "_CFBooleanGetTypeID", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
  "_CFBooleanGetValue", referenced from:
      _darwin_detach_kernel_driver in libusb-1.0.a(darwin_usb.o)
  "_CFDataGetBytes", referenced from:
      _darwin_get_cached_device in libusb-1.0.a(darwin_usb.o)
  ...

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 26, 2022

For Arduino, they have two patches for static linking for avrdude 7.0 release.

  1. prefer static library, this should not be necessary now -- we can use -D USE_STATIC_LIBS=ON
    https://github.com/arduino/avrdude-packing/blob/main/patches/0005-Cmake-always-prefer-static-libraries.patch

  2. add libtinfo and libncurses as dependancy, this is still needed.
    https://github.com/arduino/avrdude-packing/blob/main/patches/0006-Cmake-add-libtinfo-and-libncurses-as-dependencies.patch

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 26, 2022

Following the approach from Arduino, the following patch seems to be good now for Linux.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 400da29..5ec1a34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,6 +225,31 @@ if(HAVE_LIBREADLINE)
     set(LIB_LIBREADLINE ${HAVE_LIBREADLINE})
 endif()
 
+find_library(HAVE_LIBNCURSES NAMES ncurses)
+if(HAVE_LIBNCURSES)
+    set(LIB_LIBNCURSES ${HAVE_LIBNCURSES})
+endif()
+
+find_library(HAVE_LIBTINFO NAMES tinfo)
+if(HAVE_LIBTINFO)
+    set(LIB_LIBTINFO ${HAVE_LIBTINFO})
+endif()
+
+find_library(HAVE_LIBZ NAMES z)
+if(HAVE_LIBZ)
+    set(LIB_LIBZ ${HAVE_LIBZ})
+endif()
+
+find_library(HAVE_LIBUDEV NAMES udev)
+if(HAVE_LIBZ)
+    set(LIB_LIBUDEV ${HAVE_LIBUDEV})
+endif()
+
+find_library(HAVE_LIBPTHREAD NAMES pthread)
+if(HAVE_LIBZ)
+    set(LIB_LIBPTHREAD ${HAVE_LIBPTHREAD})
+endif()
+
 # =====================================
 # Use external libraries if requested
 # =====================================
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ca6cb64..47322f9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -268,6 +268,10 @@ target_link_libraries(libavrdude
     ${LIB_LIBFTDI}
     ${LIB_LIBFTDI1}
     ${LIB_LIBREADLINE}
mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ git diff >diff.txt
mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ cat diff.txt 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 400da29..5ec1a34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,6 +225,31 @@ if(HAVE_LIBREADLINE)
     set(LIB_LIBREADLINE ${HAVE_LIBREADLINE})
 endif()
 
+find_library(HAVE_LIBNCURSES NAMES ncurses)
+if(HAVE_LIBNCURSES)
+    set(LIB_LIBNCURSES ${HAVE_LIBNCURSES})
+endif()
+
+find_library(HAVE_LIBTINFO NAMES tinfo)
+if(HAVE_LIBTINFO)
+    set(LIB_LIBTINFO ${HAVE_LIBTINFO})
+endif()
+
+find_library(HAVE_LIBZ NAMES z)
+if(HAVE_LIBZ)
+    set(LIB_LIBZ ${HAVE_LIBZ})
+endif()
+
+find_library(HAVE_LIBUDEV NAMES udev)
+if(HAVE_LIBZ)
+    set(LIB_LIBUDEV ${HAVE_LIBUDEV})
+endif()
+
+find_library(HAVE_LIBPTHREAD NAMES pthread)
+if(HAVE_LIBZ)
+    set(LIB_LIBPTHREAD ${HAVE_LIBPTHREAD})
+endif()
+
 # =====================================
 # Use external libraries if requested
 # =====================================
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ca6cb64..47322f9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -268,6 +268,10 @@ target_link_libraries(libavrdude
     ${LIB_LIBFTDI}
     ${LIB_LIBFTDI1}
     ${LIB_LIBREADLINE}
+    ${LIB_LIBNCURSES}
+    ${LIB_LIBZ}
+    ${LIB_LIBUDEV}
+    ${LIB_LIBPTHREAD}
     ${EXTRA_WINDOWS_LIBRARIES}
     )

$ rm -rf build_linux_static/
$ cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON 
-D CMAKE_VERBOSE_MAKEFILE=ON -B build_linux_static
...
$ cmake --build build_linux_static
...
mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ ldd ./build_linux_static/src/avrdude
	linux-vdso.so.1 (0x00007ffdc9d08000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7ed6e98000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f7ed6e68000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7ed6e4c000)
	libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f7ed6e1f000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7ed6dfc000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7ed6c0a000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f7ed7160000)

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 26, 2022

@mariusgreuel and @umbynos
Please check if the above approach is the right approach or not. Thanks.

@umbynos
Copy link
Contributor

umbynos commented Oct 26, 2022

@danapplegate we use this to build macos: https://github.com/arduino/avrdude-packing/blob/7295e15feca9d40122a61ce7ca2842b9ab3da00e/.github/workflows/release.yml#L91
and what @mcuee said here is true. We will drop the first patch when the new version of avrdude comes out arduino/avrdude-packing#22

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 27, 2022

Info for macOS using pkg-config and Homebrew.

mcuee@mcuees-Mac-mini avrdude_main % pkg-config --static --libs libusb
-L/opt/homebrew/Cellar/libusb-compat/0.1.5_1/lib -L/opt/homebrew/Cellar/libusb/HEAD-ba69847/lib -lusb -lusb-1.0 -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security
mcuee@mcuees-Mac-mini avrdude_main % pkg-config --static --libs libftdi1
-L/opt/homebrew/Cellar/libftdi/1.5_2/lib -L/opt/homebrew/Cellar/libusb/HEAD-ba69847/lib -lftdi1 -lusb-1.0 -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security
mcuee@mcuees-Mac-mini avrdude_main % pkg-config --static --libs hidapi  
-L/opt/homebrew/Cellar/hidapi/0.12.0/lib -lhidapi (note: this is not that correct).
mcuee@mcuees-Mac-mini avrdude_main % pkg-config --static --libs readline
-L/opt/homebrew/Cellar/readline/8.2.1/lib -lreadline -lncurses
mcuee@mcuees-Mac-mini avrdude_main % pkg-config --static --libs libelf
-L/opt/homebrew/Cellar/libelf/0.8.13_1/lib -lelf

Therefore the patch from Arduino is still good (we need ncurses).
https://github.com/arduino/avrdude-packing/blob/main/patches/0006-Cmake-add-libtinfo-and-libncurses-as-dependencies.patch

And then we need to add the few frameworks (IOkit, CoreFoundation, Security).

mcuee@mcuees-Mac-mini avrdude_main % cmake -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/Cellar -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_macos
-- The C compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /opt/homebrew/bin/git (found version "2.38.1") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found BISON: /usr/bin/bison (found version "2.3")
-- Looking for libelf.h
-- Looking for libelf.h - not found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - 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 - 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 - not found
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Darwin-21.6.0
-- CMAKE_SYSTEM: Darwin-21.6.0
-- CMAKE_FIND_ROOT_PATH: 
-- CMAKE_C_COMPILER: /Library/Developer/CommandLineTools/usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.0-20221017 (b864d7e)
-- USE_EXTERNAL: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /opt/homebrew/lib/libelf.a
-- HAVE_LIBUSB: /opt/homebrew/lib/libusb.a
-- HAVE_LIBUSB_1_0: /opt/homebrew/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHID: /opt/homebrew/lib/libhid.dylib
-- HAVE_LIBHIDAPI: /opt/homebrew/lib/libhidapi.dylib
-- HAVE_LIBFTDI: /opt/homebrew/lib/libftdi.a
-- HAVE_LIBFTDI1: /opt/homebrew/lib/libftdi1.a
-- HAVE_LIBREADLINE: /opt/homebrew/lib/libreadline.a
-- HAVE_LIBELF_H: 
-- HAVE_LIBELF_LIBELF_H: 1
-- HAVE_USB_H: 1
-- HAVE_LUSB0_USB_H: 
-- HAVE_LIBUSB_H: 
-- HAVE_LIBUSB_1_0_LIBUSB_H: 1
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR: 
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DO HAVE    libftdi (but prefer to use libftdi1)
-- DO HAVE    libftdi1
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mcuee/build/avr/avrdude_test/avrdude_main/build_macos
mcuee@mcuees-Mac-mini avrdude_main % cmake --build build_macos 
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/avrdude] Error 1
make[1]: *** [src/CMakeFiles/avrdude.dir/all] Error 2
make: *** [all] Error 2

mcuee@mcuees-Mac-mini avrdude_main % cd build_macos 

mcuee@mcuees-Mac-mini build_macos % cd src

mcuee@mcuees-Mac-mini src % /Library/Developer/CommandLineTools/usr/bin/cc -I/opt/homebrew/include -O2 -g -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk -mmacosx-version-min=12.6 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/homebrew/Cellar CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/term.c.o CMakeFiles/avrdude.dir/avrintel.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /opt/homebrew/lib/libelf.a /opt/homebrew/lib/libusb.a /opt/homebrew/lib/libusb-1.0.a /opt/homebrew/lib/libhid.dylib /opt/homebrew/lib/libhidapi.dylib /opt/homebrew/lib/libftdi.a /opt/homebrew/lib/libftdi1.a /opt/homebrew/lib/libreadline.a /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/lib/libncurses.tbd -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security

mcuee@mcuees-Mac-mini src % otool -L avrdude (not so correct because of hidapi)
avrdude:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
	/opt/homebrew/opt/libhid/lib/libhid.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/homebrew/opt/hidapi/lib/libhidapi.0.dylib (compatibility version 0.0.0, current version 0.12.0)
	/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.1.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60420.40.34)

We can see that the Arduino build instruction by @umbynos takes care of the above frameworks.
https://github.com/arduino/avrdude-packing/blob/7295e15feca9d40122a61ce7ca2842b9ab3da00e/.github/workflows/release.yml#L91

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 27, 2022

The same approach can be done for MSYS2 mingw32/mingw64.

$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 400da29..77d757f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,6 +125,7 @@ if(USE_STATIC_LIBS)
     set(PREFERRED_LIBFTDI libftdi.a ftdi)
     set(PREFERRED_LIBFTDI1 libftdi1.a ftdi1)
     set(PREFERRED_LIBREADLINE libreadline.a)
+       set(PREFERRED_LIBTERMCAP libtermcap.a)
 else()
     set(PREFERRED_LIBELF elf)
     set(PREFERRED_LIBUSB usb)
@@ -133,6 +134,7 @@ else()
     set(PREFERRED_LIBFTDI ftdi)
     set(PREFERRED_LIBFTDI1 ftdi1)
     set(PREFERRED_LIBREADLINE readline)
+       set(PREFERRED_LIBTERMCAP termcap)
 endif()

 # -------------------------------------
@@ -225,6 +227,11 @@ if(HAVE_LIBREADLINE)
     set(LIB_LIBREADLINE ${HAVE_LIBREADLINE})
 endif()

+find_library(HAVE_LIBTERMCAP NAMES ${PREFERRED_LIBTERMCAP})
+if(HAVE_LIBTERMCAP)
+    set(LIB_LIBTERMCAP ${HAVE_LIBTERMCAP})
+endif()
+
 # =====================================
 # Use external libraries if requested
 # =====================================
@@ -310,6 +317,7 @@ if (DEBUG_CMAKE)
     message(STATUS "HAVE_LIBFTDI: ${HAVE_LIBFTDI}")
     message(STATUS "HAVE_LIBFTDI1: ${HAVE_LIBFTDI1}")
     message(STATUS "HAVE_LIBREADLINE: ${HAVE_LIBREADLINE}")
+       message(STATUS "HAVE_LIBTERMCAP: ${HAVE_LIBTERMCAP}")
     message(STATUS "HAVE_LIBELF_H: ${HAVE_LIBELF_H}")
     message(STATUS "HAVE_LIBELF_LIBELF_H: ${HAVE_LIBELF_LIBELF_H}")
     message(STATUS "HAVE_USB_H: ${HAVE_USB_H}")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ca6cb64..d42c166 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -268,7 +268,8 @@ target_link_libraries(libavrdude
     ${LIB_LIBFTDI}
     ${LIB_LIBFTDI1}
     ${LIB_LIBREADLINE}
-    ${EXTRA_WINDOWS_LIBRARIES}
+       ${LIB_LIBTERMCAP}
+       ${EXTRA_WINDOWS_LIBRARIES}
     )

 add_executable(avrdude

Of course I will still need to rebuild termcap as per the workaround mentioned here.

$ cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_mingw_static
-- Building for: Ninja
-- The C compiler identification is GNU 12.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.38.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:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Windows-10.0.19044
-- CMAKE_SYSTEM: Windows-10.0.19044
-- CMAKE_FIND_ROOT_PATH:
-- CMAKE_C_COMPILER: C:/msys64/mingw64/bin/cc.exe
-- CONFIG_DIR: C:/Program Files (x86)/avrdude/etc
-- AVRDUDE_FULL_VERSION: 7.0-20221026 (a101899)
-- USE_EXTERNAL: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: C:/msys64/mingw64/lib/libelf.a
-- HAVE_LIBUSB: C:/msys64/mingw64/lib/libusb.a
-- HAVE_LIBUSB_1_0: C:/msys64/mingw64/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: C:/msys64/mingw64/lib/libusb0.dll.a
-- HAVE_LIBHID: C:/msys64/mingw64/lib/libhid.a
-- HAVE_LIBHIDAPI: C:/msys64/mingw64/lib/libhidapi.a
-- HAVE_LIBFTDI: HAVE_LIBFTDI-NOTFOUND
-- HAVE_LIBFTDI1: C:/msys64/mingw64/lib/libftdi1.a
-- HAVE_LIBREADLINE: C:/msys64/mingw64/lib/libreadline.a
-- HAVE_LIBTERMCAP: HAVE_LIBTERMCAP-NOTFOUND
-- HAVE_LIBELF_H: 1
-- HAVE_LIBELF_LIBELF_H: 1
-- HAVE_USB_H: 1
-- HAVE_LUSB0_USB_H: 1
-- HAVE_LIBUSB_H:
-- HAVE_LIBUSB_1_0_LIBUSB_H: 1
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR: C:/msys64/mingw64/include/libusb-compat
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_main/build_mingw_static

$ cmake --build build_mingw_static
...
[66/66] cmd.exe /C "cd . && C:\msys64\mingw64\bin\cc.exe -O2 -g -DNDEBUG  src/CMakeFiles/avrdude.dir/main.c.obj src/CMakeFiles/avrdude.dir/term.c.obj src/CMakeFiles/avrdude.dir/avrintel.c.obj src/CMakeFiles/avrdude.dir/developer_opts.c.obj src/CMakeFiles/avrdude.dir/whereami.c.obj src/CMakeFiles/avrdude.dir/windows.rc.obj -o src\avrdude.exe -Wl,--out-implib,src\libavrdude.dll.a -Wl,--major-image-version,0,--minor-image-version,0  src/libavrdude.a  -lm  C:/msys64/mingw64/lib/libelf.a  C:/msys64/mingw64/lib/libusb.a  C:/msys64/mingw64/lib/libusb-1.0.a  C:/msys64/mingw64/lib/libhid.a  C:/msys64/mingw64/lib/libhidapi.a  C:/msys64/mingw64/lib/libftdi1.a  C:/msys64/mingw64/lib/libreadline.a  C:/msys64/mingw64/lib/libtermcap.a  -lsetupapi  -lws2_32  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."

$ ldd ./build_mingw_static/src/avrdude.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffd14cf0000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffd137d0000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffd12970000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffd13210000)
        SETUPAPI.dll => /c/WINDOWS/System32/SETUPAPI.dll (0x7ffd14560000)
        cfgmgr32.dll => /c/WINDOWS/System32/cfgmgr32.dll (0x7ffd126d0000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7ffd12470000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7ffd136a0000)
        bcrypt.dll => /c/WINDOWS/System32/bcrypt.dll (0x7ffd12410000)
        USER32.dll => /c/WINDOWS/System32/USER32.dll (0x7ffd149d0000)
        win32u.dll => /c/WINDOWS/System32/win32u.dll (0x7ffd12440000)
        GDI32.dll => /c/WINDOWS/System32/GDI32.dll (0x7ffd130f0000)
        gdi32full.dll => /c/WINDOWS/System32/gdi32full.dll (0x7ffd12c40000)
        msvcp_win.dll => /c/WINDOWS/System32/msvcp_win.dll (0x7ffd128d0000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7ffd14050000)
        HID.DLL => /c/WINDOWS/SYSTEM32/HID.DLL (0x7ffd0fec0000)

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 27, 2022

@umbynos

I tend to think some parts of the Arduino avrdude workflow file here seem to be good to be adopted by the official avrdude project as well. Good work!

https://github.com/arduino/avrdude-packing/blob/main/.github/workflows/release.yml

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 27, 2022

My trial and errors to use static linking for Linux and macOS are here. It is still using dynamic linking for hidapi, strange.
https://github.com/mcuee/avrdude/commits/cmake_static_linux_macOS

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 28, 2022

we use this to build macos: https://github.com/arduino/avrdude-packing/blob/7295e15feca9d40122a61ce7ca2842b9ab3da00e/.github/workflows/release.yml#L91 and what @mcuee said here is true. We will drop the first patch when the new version of avrdude comes out arduino/avrdude-packing#22

@umbynos

A minor improvement to supress many warnings is here for the Arduino script. The frameworks are supposed to be for the linker option and not compiler option.
mcuee@3f3f739

I tested it in the github action and it works.
https://github.com/mcuee/avrdude/actions/runs/3341739395/jobs/5533237235

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 28, 2022

For those who want to try out the Arduino crossbuild container, it is here, thanks to @umbynos.
https://github.com/arduino/crossbuild/pkgs/container/crossbuild

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 28, 2022

Just tried the container and it works well -- only tested v7.0 release and Linux. It may need minor tuning for git main -- I will try that tomorrow.

$ git clone https://github.com/arduino/avrdude-packing.git
$ git clone https://github.com/avrdudes/avrdude.git
$ cd avrdude
$ git checkout tags/v7.0
$ cd ..
$ cd avrdude-packaging
$ cd patches
$ perl -pi -e "s/ARDUINO_VERSION_PLACEHOLDER/7.0/g" 0008-Append-arduino-to-version-string.patch
$ cd ../../avrdude
$ git apply -v ../avrdude-packing/patches/*.patch
$ cmake 
-DCMAKE_C_COMPILER=x86_64-ubuntu16.04-linux-gnu-gcc 
-DCMAKE_CXX_COMPILER=x86_64-ubuntu16.04-linux-gnu-g++ 
-DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" 
-DCMAKE_C_FLAGS="-I/opt/lib/x86_64-ubuntu16.04-linux-gnu/include/libusb-1.0/ -I/opt/lib/x86_64-ubuntu16.04-linux-gnu/include -pthread" 
-DCMAKE_PREFIX_PATH=/opt/lib/x86_64-ubuntu16.04-linux-gnu/ 
-DHAVE_LIBFTDI="NO" 
-B build/

$ cmake --build build/ -v

root@1e76cc636a1d:/workdir/avrdude# ldd ./build/src/avrdude
	linux-vdso.so.1 (0x00007ffd8f3e6000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdd0bf43000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdd0bf20000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdd0bd2e000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fdd0c099000)

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 29, 2022

Just tried the container and it works well -- only tested v7.0 release and Linux. It may need minor tuning for git main -- I will try that tomorrow.

And it works well for git main as well. I only need one patch as I do not need to use Arduino branding.

$ git clone https://github.com/arduino/avrdude-packing.git
$ git clone https://github.com/avrdudes/avrdude.git
$ cd avrdude
$ git apply ../avrdude-packing/patches/0006-Cmake-add-libtinfo-and-libncurses-as-dependencies.patch 

$ cmake -DCMAKE_C_COMPILER=x86_64-ubuntu16.04-linux-gnu-gcc 
-DCMAKE_CXX_COMPILER=x86_64-ubuntu16.04-linux-gnu-g++ 
-DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" 
-DCMAKE_C_FLAGS="-I/opt/lib/x86_64-ubuntu16.04-linux-gnu/include/libusb-1.0/ -I/opt/lib/x86_64-ubuntu16.04-linux-gnu/include -pthread" 
-DCMAKE_PREFIX_PATH=/opt/lib/x86_64-ubuntu16.04-linux-gnu/ 
-DHAVE_LIBFTDI="NO" 
-DCMAKE_BUILD_TYPE=RelWithDebInfo 
-DUSE_STATIC_LIBS=ON 
-DCMAKE_VERBOSE_MAKEFILE=ON 
-B build/ 

$ cmake --build build/

root@1e76cc636a1d:/workdir/avrdude# ldd ./build/src/avrdude
	linux-vdso.so.1 (0x00007fff20bbf000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f49fcbb0000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f49fcb8d000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f49fc99b000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f49fcd06000)
root@1e76cc636a1d:/workdir/avrdude# ./build/src/avrdude 
Usage: avrdude [options]
Options:
  -p <partno>                Specify AVR device
  -b <baudrate>              Override RS-232 baud rate
  -B <bitclock>              Specify bit clock period (us)
  -C <config-file>           Specify location of configuration file
  -c <programmer>            Specify programmer type
  -A                         Disable trailing-0xff removal from file and AVR read
  -D                         Disable auto erase for flash memory; implies -A
  -i <delay>                 ISP Clock Delay [in microseconds]
  -P <port>                  Specify connection port
  -F                         Override invalid signature or initialisation check
  -e                         Perform a chip erase
  -O                         Perform RC oscillator calibration (see AVR053)
  -U <memtype>:r|w|v:<filename>[:format]
                             Memory operation specification
                             Multiple -U options are allowed, each request
                             is performed in the order specified
  -n                         Do not write anything to the device
  -V                         Do not verify
  -t                         Enter terminal mode
  -E <exitspec>[,<exitspec>] List programmer exit specifications
  -x <extended_param>        Pass <extended_param> to programmer
  -v                         Verbose output; -v -v for more
  -q                         Quell progress output; -q -q for less
  -l logfile                 Use logfile rather than stderr for diagnostics
  -?                         Display this usage

avrdude version 7.0-20221026 (a101899), URL: <https://github.com/avrdudes/avrdude>

root@1e76cc636a1d:/workdir/avrdude# exit
exit
mcuee@ubuntu2004vm:~/build$ ls
avrdude  avrdude-packing  history.txt
mcuee@ubuntu2004vm:~/build$ ldd ./avrdude/build/src/avrdude
	linux-vdso.so.1 (0x00007fffd17c5000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6488dac000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6488d89000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6488b97000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f6488f0c000)

avrdude_i686_linux.zip

Tested under Ubuntu 20.04.

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin/arduino_packing/avrdude_i686_linux$ ldd ./avrdude
	linux-vdso.so.1 (0x00007ffdf1512000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f746d3e3000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f746d3c0000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f746d1ce000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f746d54f000)

mcuee@UbuntuSwift3:~/build/avr/avrdude_bin/arduino_packing/avrdude_i686_linux$ ./avrdude -c arduino 
-P /dev/ttyUSB0 -b 115200 -p m168pa -D -U flash:w:blink_m168pa.hex:i

avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e940b (probably m168pa)
avrdude: reading input file blink_m168pa.hex for flash
         with 16384 bytes in 1 section within [0, 0x3fff]
         using 128 pages and 0 pad bytes
avrdude: writing 16384 bytes flash ...

Writing | ################################################## | 100% 3.24 s 

avrdude: 16384 bytes of flash written
avrdude: verifying flash memory against blink_m168pa.hex

Reading | ################################################## | 100% 2.15 s 

avrdude: 16384 bytes of flash verified

avrdude done.  Thank you.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 29, 2022

For macOS, it is also okay with git main.

$  mv /usr/bin/ranlib /usr/bin/ranlib.bk
$  ln -s /opt/osxcross/target/bin/x86_64-apple-darwin13-ranlib /usr/bin/ranlib
$ cmake -DCMAKE_C_COMPILER=o64-clang 
-DCMAKE_CXX_COMPILER=o64-clang++ 
-DCMAKE_AR=/opt/osxcross/target/bin/x86_64-apple-darwin13-ar 
-DCMAKE_LINKER=/opt/osxcross/target/bin/x86_64-apple-darwin13-ld 
-DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/x86_64-apple-darwin13/lib/" 
-DCMAKE_C_FLAGS="-I/opt/lib/x86_64-apple-darwin13/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security -DHAVE_USB_H" 
-DCMAKE_PREFIX_PATH=/opt/lib/x86_64-apple-darwin13/ 
-DHAVE_LIBFTDI="NO" 
-DCMAKE_BUILD_TYPE=RelWithDebInfo 
-DUSE_STATIC_LIBS=ON 
-DCMAKE_VERBOSE_MAKEFILE=ON 
-B build_macos 
$cmake --build build_macos/

root@1e76cc636a1d:/workdir/avrdude# /opt/osxcross/target/bin/x86_64-apple-darwin13-otool -L ./build_macos/src/avrdude
./build_macos/src/avrdude:
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1673.126.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 59306.41.2)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1894.10.126)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)

avrdude_macos_intel64bit.zip

Tested under my Mac Mini M1.


mcuee@mcuees-Mac-mini avrdude_macos_intel64bit % otool -L avrdude           
avrdude:
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1673.126.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 59306.41.2)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1894.10.126)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)

mcuee@mcuees-Mac-mini avrdude_macos_intel64bit % ./avrdude -c arduino -P /dev/tty.usbserial-221370 
-b 115200 -p m168pa -D -U flash:w:blink_m168pa.hex:i

avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e940b (probably m168pa)
avrdude: reading input file blink_m168pa.hex for flash
         with 16384 bytes in 1 section within [0, 0x3fff]
         using 128 pages and 0 pad bytes
avrdude: writing 16384 bytes flash ...

Writing | ################################################## | 100% 3.39 s 

avrdude: 16384 bytes of flash written
avrdude: verifying flash memory against blink_m168pa.hex

Reading | ################################################## | 100% 2.15 s 

avrdude: 16384 bytes of flash verified

avrdude done.  Thank you.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 29, 2022

@umbynos

But the above generates one warning in configure stage (C++ compiler is not necessary) and too many warnings building the compiling stage (frameworks should be linker script and not compiler script).

I also think AppKit is necessary. But I am not so sure if older version of macOS supports it or not.

The following may be better.

$ cmake -DCMAKE_C_COMPILER=o64-clang 
-DCMAKE_AR=/opt/osxcross/target/bin/x86_64-apple-darwin13-ar 
-DCMAKE_LINKER=/opt/osxcross/target/bin/x86_64-apple-darwin13-ld 
-DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/x86_64-apple-darwin13/lib/ -lobjc -Wl,-framework,IOKit -Wl,-framework,AppKit -Wl,-framework,CoreFoundation -Wl,-framework,Security" 
-DCMAKE_C_FLAGS="-I/opt/lib/x86_64-apple-darwin13/include -pthread 
-DHAVE_USB_H" -DCMAKE_PREFIX_PATH=/opt/lib/x86_64-apple-darwin13/ 
-DHAVE_LIBFTDI="NO" -DCMAKE_BUILD_TYPE=RelWithDebInfo 
-DUSE_STATIC_LIBS=ON 
-DCMAKE_VERBOSE_MAKEFILE=ON 
-B build_macos_alt 
  
$ cmake --build build_macos_alt/

root@1e76cc636a1d:/workdir/avrdude# /opt/osxcross/target/bin/x86_64-apple-darwin13-otool -L ./build_macos_alt/src/avrdude
./build_macos_alt/src/avrdude:
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1894.10.126)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 59306.41.2)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

avrdude_macos_intel64bit_alt.zip

Tested under my Mac Mini M1.

mcuee@mcuees-Mac-mini avrdude_macos_intel64bit_alt % ./avrdude -c arduino 
-P /dev/tty.usbserial-221370 -b 115200 -p m168pa -D -U flash:w:blink_m168pa.hex:i

avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e940b (probably m168pa)
avrdude: reading input file blink_m168pa.hex for flash
         with 16384 bytes in 1 section within [0, 0x3fff]
         using 128 pages and 0 pad bytes
avrdude: writing 16384 bytes flash ...

Writing | ################################################## | 100% 3.36 s 

avrdude: 16384 bytes of flash written
avrdude: verifying flash memory against blink_m168pa.hex

Reading | ################################################## | 100% 2.14 s 

avrdude: 16384 bytes of flash verified

avrdude done.  Thank you.

mcuee@mcuees-Mac-mini avrdude_macos_intel64bit_alt % otool -L avrdude
avrdude:
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1894.10.126)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1673.126.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 59306.41.2)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 29, 2022

@umbynos
I have issues for mingw32 build though. The patch "0007-Cmake-fix-build-not-working-with-mingw-toolchain.patch" does not apply to git main properly. So I need to manually apply the patch.

Then the build will still fail. Not so sure what is wrong.

Your build here (https://github.com/arduino/avrdude-packing/files/9889835/avrdude-main-test-libusb-compat.zip) works very well. So the build process should work.

The linking failed but the command seems to be correct to me. Strange.

/usr/bin/i686-w64-mingw32-gcc -I/opt/lib/686-w64-mingw32/include/libusb-1.0 
-I/opt/lib/i686-w64-mingw32/include -I/opt/lib/i686-w64-mingw32/libftdi1/include -pthread 
-O2 -g -DNDEBUG  -static-libgcc -static-libstdc++ CMakeFiles/avrdude.dir/main.c.o 
CMakeFiles/avrdude.dir/term.c.o CMakeFiles/avrdude.dir/avrintel.c.o 
CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o  
-o avrdude  libavrdude.a -lm 
/opt/lib/i686-w64-mingw32/lib/libelf.a /opt/lib/i686-w64-mingw32/lib/libusb.a 
/opt/lib/i686-w64-mingw32/lib/libusb-1.0.a /opt/lib/i686-w64-mingw32/lib/libhidapi.a 
/opt/lib/i686-w64-mingw32/lib/libftdi1.a /opt/lib/i686-w64-mingw32/lib/libreadline.a 
/opt/lib/i686-w64-mingw32/lib/libncurses.a /opt/lib/i686-w64-mingw32/lib/libtinfo.a 
-lsetupapi -lws2_32

Edit: I figured out the issues.

  1. Need to move back the ranlib after buiding for macOS
  2. Need to upgrade ncurses version as found by @umbynos.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 30, 2022

May latest efforts mentioned here, still got problem with Windows.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 30, 2022

@mcuee
Copy link
Collaborator Author

mcuee commented Jan 12, 2023

IIRC it was required because mingw do not define WIN32 env var

If you are targeting Windows, CMake must define WIN32. If not, there is something wrong with your cross-build setup.

I think this is a fair statement based on my experiences with other projects.

In this case, I have closed PR #1275 as it is not an avrdude problem.

@mcuee
Copy link
Collaborator Author

mcuee commented Jan 14, 2023

Actually I can build git main under macOS using static link without any patches.
Edit: there is a problem with HIDAPI. It is still using dynamic linking. But the problem is not with avrdude, but rather the packing issue of hidapi under macOS Homebrew. They do not provide the static linking library for HIDAPI. Strange. They do provide static linking library for libusb and libftdi.

mcuee@mcuees-Mac-mini lib % ls -la libhidapi*
lrwxr-xr-x  1 mcuee  admin  50 Jan 14 09:23 libhidapi.0.13.1.dylib -> ../Cellar/hidapi/0.13.1/lib/libhidapi.0.13.1.dylib
lrwxr-xr-x  1 mcuee  admin  45 Jan 14 09:23 libhidapi.0.dylib -> ../Cellar/hidapi/0.13.1/lib/libhidapi.0.dylib
lrwxr-xr-x  1 mcuee  admin  43 Jan 14 09:23 libhidapi.dylib -> ../Cellar/hidapi/0.13.1/lib/libhidapi.dylib

mcuee@mcuees-Mac-mini lib % ls -la libusb*   
lrwxr-xr-x  1 mcuee  admin  52 Dec  5 19:22 libusb-0.1.4.dylib -> ../Cellar/libusb-compat/0.1.8/lib/libusb-0.1.4.dylib
lrwxr-xr-x  1 mcuee  admin  52 Dec 15 20:48 libusb-1.0.0.dylib -> ../Cellar/libusb/HEAD-f3619c4/lib/libusb-1.0.0.dylib
lrwxr-xr-x  1 mcuee  admin  46 Dec 15 20:48 libusb-1.0.a -> ../Cellar/libusb/HEAD-f3619c4/lib/libusb-1.0.a
lrwxr-xr-x  1 mcuee  admin  50 Dec 15 20:48 libusb-1.0.dylib -> ../Cellar/libusb/HEAD-f3619c4/lib/libusb-1.0.dylib
lrwxr-xr-x  1 mcuee  admin  42 Dec  5 19:22 libusb.a -> ../Cellar/libusb-compat/0.1.8/lib/libusb.a
lrwxr-xr-x  1 mcuee  admin  46 Dec  5 19:22 libusb.dylib -> ../Cellar/libusb-compat/0.1.8/lib/libusb.dylib
...
mcuee@mcuees-Mac-mini lib % ls -la libftdi*
lrwxr-xr-x  1 mcuee  admin  48 Dec 15 20:48 libftdi1.2.5.0.dylib -> ../Cellar/libftdi/1.5_2/lib/libftdi1.2.5.0.dylib
lrwxr-xr-x  1 mcuee  admin  44 Dec 15 20:48 libftdi1.2.dylib -> ../Cellar/libftdi/1.5_2/lib/libftdi1.2.dylib
lrwxr-xr-x  1 mcuee  admin  38 Dec 15 20:48 libftdi1.a -> ../Cellar/libftdi/1.5_2/lib/libftdi1.a
lrwxr-xr-x  1 mcuee  admin  42 Dec 15 20:48 libftdi1.dylib -> ../Cellar/libftdi/1.5_2/lib/libftdi1.dylib
lrwxr-xr-x  1 mcuee  admin  50 Dec 15 20:48 libftdipp1.2.5.0.dylib -> ../Cellar/libftdi/1.5_2/lib/libftdipp1.2.5.0.dylib
lrwxr-xr-x  1 mcuee  admin  46 Dec 15 20:48 libftdipp1.3.dylib -> ../Cellar/libftdi/1.5_2/lib/libftdipp1.3.dylib
lrwxr-xr-x  1 mcuee  admin  40 Dec 15 20:48 libftdipp1.a -> ../Cellar/libftdi/1.5_2/lib/libftdipp1.a
lrwxr-xr-x  1 mcuee  admin  44 Dec 15 20:48 libftdipp1.dylib -> ../Cellar/libftdi/1.5_2/lib/libftdipp1.dylib

mcuee@mcuees-Mac-mini avrdude_main % cmake -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/Cellar -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security"  -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_macos                         
-- The C compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /opt/homebrew/bin/git (found version "2.39.0") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found BISON: /usr/bin/bison (found version "2.3")
-- Looking for libelf.h
-- Looking for libelf.h - not found
-- Looking for libelf/libelf.h
-- Looking for libelf/libelf.h - 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 - 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:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Darwin-22.2.0
-- CMAKE_SYSTEM: Darwin-22.2.0
-- CMAKE_FIND_ROOT_PATH: 
-- CMAKE_C_COMPILER: /Library/Developer/CommandLineTools/usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.1-20230113 (9cf4f55)
-- USE_EXTERNAL_LIBS: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /opt/homebrew/lib/libelf.a
-- HAVE_LIBUSB: /opt/homebrew/lib/libusb.a
-- HAVE_LIBUSB_1_0: /opt/homebrew/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHID: HAVE_LIBHID-NOTFOUND
-- HAVE_LIBHIDAPI: /opt/homebrew/lib/libhidapi.dylib
-- HAVE_LIBFTDI: HAVE_LIBFTDI-NOTFOUND
-- HAVE_LIBFTDI1: /opt/homebrew/lib/libftdi1.a
-- HAVE_LIBREADLINE: HAVE_LIBREADLINE-NOTFOUND
-- HAVE_LIBELF_H: 
-- HAVE_LIBELF_LIBELF_H: 1
-- HAVE_USB_H: 1
-- HAVE_LUSB0_USB_H: 
-- HAVE_LIBUSB_H: 
-- HAVE_LIBUSB_1_0_LIBUSB_H: 1
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR: 
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DON'T HAVE libreadline
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mcuee/build/avr/avrdude_test/avrdude_main/build_macos
mcuee@mcuees-Mac-mini avrdude_main % cmake --build build_macos
...

[100%] Linking C executable avrdude
cd /Users/mcuee/build/avr/avrdude_test/avrdude_main/build_macos/src && /opt/homebrew/Cellar/cmake/3.25.1/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc -I/opt/homebrew/include -O2 -g -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/homebrew/Cellar -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/term.c.o CMakeFiles/avrdude.dir/avrintel.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /opt/homebrew/lib/libelf.a /opt/homebrew/lib/libusb.a /opt/homebrew/lib/libusb-1.0.a /opt/homebrew/lib/libhidapi.dylib /opt/homebrew/lib/libftdi1.a 
[100%] Built target avrdude
/opt/homebrew/Cellar/cmake/3.25.1/bin/cmake -E cmake_progress_start /Users/mcuee/build/avr/avrdude_test/avrdude_main/build_macos/CMakeFiles 0
mcuee@mcuees-Mac-mini avrdude_main % otool -L ./build_macos/src/avrdude
./build_macos/src/avrdude:
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60420.60.24)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
	/opt/homebrew/opt/hidapi/lib/libhidapi.0.dylib (compatibility version 0.0.0, current version 0.13.1)

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

avrdude version 7.1-20230108, URL: <https://github.com/avrdudes/avrdude>

@mcuee
Copy link
Collaborator Author

mcuee commented Jan 14, 2023

However, I have not figured a way to do that for Linux. The linking command is basically correct but the sequence is wrong.

mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ cmake -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -pthread -ludev -lz" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_static
-- The C compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found BISON: /usr/bin/bison (found version "3.5.1")
-- 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 - 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 - not found
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Linux-5.15.10-051510-generic
-- CMAKE_SYSTEM: Linux-5.15.10-051510-generic
-- CMAKE_FIND_ROOT_PATH: 
-- CMAKE_C_COMPILER: /usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.1-20230113 (9cf4f55)
-- USE_EXTERNAL_LIBS: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /usr/lib/x86_64-linux-gnu/libelf.a
-- HAVE_LIBUSB: /usr/local/lib/libusb.a
-- HAVE_LIBUSB_1_0: /usr/local/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHID: HAVE_LIBHID-NOTFOUND
-- HAVE_LIBHIDAPI: /usr/local/lib/libhidapi-libusb.a
-- HAVE_LIBFTDI: HAVE_LIBFTDI-NOTFOUND
-- HAVE_LIBFTDI1: /usr/local/lib/libftdi1.a
-- HAVE_LIBREADLINE: /usr/lib/x86_64-linux-gnu/libreadline.a
-- HAVE_LIBELF_H: 1
-- HAVE_LIBELF_LIBELF_H: 
-- HAVE_USB_H: 1
-- HAVE_LUSB0_USB_H: 
-- HAVE_LIBUSB_H: 
-- HAVE_LIBUSB_1_0_LIBUSB_H: 1
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR: 
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- DO HAVE    libreadline
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mcuee/build/avr/avrdude_main/build_static
mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ cmake --build build_static
...

[ 98%] Linking C executable avrdude
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG  -L/usr/local/lib -pthread -ludev -lz CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/term.c.o CMakeFiles/avrdude.dir/avrintel.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o  -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a 
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_compress':
(.text+0x10a): undefined reference to `deflateInit_'
/usr/bin/ld: (.text+0x1ce): undefined reference to `deflate'
/usr/bin/ld: (.text+0x23c): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x25e): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x2fc): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x324): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x380): undefined reference to `deflate'
/usr/bin/ld: (.text+0x426): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x456): undefined reference to `deflateEnd'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress':
(.text+0x52e): undefined reference to `inflateInit_'
/usr/bin/ld: (.text+0x55c): undefined reference to `inflate'
/usr/bin/ld: (.text+0x569): undefined reference to `inflateReset'
/usr/bin/ld: (.text+0x57d): undefined reference to `inflateEnd'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `udev_device_info':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:214: undefined reference to `udev_device_get_devnode'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:219: undefined reference to `udev_device_get_sysname'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `udev_hotplug_event':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:237: undefined reference to `udev_device_get_action'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:262: undefined reference to `udev_device_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_event_thread_main':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:197: undefined reference to `udev_monitor_receive_device'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_start_event_monitor':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:49: undefined reference to `udev_new'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:55: undefined reference to `udev_monitor_new_from_netlink'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:61: undefined reference to `udev_monitor_filter_add_match_subsystem_devtype'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:67: undefined reference to `udev_monitor_enable_receiving'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:72: undefined reference to `udev_monitor_get_fd'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:121: undefined reference to `udev_monitor_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:125: undefined reference to `udev_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_stop_event_monitor':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:150: undefined reference to `udev_monitor_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:155: undefined reference to `udev_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_scan_devices':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:275: undefined reference to `udev_enumerate_new'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:281: undefined reference to `udev_enumerate_add_match_subsystem'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:282: undefined reference to `udev_enumerate_add_match_property'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:283: undefined reference to `udev_enumerate_scan_devices'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:284: undefined reference to `udev_enumerate_get_list_entry'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:288: undefined reference to `udev_list_entry_get_name'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:291: undefined reference to `udev_device_new_from_syspath'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:300: undefined reference to `udev_device_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:287: undefined reference to `udev_list_entry_get_next'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:303: undefined reference to `udev_enumerate_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_hotplug_poll':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:314: undefined reference to `udev_monitor_receive_device'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/avrdude.dir/build.make:154: src/avrdude] Error 1
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
make[1]: *** [CMakeFiles/Makefile2:101: src/CMakeFiles/avrdude.dir/all] Error 2
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
make: *** [Makefile:133: all] Error 2

mcuee@UbuntuSwift3:~/build/avr/avrdude_main/build_static/src$ /usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG  CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/term.c.o CMakeFiles/avrdude.dir/avrintel.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o  -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a  -L/usr/local/lib -pthread -ludev -lz
mcuee@UbuntuSwift3:~/build/avr/avrdude_main/build_static/src$ ldd ./avrdude
	linux-vdso.so.1 (0x00007ffc967e7000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f46c7272000)
	libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f46c7245000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f46c7229000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f46c7206000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f46c7014000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f46c7513000)

mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ cmake --build build_static
/usr/bin/cmake -S/home/mcuee/build/avr/avrdude_main -B/home/mcuee/build/avr/avrdude_main/build_static --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/libavrdude.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
make[2]: Nothing to be done for 'src/CMakeFiles/libavrdude.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[ 89%] Built target libavrdude
/usr/bin/make -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/avrdude.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
make[2]: Nothing to be done for 'src/CMakeFiles/avrdude.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[ 98%] Built target avrdude
/usr/bin/make -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/conf.dir/DependInfo.cmake --color=
Dependee "/home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/conf.dir/DependInfo.cmake" is newer than depender "/home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/conf.dir/depend.internal".
Dependee "/home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/conf.dir/depend.internal".
Scanning dependencies of target conf
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[100%] Generating avrdude.conf
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E copy /home/mcuee/build/avr/avrdude_main/src/avrdude.conf.in avrdude.conf.in
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -D HAVE_PARPORT=OFF -D HAVE_LINUXSPI=OFF -D HAVE_LINUXGPIO=OFF -D DEFAULT_PAR_PORT=/dev/parport0 -D DEFAULT_SER_PORT=/dev/ttyS0 -P /home/mcuee/build/avr/avrdude_main/src/configure.cmake
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[100%] Built target conf
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles 0

mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ sudo cmake --build build_static --target install
/usr/bin/cmake -S/home/mcuee/build/avr/avrdude_main -B/home/mcuee/build/avr/avrdude_main/build_static --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/libavrdude.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
make[2]: Nothing to be done for 'src/CMakeFiles/libavrdude.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[ 89%] Built target libavrdude
/usr/bin/make -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/avrdude.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
make[2]: Nothing to be done for 'src/CMakeFiles/avrdude.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[ 98%] Built target avrdude
/usr/bin/make -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/conf.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
make[2]: Nothing to be done for 'src/CMakeFiles/conf.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[100%] Built target conf
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles 0
/usr/bin/make -f CMakeFiles/Makefile2 preinstall
make[1]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
make[1]: Nothing to be done for 'preinstall'.
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
Install the project...
/usr/bin/cmake -P cmake_install.cmake
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/bin/avrdude
-- Installing: /usr/local/lib/libavrdude.a
-- Up-to-date: /usr/local/include/libavrdude.h
-- Installing: /usr/local/etc/avrdude.conf
-- Up-to-date: /usr/local/share/man/man1/avrdude.1

mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ which avrdude
/usr/local/bin/avrdude
mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ avrdude
Usage: avrdude [options]
Options:
  -p <partno>                Specify AVR device
  -p <wildcard>/<flags>      Run developer options for matched AVR devices
  -b <baudrate>              Override RS-232 baud rate
  -B <bitclock>              Specify bit clock period (us)
  -C <config-file>           Specify location of configuration file
  -c <programmer>            Specify programmer type
  -c <wildcard>/<flags>      Run developer options for matched programmers
  -A                         Disable trailing-0xff removal from file and AVR read
  -D                         Disable auto erase for flash memory; implies -A
  -i <delay>                 ISP Clock Delay [in microseconds]
  -P <port>                  Specify connection port
  -F                         Override invalid signature or initialisation check
  -e                         Perform a chip erase
  -O                         Perform RC oscillator calibration (see AVR053)
  -U <memtype>:r|w|v:<filename>[:format]
                             Memory operation specification
                             Multiple -U options are allowed, each request
                             is performed in the order specified
  -n                         Do not write anything to the device
  -V                         Do not verify
  -t                         Enter terminal mode
  -E <exitspec>[,<exitspec>] List programmer exit specifications
  -x <extended_param>        Pass <extended_param> to programmer
  -v                         Verbose output; -v -v for more
  -q                         Quell progress output; -q -q for less
  -l logfile                 Use logfile rather than stderr for diagnostics
  -?                         Display this usage

avrdude version 7.1-20230108, URL: <https://github.com/avrdudes/avrdude>

@mcuee
Copy link
Collaborator Author

mcuee commented Jan 14, 2023

@mariusgreuel

It seems to me git main is not too bad to address this issue. Please take a look at the Linux build issue when you got some time. Thanks.

@mcuee
Copy link
Collaborator Author

mcuee commented Jan 14, 2023

Working macOS build scripts. Take note I have manually fixed the hidapi forumla to have the static library installed.

mcuee@mcuees-Mac-mini avrdude_main % cat build_brew.sh 
cmake -S . -B build/shared -DCMAKE_INSTALL_SYSCONFDIR=/opt/homebrew/etc -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_RPATH=@loader_path/../lib -DCMAKE_SHARED_LINKER_FLAGS=-Wl,-undefined,dynamic_lookup   -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/Cellar -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1  -D CMAKE_VERBOSE_MAKEFILE=ON
cmake --build build/shared
#cmake --install build/shared
cmake -S . -B build/static -DCMAKE_INSTALL_SYSCONFDIR=/opt/homebrew/etc -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/Cellar -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security -Wl,-framework,AppKit"  -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON
cmake --build build/static
mcuee@mcuees-Mac-mini avrdude_main % otool -L build/shared/src/avrdude         
build/shared/src/avrdude:
	@rpath/libavrdude.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
	/opt/homebrew/opt/libusb-compat/lib/libusb-0.1.4.dylib (compatibility version 9.0.0, current version 9.4.0)
	/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib (compatibility version 4.0.0, current version 4.0.0)
	/opt/homebrew/opt/hidapi/lib/libhidapi.0.dylib (compatibility version 0.0.0, current version 0.13.1)
	/opt/homebrew/opt/libftdi/lib/libftdi1.2.dylib (compatibility version 2.0.0, current version 2.5.0)
	/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
mcuee@mcuees-Mac-mini avrdude_main % otool -L build/shared/src/libavrdude.dylib
build/shared/src/libavrdude.dylib:
	@rpath/libavrdude.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
	/opt/homebrew/opt/libusb-compat/lib/libusb-0.1.4.dylib (compatibility version 9.0.0, current version 9.4.0)
	/opt/homebrew/opt/libusb/lib/libusb-1.0.0.dylib (compatibility version 4.0.0, current version 4.0.0)
	/opt/homebrew/opt/hidapi/lib/libhidapi.0.dylib (compatibility version 0.0.0, current version 0.13.1)
	/opt/homebrew/opt/libftdi/lib/libftdi1.2.dylib (compatibility version 2.0.0, current version 2.5.0)
	/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
mcuee@mcuees-Mac-mini avrdude_main % otool -L build/static/src/avrdude         
build/static/src/avrdude:
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60420.60.24)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2299.30.112)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
mcuee@mcuees-Mac-mini avrdude_main % otool -L build/static/src/libavrdude.a    
Archive : build/static/src/libavrdude.a
build/static/src/libavrdude.a(arduino.c.o):
build/static/src/libavrdude.a(avr.c.o):
build/static/src/libavrdude.a(avr910.c.o):
build/static/src/libavrdude.a(avrcache.c.o):
build/static/src/libavrdude.a(avrftdi.c.o):
build/static/src/libavrdude.a(avrftdi_tpi.c.o):
build/static/src/libavrdude.a(avrpart.c.o):
build/static/src/libavrdude.a(bitbang.c.o):
build/static/src/libavrdude.a(buspirate.c.o):
build/static/src/libavrdude.a(butterfly.c.o):
build/static/src/libavrdude.a(config.c.o):
build/static/src/libavrdude.a(confwin.c.o):
build/static/src/libavrdude.a(crc16.c.o):
build/static/src/libavrdude.a(dfu.c.o):
build/static/src/libavrdude.a(fileio.c.o):
build/static/src/libavrdude.a(flip1.c.o):
build/static/src/libavrdude.a(flip2.c.o):
build/static/src/libavrdude.a(ft245r.c.o):
build/static/src/libavrdude.a(jtagmkI.c.o):
build/static/src/libavrdude.a(jtagmkII.c.o):
build/static/src/libavrdude.a(jtag3.c.o):
build/static/src/libavrdude.a(linuxgpio.c.o):
build/static/src/libavrdude.a(linuxspi.c.o):
build/static/src/libavrdude.a(lists.c.o):
build/static/src/libavrdude.a(micronucleus.c.o):
build/static/src/libavrdude.a(par.c.o):
build/static/src/libavrdude.a(pgm.c.o):
build/static/src/libavrdude.a(pgm_type.c.o):
build/static/src/libavrdude.a(pickit2.c.o):
build/static/src/libavrdude.a(pindefs.c.o):
build/static/src/libavrdude.a(ppi.c.o):
build/static/src/libavrdude.a(ppiwin.c.o):
build/static/src/libavrdude.a(serbb_posix.c.o):
build/static/src/libavrdude.a(serbb_win32.c.o):
build/static/src/libavrdude.a(ser_avrdoper.c.o):
build/static/src/libavrdude.a(ser_posix.c.o):
build/static/src/libavrdude.a(ser_win32.c.o):
build/static/src/libavrdude.a(serialupdi.c.o):
build/static/src/libavrdude.a(stk500.c.o):
build/static/src/libavrdude.a(stk500v2.c.o):
build/static/src/libavrdude.a(stk500generic.c.o):
build/static/src/libavrdude.a(teensy.c.o):
build/static/src/libavrdude.a(updi_link.c.o):
build/static/src/libavrdude.a(updi_nvm.c.o):
build/static/src/libavrdude.a(updi_readwrite.c.o):
build/static/src/libavrdude.a(updi_state.c.o):
build/static/src/libavrdude.a(urclock.c.o):
build/static/src/libavrdude.a(usbasp.c.o):
build/static/src/libavrdude.a(usb_hidapi.c.o):
build/static/src/libavrdude.a(usb_libusb.c.o):
build/static/src/libavrdude.a(usbtiny.c.o):
build/static/src/libavrdude.a(update.c.o):
build/static/src/libavrdude.a(wiring.c.o):
build/static/src/libavrdude.a(xbee.c.o):
build/static/src/libavrdude.a(lexer.c.o):
build/static/src/libavrdude.a(config_gram.c.o):

@mcuee mcuee changed the title Enhance CMake to be able to use static link for Linux and macOS Enhance CMake to be able to support static link for Linux and macOS Jan 15, 2023
@mcuee mcuee added the help wanted Extra attention is needed label Jun 5, 2023
@mcuee
Copy link
Collaborator Author

mcuee commented Oct 18, 2023

@umbynos

It seems to me now you only need a small patch to get avrdude 7.2 build using your build script.

The patch is a bit strange though. Looks like WIN32 is not defined for your cross-compiler, is that the case? Thanks.

https://github.com/arduino/avrdude-packing/blob/main/patches/0007-Cmake-fix-build-not-working-with-mingw-toolchain.patch

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c10a77eb..b7769c5b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -50,7 +50,7 @@ endif()
 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
 add_compile_definitions(CONFIG_DIR=\"${CONFIG_DIR}\")
 
-if(WIN32)
+if(WIN32 OR MINGW)
     set(EXTRA_WINDOWS_RESOURCES "${PROJECT_BINARY_DIR}/src/windows.rc")
     set(EXTRA_WINDOWS_LIBRARIES setupapi hid ws2_32)
 endif()
@@ -112,7 +112,7 @@ endif()
 
 configure_file(cmake_config.h.in ac_cfg.h)
 configure_file(avrdude.spec.in avrdude.spec)
-if(WIN32)
+if(WIN32 OR MINGW)
     configure_file(windows.rc.in windows.rc)
 endif()

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 19, 2023

@umbynos

BTW, please help to check the following feature request for the Arduino crossbuild container. Thanks.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 22, 2023

The Linux issue is still there.

Need to figure out which CMAKE_EXE_LINKER_FLAGS to use.

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ cmake -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -pthread -ludev -lz" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_static
-- The C compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found BISON: /usr/bin/bison (found version "3.5.1")
-- 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 - 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 - not found
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Linux-5.15.0-84-generic
-- CMAKE_SYSTEM: Linux-5.15.0-84-generic
-- CMAKE_FIND_ROOT_PATH: 
-- CMAKE_C_COMPILER: /usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.2-20231018 (481a91dd)
-- USE_EXTERNAL_LIBS: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /usr/lib/x86_64-linux-gnu/libelf.a
-- HAVE_LIBUSB: /usr/local/lib/libusb.a
-- HAVE_LIBUSB_1_0: /usr/local/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHIDAPI: /usr/local/lib/libhidapi-libusb.a
-- HAVE_LIBFTDI: HAVE_LIBFTDI-NOTFOUND
-- HAVE_LIBFTDI1: /usr/local/lib/libftdi1.a
-- HAVE_LIBREADLINE: /usr/lib/x86_64-linux-gnu/libreadline.a
-- HAVE_LIBSERIALPORT: 1
-- HAVE_LIBELF_H: 1
-- HAVE_LIBELF_LIBELF_H: 
-- HAVE_USB_H: 1
-- HAVE_LUSB0_USB_H: 
-- HAVE_LIBUSB_H: 
-- HAVE_LIBUSB_1_0_LIBUSB_H: 1
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR: 
-- HAVE_LIBGPIOD: 
-- ----------------------
-- 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.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/avr/avrdude_main/build_static

Full build log -- failed in the linking step.

full build log
mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ cmake --build build_static/
Change Dir: '/home/mcuee/build/avr/avrdude_main/build_static'

Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile
/usr/bin/cmake -S/home/mcuee/build/avr/avrdude_main -B/home/mcuee/build/avr/avrdude_main/build_static --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles /home/mcuee/build/avr/avrdude_main/build_static//CMakeFiles/progress.marks
/usr/bin/make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make  -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/conf.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make  -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[  1%] Generating avrdude.conf
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E copy /home/mcuee/build/avr/avrdude_main/src/avrdude.conf.in avrdude.conf.in
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -D HAVE_PARPORT=0 -D HAVE_LINUXSPI=0 -D HAVE_LINUXGPIO=0 -D DEFAULT_PAR_PORT=/dev/parport0 -D DEFAULT_SER_PORT=/dev/ttyS0 -D DEFAULT_LINUXGPIO_PORT=gpiochip0 -P /home/mcuee/build/avr/avrdude_main/src/configure.cmake
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[  1%] Built target conf
/usr/bin/make  -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[  2%] [FLEX][Parser] Building scanner with flex 2.6.4
cd /home/mcuee/build/avr/avrdude_main/src && /usr/bin/flex -o/home/mcuee/build/avr/avrdude_main/build_static/lexer.c lexer.l
[  4%] [BISON][Parser] Building parser with bison 3.5.1
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/bison --defines=/home/mcuee/build/avr/avrdude_main/build_static/config_gram.h -o /home/mcuee/build/avr/avrdude_main/build_static/config_gram.c /home/mcuee/build/avr/avrdude_main/src/config_gram.y
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/libavrdude.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make  -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[  5%] Building C object src/CMakeFiles/libavrdude.dir/arduino.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/arduino.c.o -MF CMakeFiles/libavrdude.dir/arduino.c.o.d -o CMakeFiles/libavrdude.dir/arduino.c.o -c /home/mcuee/build/avr/avrdude_main/src/arduino.c
[  7%] Building C object src/CMakeFiles/libavrdude.dir/avr.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avr.c.o -MF CMakeFiles/libavrdude.dir/avr.c.o.d -o CMakeFiles/libavrdude.dir/avr.c.o -c /home/mcuee/build/avr/avrdude_main/src/avr.c
[  8%] Building C object src/CMakeFiles/libavrdude.dir/avr910.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avr910.c.o -MF CMakeFiles/libavrdude.dir/avr910.c.o.d -o CMakeFiles/libavrdude.dir/avr910.c.o -c /home/mcuee/build/avr/avrdude_main/src/avr910.c
[ 10%] Building C object src/CMakeFiles/libavrdude.dir/avrcache.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrcache.c.o -MF CMakeFiles/libavrdude.dir/avrcache.c.o.d -o CMakeFiles/libavrdude.dir/avrcache.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrcache.c
[ 11%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrftdi.c.o -MF CMakeFiles/libavrdude.dir/avrftdi.c.o.d -o CMakeFiles/libavrdude.dir/avrftdi.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrftdi.c
/home/mcuee/build/avr/avrdude_main/src/avrftdi.c: In function ‘avrftdi_open’:
/home/mcuee/build/avr/avrdude_main/src/avrftdi.c:802:2: warning: ‘ftdi_usb_purge_buffers’ is deprecated [-Wdeprecated-declarations]
  802 |  E(ftdi_usb_purge_buffers(pdata->ftdic), pdata->ftdic);
      |  ^
In file included from /home/mcuee/build/avr/avrdude_main/src/avrftdi_private.h:12,
                 from /home/mcuee/build/avr/avrdude_main/src/avrftdi.c:42:
/usr/local/include/libftdi1/ftdi.h:566:9: note: declared here
  566 |     int DEPRECATED(ftdi_usb_purge_buffers(struct ftdi_context *ftdi));
      |         ^~~~~~~~~~
[ 12%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o -MF CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o.d -o CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrftdi_tpi.c
[ 14%] Building C object src/CMakeFiles/libavrdude.dir/avrintel.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrintel.c.o -MF CMakeFiles/libavrdude.dir/avrintel.c.o.d -o CMakeFiles/libavrdude.dir/avrintel.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrintel.c
[ 15%] Building C object src/CMakeFiles/libavrdude.dir/avrpart.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrpart.c.o -MF CMakeFiles/libavrdude.dir/avrpart.c.o.d -o CMakeFiles/libavrdude.dir/avrpart.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrpart.c
[ 17%] Building C object src/CMakeFiles/libavrdude.dir/bitbang.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/bitbang.c.o -MF CMakeFiles/libavrdude.dir/bitbang.c.o.d -o CMakeFiles/libavrdude.dir/bitbang.c.o -c /home/mcuee/build/avr/avrdude_main/src/bitbang.c
[ 18%] Building C object src/CMakeFiles/libavrdude.dir/buspirate.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/buspirate.c.o -MF CMakeFiles/libavrdude.dir/buspirate.c.o.d -o CMakeFiles/libavrdude.dir/buspirate.c.o -c /home/mcuee/build/avr/avrdude_main/src/buspirate.c
[ 20%] Building C object src/CMakeFiles/libavrdude.dir/butterfly.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/butterfly.c.o -MF CMakeFiles/libavrdude.dir/butterfly.c.o.d -o CMakeFiles/libavrdude.dir/butterfly.c.o -c /home/mcuee/build/avr/avrdude_main/src/butterfly.c
[ 21%] Building C object src/CMakeFiles/libavrdude.dir/ch341a.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ch341a.c.o -MF CMakeFiles/libavrdude.dir/ch341a.c.o.d -o CMakeFiles/libavrdude.dir/ch341a.c.o -c /home/mcuee/build/avr/avrdude_main/src/ch341a.c
[ 22%] Building C object src/CMakeFiles/libavrdude.dir/config.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/config.c.o -MF CMakeFiles/libavrdude.dir/config.c.o.d -o CMakeFiles/libavrdude.dir/config.c.o -c /home/mcuee/build/avr/avrdude_main/src/config.c
[ 24%] Building C object src/CMakeFiles/libavrdude.dir/confwin.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/confwin.c.o -MF CMakeFiles/libavrdude.dir/confwin.c.o.d -o CMakeFiles/libavrdude.dir/confwin.c.o -c /home/mcuee/build/avr/avrdude_main/src/confwin.c
[ 25%] Building C object src/CMakeFiles/libavrdude.dir/crc16.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/crc16.c.o -MF CMakeFiles/libavrdude.dir/crc16.c.o.d -o CMakeFiles/libavrdude.dir/crc16.c.o -c /home/mcuee/build/avr/avrdude_main/src/crc16.c
[ 27%] Building C object src/CMakeFiles/libavrdude.dir/dfu.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/dfu.c.o -MF CMakeFiles/libavrdude.dir/dfu.c.o.d -o CMakeFiles/libavrdude.dir/dfu.c.o -c /home/mcuee/build/avr/avrdude_main/src/dfu.c
[ 28%] Building C object src/CMakeFiles/libavrdude.dir/dryrun.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/dryrun.c.o -MF CMakeFiles/libavrdude.dir/dryrun.c.o.d -o CMakeFiles/libavrdude.dir/dryrun.c.o -c /home/mcuee/build/avr/avrdude_main/src/dryrun.c
[ 30%] Building C object src/CMakeFiles/libavrdude.dir/fileio.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/fileio.c.o -MF CMakeFiles/libavrdude.dir/fileio.c.o.d -o CMakeFiles/libavrdude.dir/fileio.c.o -c /home/mcuee/build/avr/avrdude_main/src/fileio.c
[ 31%] Building C object src/CMakeFiles/libavrdude.dir/flip1.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/flip1.c.o -MF CMakeFiles/libavrdude.dir/flip1.c.o.d -o CMakeFiles/libavrdude.dir/flip1.c.o -c /home/mcuee/build/avr/avrdude_main/src/flip1.c
[ 32%] Building C object src/CMakeFiles/libavrdude.dir/flip2.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/flip2.c.o -MF CMakeFiles/libavrdude.dir/flip2.c.o.d -o CMakeFiles/libavrdude.dir/flip2.c.o -c /home/mcuee/build/avr/avrdude_main/src/flip2.c
[ 34%] Building C object src/CMakeFiles/libavrdude.dir/ft245r.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ft245r.c.o -MF CMakeFiles/libavrdude.dir/ft245r.c.o.d -o CMakeFiles/libavrdude.dir/ft245r.c.o -c /home/mcuee/build/avr/avrdude_main/src/ft245r.c
[ 35%] Building C object src/CMakeFiles/libavrdude.dir/jtagmkI.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/jtagmkI.c.o -MF CMakeFiles/libavrdude.dir/jtagmkI.c.o.d -o CMakeFiles/libavrdude.dir/jtagmkI.c.o -c /home/mcuee/build/avr/avrdude_main/src/jtagmkI.c
[ 37%] Building C object src/CMakeFiles/libavrdude.dir/jtagmkII.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/jtagmkII.c.o -MF CMakeFiles/libavrdude.dir/jtagmkII.c.o.d -o CMakeFiles/libavrdude.dir/jtagmkII.c.o -c /home/mcuee/build/avr/avrdude_main/src/jtagmkII.c
[ 38%] Building C object src/CMakeFiles/libavrdude.dir/jtag3.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/jtag3.c.o -MF CMakeFiles/libavrdude.dir/jtag3.c.o.d -o CMakeFiles/libavrdude.dir/jtag3.c.o -c /home/mcuee/build/avr/avrdude_main/src/jtag3.c
[ 40%] Building C object src/CMakeFiles/libavrdude.dir/linuxgpio.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/linuxgpio.c.o -MF CMakeFiles/libavrdude.dir/linuxgpio.c.o.d -o CMakeFiles/libavrdude.dir/linuxgpio.c.o -c /home/mcuee/build/avr/avrdude_main/src/linuxgpio.c
[ 41%] Building C object src/CMakeFiles/libavrdude.dir/linuxspi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/linuxspi.c.o -MF CMakeFiles/libavrdude.dir/linuxspi.c.o.d -o CMakeFiles/libavrdude.dir/linuxspi.c.o -c /home/mcuee/build/avr/avrdude_main/src/linuxspi.c
[ 42%] Building C object src/CMakeFiles/libavrdude.dir/lists.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/lists.c.o -MF CMakeFiles/libavrdude.dir/lists.c.o.d -o CMakeFiles/libavrdude.dir/lists.c.o -c /home/mcuee/build/avr/avrdude_main/src/lists.c
[ 44%] Building C object src/CMakeFiles/libavrdude.dir/micronucleus.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/micronucleus.c.o -MF CMakeFiles/libavrdude.dir/micronucleus.c.o.d -o CMakeFiles/libavrdude.dir/micronucleus.c.o -c /home/mcuee/build/avr/avrdude_main/src/micronucleus.c
[ 45%] Building C object src/CMakeFiles/libavrdude.dir/par.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/par.c.o -MF CMakeFiles/libavrdude.dir/par.c.o.d -o CMakeFiles/libavrdude.dir/par.c.o -c /home/mcuee/build/avr/avrdude_main/src/par.c
[ 47%] Building C object src/CMakeFiles/libavrdude.dir/pgm.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/pgm.c.o -MF CMakeFiles/libavrdude.dir/pgm.c.o.d -o CMakeFiles/libavrdude.dir/pgm.c.o -c /home/mcuee/build/avr/avrdude_main/src/pgm.c
[ 48%] Building C object src/CMakeFiles/libavrdude.dir/pgm_type.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/pgm_type.c.o -MF CMakeFiles/libavrdude.dir/pgm_type.c.o.d -o CMakeFiles/libavrdude.dir/pgm_type.c.o -c /home/mcuee/build/avr/avrdude_main/src/pgm_type.c
[ 50%] Building C object src/CMakeFiles/libavrdude.dir/pickit2.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/pickit2.c.o -MF CMakeFiles/libavrdude.dir/pickit2.c.o.d -o CMakeFiles/libavrdude.dir/pickit2.c.o -c /home/mcuee/build/avr/avrdude_main/src/pickit2.c
[ 51%] Building C object src/CMakeFiles/libavrdude.dir/pindefs.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/pindefs.c.o -MF CMakeFiles/libavrdude.dir/pindefs.c.o.d -o CMakeFiles/libavrdude.dir/pindefs.c.o -c /home/mcuee/build/avr/avrdude_main/src/pindefs.c
[ 52%] Building C object src/CMakeFiles/libavrdude.dir/ppi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ppi.c.o -MF CMakeFiles/libavrdude.dir/ppi.c.o.d -o CMakeFiles/libavrdude.dir/ppi.c.o -c /home/mcuee/build/avr/avrdude_main/src/ppi.c
[ 54%] Building C object src/CMakeFiles/libavrdude.dir/ppiwin.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ppiwin.c.o -MF CMakeFiles/libavrdude.dir/ppiwin.c.o.d -o CMakeFiles/libavrdude.dir/ppiwin.c.o -c /home/mcuee/build/avr/avrdude_main/src/ppiwin.c
[ 55%] Building C object src/CMakeFiles/libavrdude.dir/serbb_posix.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/serbb_posix.c.o -MF CMakeFiles/libavrdude.dir/serbb_posix.c.o.d -o CMakeFiles/libavrdude.dir/serbb_posix.c.o -c /home/mcuee/build/avr/avrdude_main/src/serbb_posix.c
[ 57%] Building C object src/CMakeFiles/libavrdude.dir/serbb_win32.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/serbb_win32.c.o -MF CMakeFiles/libavrdude.dir/serbb_win32.c.o.d -o CMakeFiles/libavrdude.dir/serbb_win32.c.o -c /home/mcuee/build/avr/avrdude_main/src/serbb_win32.c
[ 58%] Building C object src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.o -MF CMakeFiles/libavrdude.dir/ser_avrdoper.c.o.d -o CMakeFiles/libavrdude.dir/ser_avrdoper.c.o -c /home/mcuee/build/avr/avrdude_main/src/ser_avrdoper.c
[ 60%] Building C object src/CMakeFiles/libavrdude.dir/ser_posix.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ser_posix.c.o -MF CMakeFiles/libavrdude.dir/ser_posix.c.o.d -o CMakeFiles/libavrdude.dir/ser_posix.c.o -c /home/mcuee/build/avr/avrdude_main/src/ser_posix.c
[ 61%] Building C object src/CMakeFiles/libavrdude.dir/ser_win32.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ser_win32.c.o -MF CMakeFiles/libavrdude.dir/ser_win32.c.o.d -o CMakeFiles/libavrdude.dir/ser_win32.c.o -c /home/mcuee/build/avr/avrdude_main/src/ser_win32.c
[ 62%] Building C object src/CMakeFiles/libavrdude.dir/serialadapter.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/serialadapter.c.o -MF CMakeFiles/libavrdude.dir/serialadapter.c.o.d -o CMakeFiles/libavrdude.dir/serialadapter.c.o -c /home/mcuee/build/avr/avrdude_main/src/serialadapter.c
[ 64%] Building C object src/CMakeFiles/libavrdude.dir/serialupdi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/serialupdi.c.o -MF CMakeFiles/libavrdude.dir/serialupdi.c.o.d -o CMakeFiles/libavrdude.dir/serialupdi.c.o -c /home/mcuee/build/avr/avrdude_main/src/serialupdi.c
[ 65%] Building C object src/CMakeFiles/libavrdude.dir/stk500.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/stk500.c.o -MF CMakeFiles/libavrdude.dir/stk500.c.o.d -o CMakeFiles/libavrdude.dir/stk500.c.o -c /home/mcuee/build/avr/avrdude_main/src/stk500.c
[ 67%] Building C object src/CMakeFiles/libavrdude.dir/stk500v2.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/stk500v2.c.o -MF CMakeFiles/libavrdude.dir/stk500v2.c.o.d -o CMakeFiles/libavrdude.dir/stk500v2.c.o -c /home/mcuee/build/avr/avrdude_main/src/stk500v2.c
[ 68%] Building C object src/CMakeFiles/libavrdude.dir/stk500generic.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/stk500generic.c.o -MF CMakeFiles/libavrdude.dir/stk500generic.c.o.d -o CMakeFiles/libavrdude.dir/stk500generic.c.o -c /home/mcuee/build/avr/avrdude_main/src/stk500generic.c
[ 70%] Building C object src/CMakeFiles/libavrdude.dir/strutil.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/strutil.c.o -MF CMakeFiles/libavrdude.dir/strutil.c.o.d -o CMakeFiles/libavrdude.dir/strutil.c.o -c /home/mcuee/build/avr/avrdude_main/src/strutil.c
[ 71%] Building C object src/CMakeFiles/libavrdude.dir/teensy.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/teensy.c.o -MF CMakeFiles/libavrdude.dir/teensy.c.o.d -o CMakeFiles/libavrdude.dir/teensy.c.o -c /home/mcuee/build/avr/avrdude_main/src/teensy.c
[ 72%] Building C object src/CMakeFiles/libavrdude.dir/term.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/term.c.o -MF CMakeFiles/libavrdude.dir/term.c.o.d -o CMakeFiles/libavrdude.dir/term.c.o -c /home/mcuee/build/avr/avrdude_main/src/term.c
[ 74%] Building C object src/CMakeFiles/libavrdude.dir/updi_link.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_link.c.o -MF CMakeFiles/libavrdude.dir/updi_link.c.o.d -o CMakeFiles/libavrdude.dir/updi_link.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_link.c
[ 75%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_nvm.c.o -MF CMakeFiles/libavrdude.dir/updi_nvm.c.o.d -o CMakeFiles/libavrdude.dir/updi_nvm.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_nvm.c
[ 77%] Building C object src/CMakeFiles/libavrdude.dir/updi_readwrite.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_readwrite.c.o -MF CMakeFiles/libavrdude.dir/updi_readwrite.c.o.d -o CMakeFiles/libavrdude.dir/updi_readwrite.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_readwrite.c
[ 78%] Building C object src/CMakeFiles/libavrdude.dir/updi_state.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_state.c.o -MF CMakeFiles/libavrdude.dir/updi_state.c.o.d -o CMakeFiles/libavrdude.dir/updi_state.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_state.c
[ 80%] Building C object src/CMakeFiles/libavrdude.dir/urclock.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/urclock.c.o -MF CMakeFiles/libavrdude.dir/urclock.c.o.d -o CMakeFiles/libavrdude.dir/urclock.c.o -c /home/mcuee/build/avr/avrdude_main/src/urclock.c
[ 81%] Building C object src/CMakeFiles/libavrdude.dir/usbasp.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/usbasp.c.o -MF CMakeFiles/libavrdude.dir/usbasp.c.o.d -o CMakeFiles/libavrdude.dir/usbasp.c.o -c /home/mcuee/build/avr/avrdude_main/src/usbasp.c
[ 82%] Building C object src/CMakeFiles/libavrdude.dir/usb_hidapi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/usb_hidapi.c.o -MF CMakeFiles/libavrdude.dir/usb_hidapi.c.o.d -o CMakeFiles/libavrdude.dir/usb_hidapi.c.o -c /home/mcuee/build/avr/avrdude_main/src/usb_hidapi.c
[ 84%] Building C object src/CMakeFiles/libavrdude.dir/usb_libusb.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/usb_libusb.c.o -MF CMakeFiles/libavrdude.dir/usb_libusb.c.o.d -o CMakeFiles/libavrdude.dir/usb_libusb.c.o -c /home/mcuee/build/avr/avrdude_main/src/usb_libusb.c
[ 85%] Building C object src/CMakeFiles/libavrdude.dir/usbtiny.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/usbtiny.c.o -MF CMakeFiles/libavrdude.dir/usbtiny.c.o.d -o CMakeFiles/libavrdude.dir/usbtiny.c.o -c /home/mcuee/build/avr/avrdude_main/src/usbtiny.c
[ 87%] Building C object src/CMakeFiles/libavrdude.dir/update.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/update.c.o -MF CMakeFiles/libavrdude.dir/update.c.o.d -o CMakeFiles/libavrdude.dir/update.c.o -c /home/mcuee/build/avr/avrdude_main/src/update.c
[ 88%] Building C object src/CMakeFiles/libavrdude.dir/wiring.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/wiring.c.o -MF CMakeFiles/libavrdude.dir/wiring.c.o.d -o CMakeFiles/libavrdude.dir/wiring.c.o -c /home/mcuee/build/avr/avrdude_main/src/wiring.c
[ 90%] Building C object src/CMakeFiles/libavrdude.dir/xbee.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/xbee.c.o -MF CMakeFiles/libavrdude.dir/xbee.c.o.d -o CMakeFiles/libavrdude.dir/xbee.c.o -c /home/mcuee/build/avr/avrdude_main/src/xbee.c
[ 91%] Building C object src/CMakeFiles/libavrdude.dir/__/lexer.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/__/lexer.c.o -MF CMakeFiles/libavrdude.dir/__/lexer.c.o.d -o CMakeFiles/libavrdude.dir/__/lexer.c.o -c /home/mcuee/build/avr/avrdude_main/build_static/lexer.c
[ 92%] Building C object src/CMakeFiles/libavrdude.dir/__/config_gram.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/__/config_gram.c.o -MF CMakeFiles/libavrdude.dir/__/config_gram.c.o.d -o CMakeFiles/libavrdude.dir/__/config_gram.c.o -c /home/mcuee/build/avr/avrdude_main/build_static/config_gram.c
[ 94%] Linking C static library libavrdude.a
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -P CMakeFiles/libavrdude.dir/cmake_clean_target.cmake
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/libavrdude.dir/link.txt --verbose=1
/usr/bin/ar qc libavrdude.a CMakeFiles/libavrdude.dir/arduino.c.o CMakeFiles/libavrdude.dir/avr.c.o CMakeFiles/libavrdude.dir/avr910.c.o CMakeFiles/libavrdude.dir/avrcache.c.o CMakeFiles/libavrdude.dir/avrftdi.c.o CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o CMakeFiles/libavrdude.dir/avrintel.c.o CMakeFiles/libavrdude.dir/avrpart.c.o CMakeFiles/libavrdude.dir/bitbang.c.o CMakeFiles/libavrdude.dir/buspirate.c.o CMakeFiles/libavrdude.dir/butterfly.c.o CMakeFiles/libavrdude.dir/ch341a.c.o CMakeFiles/libavrdude.dir/config.c.o CMakeFiles/libavrdude.dir/confwin.c.o CMakeFiles/libavrdude.dir/crc16.c.o CMakeFiles/libavrdude.dir/dfu.c.o CMakeFiles/libavrdude.dir/dryrun.c.o CMakeFiles/libavrdude.dir/fileio.c.o CMakeFiles/libavrdude.dir/flip1.c.o CMakeFiles/libavrdude.dir/flip2.c.o CMakeFiles/libavrdude.dir/ft245r.c.o CMakeFiles/libavrdude.dir/jtagmkI.c.o CMakeFiles/libavrdude.dir/jtagmkII.c.o CMakeFiles/libavrdude.dir/jtag3.c.o CMakeFiles/libavrdude.dir/linuxgpio.c.o CMakeFiles/libavrdude.dir/linuxspi.c.o CMakeFiles/libavrdude.dir/lists.c.o CMakeFiles/libavrdude.dir/micronucleus.c.o CMakeFiles/libavrdude.dir/par.c.o CMakeFiles/libavrdude.dir/pgm.c.o CMakeFiles/libavrdude.dir/pgm_type.c.o CMakeFiles/libavrdude.dir/pickit2.c.o CMakeFiles/libavrdude.dir/pindefs.c.o CMakeFiles/libavrdude.dir/ppi.c.o CMakeFiles/libavrdude.dir/ppiwin.c.o CMakeFiles/libavrdude.dir/serbb_posix.c.o CMakeFiles/libavrdude.dir/serbb_win32.c.o CMakeFiles/libavrdude.dir/ser_avrdoper.c.o CMakeFiles/libavrdude.dir/ser_posix.c.o CMakeFiles/libavrdude.dir/ser_win32.c.o CMakeFiles/libavrdude.dir/serialadapter.c.o CMakeFiles/libavrdude.dir/serialupdi.c.o CMakeFiles/libavrdude.dir/stk500.c.o CMakeFiles/libavrdude.dir/stk500v2.c.o CMakeFiles/libavrdude.dir/stk500generic.c.o CMakeFiles/libavrdude.dir/strutil.c.o CMakeFiles/libavrdude.dir/teensy.c.o CMakeFiles/libavrdude.dir/term.c.o CMakeFiles/libavrdude.dir/updi_link.c.o CMakeFiles/libavrdude.dir/updi_nvm.c.o CMakeFiles/libavrdude.dir/updi_readwrite.c.o CMakeFiles/libavrdude.dir/updi_state.c.o CMakeFiles/libavrdude.dir/urclock.c.o CMakeFiles/libavrdude.dir/usbasp.c.o CMakeFiles/libavrdude.dir/usb_hidapi.c.o CMakeFiles/libavrdude.dir/usb_libusb.c.o CMakeFiles/libavrdude.dir/usbtiny.c.o CMakeFiles/libavrdude.dir/update.c.o CMakeFiles/libavrdude.dir/wiring.c.o CMakeFiles/libavrdude.dir/xbee.c.o CMakeFiles/libavrdude.dir/__/lexer.c.o CMakeFiles/libavrdude.dir/__/config_gram.c.o
/usr/bin/ranlib libavrdude.a
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[ 94%] Built target libavrdude
/usr/bin/make  -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/avrdude.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make  -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[ 95%] Building C object src/CMakeFiles/avrdude.dir/main.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/avrdude.dir/main.c.o -MF CMakeFiles/avrdude.dir/main.c.o.d -o CMakeFiles/avrdude.dir/main.c.o -c /home/mcuee/build/avr/avrdude_main/src/main.c
[ 97%] Building C object src/CMakeFiles/avrdude.dir/developer_opts.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/avrdude.dir/developer_opts.c.o -MF CMakeFiles/avrdude.dir/developer_opts.c.o.d -o CMakeFiles/avrdude.dir/developer_opts.c.o -c /home/mcuee/build/avr/avrdude_main/src/developer_opts.c
[ 98%] Building C object src/CMakeFiles/avrdude.dir/whereami.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/avrdude.dir/whereami.c.o -MF CMakeFiles/avrdude.dir/whereami.c.o.d -o CMakeFiles/avrdude.dir/whereami.c.o -c /home/mcuee/build/avr/avrdude_main/src/whereami.c
[100%] Linking C executable avrdude
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG -L/usr/local/lib -pthread -ludev -lz CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a /usr/local/lib/libserialport.a -lncurses 
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_init':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:179: undefined reference to `dlopen'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:181: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:182: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:183: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:184: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:185: undefined reference to `dlsym'
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o):/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:186: more undefined references to `dlsym' follow
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_init':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:210: undefined reference to `dlerror'
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_exit':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:220: undefined reference to `dlclose'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:220: undefined reference to `dlclose'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_compress':
(.text+0x10a): undefined reference to `deflateInit_'
/usr/bin/ld: (.text+0x1ce): undefined reference to `deflate'
/usr/bin/ld: (.text+0x23c): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x25e): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x2fc): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x324): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x380): undefined reference to `deflate'
/usr/bin/ld: (.text+0x426): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x456): undefined reference to `deflateEnd'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress':
(.text+0x52e): undefined reference to `inflateInit_'
/usr/bin/ld: (.text+0x55c): undefined reference to `inflate'
/usr/bin/ld: (.text+0x569): undefined reference to `inflateReset'
/usr/bin/ld: (.text+0x57d): undefined reference to `inflateEnd'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `udev_device_info':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:214: undefined reference to `udev_device_get_devnode'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:219: undefined reference to `udev_device_get_sysname'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `udev_hotplug_event':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:237: undefined reference to `udev_device_get_action'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:262: undefined reference to `udev_device_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_event_thread_main':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:197: undefined reference to `udev_monitor_receive_device'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_start_event_monitor':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:49: undefined reference to `udev_new'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:55: undefined reference to `udev_monitor_new_from_netlink'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:61: undefined reference to `udev_monitor_filter_add_match_subsystem_devtype'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:67: undefined reference to `udev_monitor_enable_receiving'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:72: undefined reference to `udev_monitor_get_fd'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:121: undefined reference to `udev_monitor_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:125: undefined reference to `udev_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_stop_event_monitor':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:150: undefined reference to `udev_monitor_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:155: undefined reference to `udev_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_scan_devices':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:275: undefined reference to `udev_enumerate_new'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:281: undefined reference to `udev_enumerate_add_match_subsystem'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:282: undefined reference to `udev_enumerate_add_match_property'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:283: undefined reference to `udev_enumerate_scan_devices'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:284: undefined reference to `udev_enumerate_get_list_entry'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:288: undefined reference to `udev_list_entry_get_name'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:291: undefined reference to `udev_device_new_from_syspath'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:300: undefined reference to `udev_device_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:287: undefined reference to `udev_list_entry_get_next'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:303: undefined reference to `udev_enumerate_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_hotplug_poll':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:314: undefined reference to `udev_monitor_receive_device'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/avrdude.dir/build.make:141: src/avrdude] Error 1
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
make[1]: *** [CMakeFiles/Makefile2:157: src/CMakeFiles/avrdude.dir/all] Error 2
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
make: *** [Makefile:139: all] Error 2

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 22, 2023

@Youw

Sorry to disturb you here. Just wondring if you have some ideas here. Thanks.

@mcuee
Copy link
Collaborator Author

mcuee commented Oct 22, 2023

This one seems to work. I am not so sure if it is the right way though. I think it is just a hack.

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ cmake -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -pthread -Wl,--no-as-needed -ldl -lz -ludev" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_static
...
...
mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ cmake --build build_static/
...
...
[100%] Linking C executable avrdude
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG -L/usr/local/lib -pthread -Wl,--no-as-needed -ldl -lz -ludev CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a /usr/local/lib/libserialport.a -lncurses 
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[100%] Built target avrdude
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles 0

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ ldd ./build_static/src/avrdude
	linux-vdso.so.1 (0x00007ffc22f66000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3f5d43c000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3f5d420000)
	libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f3f5d3f3000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3f5d2a4000)
	libncurses.so.6 => /lib/x86_64-linux-gnu/libncurses.so.6 (0x00007f3f5d27b000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f3f5d24b000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3f5d226000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3f5d034000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f3f5d674000)

@Youw
Copy link
Contributor

Youw commented Oct 23, 2023

-D USE_STATIC_LIBS=ON

This is fine, should be the only required parameter.

-D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -pthread -lz -Wl,--no-as-needed -ldl -lz -ludev"

Needing to pass these from command line is not fine.
By all the best practices the build script of a library/executable should know its own dependencies and add them explicitly w/o needing to do so manually. (Unless for some rare corner cases, which is not the case.)

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 4, 2023

PR #1540 has been merged.

This issue is still valid, therefore, I will keep it open.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 5, 2023

@Youw

It is a bit strange that cross compile works fine with the script in PR #1540 (now merged). But it does not work if I adopt similar approach with native build under Linux.

Just wondering if you have some ideas or not.

This does not work with native build under Linux.

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ cat build_static1.sh 
cmake -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS="-pthread -static-libgcc -static-libstdc++" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_static1
cmake --build build_static1/

The following cross-compile srcipt works fine.
https://github.com/avrdudes/avrdude/blob/main/.github/workflows/arduino_packing.yml

cmake -DCMAKE_C_COMPILER=${{ matrix.config.cross_compile }}-gcc -DCMAKE_CXX_COMPILER=${{ matrix.config.cross_compile }}-g++ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" -DCMAKE_C_FLAGS="-I/opt/lib/${{ matrix.config.cross_compile }}/include/libusb-1.0/ -I/opt/lib/${{ matrix.config.cross_compile }}/include -pthread" -DCMAKE_PREFIX_PATH=/opt/lib/${{ matrix.config.cross_compile }}/ -DHAVE_LIBFTDI="NO" -B build/

For example, the following is from latest git main github avrdude-packing build.
https://github.com/avrdudes/avrdude/actions/runs/6746001868

mcuee@UbuntuSwift3 ~/build/avr/avrdude_bin/dist/avrdude_Linux_64bit $ ldd ./bin/avrdude 
	linux-vdso.so.1 (0x00007ffd11be7000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0a124e6000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0a124c3000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0a122d1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f0a12663000)

@Youw
Copy link
Contributor

Youw commented Nov 7, 2023

I'm not sure what is not working?

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 7, 2023

I'm not sure what is not working?

@Youw

The linking step failed.

failed build log with verbose output
mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ cat build_static1.sh 
cmake -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS="-pthread -static-libgcc -static-libstdc++" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_static1
cmake --build build_static1/


mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ ./build_static1.sh 
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Linux-5.15.0-87-generic
-- CMAKE_SYSTEM: Linux-5.15.0-87-generic
-- CMAKE_FIND_ROOT_PATH: 
-- CMAKE_C_COMPILER: /usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.2-20231103 (08b82ea6)
-- USE_EXTERNAL_LIBS: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /usr/lib/x86_64-linux-gnu/libelf.a
-- HAVE_LIBUSB: /usr/local/lib/libusb.a
-- HAVE_LIBUSB_1_0: /usr/local/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHIDAPI: /usr/local/lib/libhidapi-libusb.a
-- HAVE_LIBFTDI: HAVE_LIBFTDI-NOTFOUND
-- HAVE_LIBFTDI1: /usr/local/lib/libftdi1.a
-- HAVE_LIBREADLINE: /usr/lib/x86_64-linux-gnu/libreadline.a
-- HAVE_LIBSERIALPORT: 1
-- HAVE_LIBELF_H: 1
-- HAVE_LIBELF_LIBELF_H: 
-- HAVE_USB_H: 1
-- HAVE_LUSB0_USB_H: 
-- HAVE_LIBUSB_H: 
-- HAVE_LIBUSB_1_0_LIBUSB_H: 1
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR: 
-- HAVE_LIBGPIOD: 
-- ----------------------
-- 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.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/avr/avrdude_main/build_static1
Change Dir: '/home/mcuee/build/avr/avrdude_main/build_static1'

Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile
/usr/bin/cmake -S/home/mcuee/build/avr/avrdude_main -B/home/mcuee/build/avr/avrdude_main/build_static1 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static1/CMakeFiles /home/mcuee/build/avr/avrdude_main/build_static1//CMakeFiles/progress.marks
/usr/bin/make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static1'
/usr/bin/make  -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static1'
cd /home/mcuee/build/avr/avrdude_main/build_static1 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static1 /home/mcuee/build/avr/avrdude_main/build_static1/src /home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/conf.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static1'
/usr/bin/make  -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static1'
make[2]: Nothing to be done for 'src/CMakeFiles/conf.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static1'
[  1%] Built target conf
/usr/bin/make  -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static1'
cd /home/mcuee/build/avr/avrdude_main/build_static1 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static1 /home/mcuee/build/avr/avrdude_main/build_static1/src /home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/DependInfo.cmake "--color="
Dependencies file "src/CMakeFiles/libavrdude.dir/__/config_gram.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/__/lexer.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/arduino.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/avr.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/avr910.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/avrcache.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/avrftdi.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/avrintel.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/avrpart.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/bitbang.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/buspirate.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/butterfly.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/ch341a.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/config.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/confwin.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/crc16.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/dfu.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/dryrun.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/fileio.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/flip1.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/flip2.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/ft245r.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/jtag3.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/jtagmkI.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/jtagmkII.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/leds.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/linuxgpio.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/linuxspi.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/lists.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/micronucleus.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/par.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/pgm.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/pgm_type.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/pickit2.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/pindefs.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/ppi.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/ppiwin.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/ser_posix.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/ser_win32.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/serbb_posix.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/serbb_win32.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/serialadapter.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/serialupdi.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/stk500.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/stk500generic.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/stk500v2.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/strutil.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/teensy.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/term.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/update.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/updi_link.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/updi_nvm.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/updi_readwrite.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/updi_state.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/urclock.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/usb_hidapi.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/usb_libusb.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/usbasp.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/usbtiny.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/wiring.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/libavrdude.dir/xbee.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/libavrdude.dir/compiler_depend.internal".
Consolidate compiler generated dependencies of target libavrdude
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static1'
/usr/bin/make  -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static1'
make[2]: Nothing to be done for 'src/CMakeFiles/libavrdude.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static1'
[ 94%] Built target libavrdude
/usr/bin/make  -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static1'
cd /home/mcuee/build/avr/avrdude_main/build_static1 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static1 /home/mcuee/build/avr/avrdude_main/build_static1/src /home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/avrdude.dir/DependInfo.cmake "--color="
Dependencies file "src/CMakeFiles/avrdude.dir/developer_opts.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/avrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/avrdude.dir/main.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/avrdude.dir/compiler_depend.internal".
Dependencies file "src/CMakeFiles/avrdude.dir/whereami.c.o.d" is newer than depends file "/home/mcuee/build/avr/avrdude_main/build_static1/src/CMakeFiles/avrdude.dir/compiler_depend.internal".
Consolidate compiler generated dependencies of target avrdude
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static1'
/usr/bin/make  -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static1'
[ 95%] Linking C executable avrdude
cd /home/mcuee/build/avr/avrdude_main/build_static1/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG -pthread -static-libgcc -static-libstdc++ CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a /usr/local/lib/libserialport.a -lncurses 
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_init':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:179: undefined reference to `dlopen'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:181: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:182: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:183: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:184: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:185: undefined reference to `dlsym'
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o):/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:186: more undefined references to `dlsym' follow
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_init':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:210: undefined reference to `dlerror'
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_exit':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:220: undefined reference to `dlclose'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:220: undefined reference to `dlclose'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_compress':
(.text+0x10a): undefined reference to `deflateInit_'
/usr/bin/ld: (.text+0x1ce): undefined reference to `deflate'
/usr/bin/ld: (.text+0x23c): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x25e): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x2fc): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x324): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x380): undefined reference to `deflate'
/usr/bin/ld: (.text+0x426): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x456): undefined reference to `deflateEnd'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress':
(.text+0x52e): undefined reference to `inflateInit_'
/usr/bin/ld: (.text+0x55c): undefined reference to `inflate'
/usr/bin/ld: (.text+0x569): undefined reference to `inflateReset'
/usr/bin/ld: (.text+0x57d): undefined reference to `inflateEnd'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `udev_device_info':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:214: undefined reference to `udev_device_get_devnode'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:219: undefined reference to `udev_device_get_sysname'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `udev_hotplug_event':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:237: undefined reference to `udev_device_get_action'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:262: undefined reference to `udev_device_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_event_thread_main':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:197: undefined reference to `udev_monitor_receive_device'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_start_event_monitor':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:49: undefined reference to `udev_new'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:55: undefined reference to `udev_monitor_new_from_netlink'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:61: undefined reference to `udev_monitor_filter_add_match_subsystem_devtype'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:67: undefined reference to `udev_monitor_enable_receiving'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:72: undefined reference to `udev_monitor_get_fd'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:121: undefined reference to `udev_monitor_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:125: undefined reference to `udev_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_stop_event_monitor':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:150: undefined reference to `udev_monitor_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:155: undefined reference to `udev_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_scan_devices':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:275: undefined reference to `udev_enumerate_new'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:281: undefined reference to `udev_enumerate_add_match_subsystem'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:282: undefined reference to `udev_enumerate_add_match_property'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:283: undefined reference to `udev_enumerate_scan_devices'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:284: undefined reference to `udev_enumerate_get_list_entry'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:288: undefined reference to `udev_list_entry_get_name'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:291: undefined reference to `udev_device_new_from_syspath'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:300: undefined reference to `udev_device_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:287: undefined reference to `udev_list_entry_get_next'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:303: undefined reference to `udev_enumerate_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_hotplug_poll':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:314: undefined reference to `udev_monitor_receive_device'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/avrdude.dir/build.make:141: src/avrdude] Error 1
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static1'
make[1]: *** [CMakeFiles/Makefile2:157: src/CMakeFiles/avrdude.dir/all] Error 2
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static1'
make: *** [Makefile:139: all] Error 2

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 7, 2023

@Youw

Basically the issue is that the linking step is missing -ludev -ldl -lz.

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main/build_static1/src (main)$ /usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG -pthread -static-libgcc -static-libstdc++ CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a /usr/local/lib/libserialport.a -lncurses 
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_init':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:179: undefined reference to `dlopen'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:181: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:182: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:183: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:184: undefined reference to `dlsym'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:185: undefined reference to `dlsym'
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o):/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:186: more undefined references to `dlsym' follow
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_init':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:210: undefined reference to `dlerror'
/usr/bin/ld: /usr/local/lib/libusb.a(libusb_la-core.o): in function `libusb_dl_exit':
/home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:220: undefined reference to `dlclose'
/usr/bin/ld: /home/mcuee/build/libusb-compat-0.1/libusb/libusb-dload.h:220: undefined reference to `dlclose'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_compress':
(.text+0x10a): undefined reference to `deflateInit_'
/usr/bin/ld: (.text+0x1ce): undefined reference to `deflate'
/usr/bin/ld: (.text+0x23c): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x25e): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x2fc): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x324): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x380): undefined reference to `deflate'
/usr/bin/ld: (.text+0x426): undefined reference to `deflateEnd'
/usr/bin/ld: (.text+0x456): undefined reference to `deflateEnd'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress':
(.text+0x52e): undefined reference to `inflateInit_'
/usr/bin/ld: (.text+0x55c): undefined reference to `inflate'
/usr/bin/ld: (.text+0x569): undefined reference to `inflateReset'
/usr/bin/ld: (.text+0x57d): undefined reference to `inflateEnd'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `udev_device_info':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:214: undefined reference to `udev_device_get_devnode'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:219: undefined reference to `udev_device_get_sysname'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `udev_hotplug_event':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:237: undefined reference to `udev_device_get_action'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:262: undefined reference to `udev_device_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_event_thread_main':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:197: undefined reference to `udev_monitor_receive_device'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_start_event_monitor':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:49: undefined reference to `udev_new'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:55: undefined reference to `udev_monitor_new_from_netlink'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:61: undefined reference to `udev_monitor_filter_add_match_subsystem_devtype'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:67: undefined reference to `udev_monitor_enable_receiving'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:72: undefined reference to `udev_monitor_get_fd'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:121: undefined reference to `udev_monitor_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:125: undefined reference to `udev_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_stop_event_monitor':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:150: undefined reference to `udev_monitor_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:155: undefined reference to `udev_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_scan_devices':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:275: undefined reference to `udev_enumerate_new'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:281: undefined reference to `udev_enumerate_add_match_subsystem'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:282: undefined reference to `udev_enumerate_add_match_property'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:283: undefined reference to `udev_enumerate_scan_devices'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:284: undefined reference to `udev_enumerate_get_list_entry'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:288: undefined reference to `udev_list_entry_get_name'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:291: undefined reference to `udev_device_new_from_syspath'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:300: undefined reference to `udev_device_unref'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:287: undefined reference to `udev_list_entry_get_next'
/usr/bin/ld: /home/mcuee/build/libusb/libusb/os/linux_udev.c:303: undefined reference to `udev_enumerate_unref'
/usr/bin/ld: /usr/local/lib/libusb-1.0.a(linux_udev.o): in function `linux_udev_hotplug_poll':
/home/mcuee/build/libusb/libusb/os/linux_udev.c:314: undefined reference to `udev_monitor_receive_device'
collect2: error: ld returned 1 exit status
mcuee@UbuntuSwift3 ~/build/avr/avrdude_main/build_static1/src (main)$ /usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG -pthread -static-libgcc -static-libstdc++ CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a /usr/local/lib/libserialport.a -lncurses -ludev -ldl -lz

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main/build_static1/src (main)$ ldd ./avrdude
	linux-vdso.so.1 (0x00007ffcd711f000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f71d4f04000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f71d4ed4000)
	libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f71d4ea7000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f71d4ea1000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f71d4e85000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f71d4e62000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f71d4c6e000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f71d5284000)

@Youw
Copy link
Contributor

Youw commented Nov 7, 2023

Basically the issue is that the linking step is missing -ludev -ldl -lz.

Right, so those should be explicitly added in CMake for platforms that requires it.

@mcuee
Copy link
Collaborator Author

mcuee commented Nov 7, 2023

Basically the issue is that the linking step is missing -ludev -ldl -lz.

Right, so those should be explicitly added in CMake for platforms that requires it.

Take note this is only required for static linking under Linux/macOS/BSDs (the default is using dynamic linking. So probably this kind of extra options can be added for them.

For Windows by default avrdude is using static linking and not really allowing dynamic linking as of now (maybe no point to add the support for dynamic linking either).

@mcuee mcuee removed the help wanted Extra attention is needed label Feb 8, 2024
@mcuee
Copy link
Collaborator Author

mcuee commented Mar 2, 2024

@ndim

I am not so sure if you have some interests in helping here as well. I believe the fix is not that difficult but unfortunately I do not know much about CMake.

BTW, we may extend the subject for autotools build as well.

@ndim
Copy link
Contributor

ndim commented Mar 2, 2024

@mcuee Yes, I am interested. I am using avrdude to learn cmake with, I want to build a good avrdude package for Fedora, and I want avrdude to have a good Autotools build. Thanks for mentioning me here.

TLDR: A large number of different builds are possible, and we need to decide which ones make sense for us to support, and determine how to.

I will connect the following general thoughts with the existing build system some time in the next few days.

There are two build products: The libavrdude library and the avrdude tool executable. Each can be linked statically or dynamically to any subset of its dependencies (libelf, libusb, libftdi, libhidapi, etc). In the case of the avrdude executable, libavrdude is one of its dependencies. And libavrdude itself can be built as a static or as a dynamic library. And we are building for different platforms: static by default like Windows and dynamic by default like BSD, Linux. Not sure whether OSX is 100% a part of the dynamic by default camp.

Without precisely counting them all, that results in a huge number of combinations, and not all of them make sense.

Here are a few of those combinations which make sense, starting with the most extreme ones:

  • An "all-dynamic" build producing a shared libavrdude (dynamically linked to all dependencies) and an avrdude executable dynamically linked to libavrdude and all other libraries. That is the ideal build for Linux distro packages, BSD ports, homebrew etc. in a world with a stable libavrdude API and ABI.

  • A "static tool-only" build of the avrdude executable statically linked to all libraries, including libavrdude and libc. That is the ideal build for producing self contained avrdude tool binaries for probably all operating systems. This build does not even need to install libavrdude alongside the avrdude executable.

  • For Windows and its typical static by default linking, building libavrdude as a static library makes sense. Probably statically linked for most to all of its dependencies.

  • Until the libavrdude API and ABI have stabilized, building libavrdude as a static library for library users to develop their own tools with also makes sense on dynamic linking by default platforms (BSD, Linux, MacOS). This static lib could then be dynamically linked to all its dependencies.

  • The current Fedora package ships an avrdude tool executable which is dynamically linked to all of its and libavrdude's dependencies, but has been statically linked to libavrdude. Libavrdude by itself is not shipped at all, due to the state of API/ABI stability. This could be called a "dynamic tool-only" build.

So someone building the code might want to select:

  • build products: libavrdude library, avrdude tool, or both
  • if building libavrdude: as static library or as dynamic library or both
  • How to link libavrdude library and avrdude tool against their dependencies: statically only, dynamically only, dynamically if possible and statically else, statically if possible and dynamically else. Specifying per library dependency probably makes no sense.

Defaults could differ depending on the target OS, e.g. mostly static for Windows and mostly dynamic for BSD, Linux, OSX.

@mcuee
Copy link
Collaborator Author

mcuee commented Mar 2, 2024

@ndim

Thanks a lot for the detailed analysis and I agree with you.

Defaults could differ depending on the target OS, e.g. mostly static for Windows and mostly dynamic for BSD, Linux, OSX.

For avrdude binary, I think this is the case already for the CMake build (MSVC and MSYS2 mingw) under Windows, and CMake/autools build under other OS.

A "static tool-only" build of the avrdude executable statically linked to all libraries, including libavrdude and libc. That is the ideal build for producing self contained avrdude tool binaries for probably all operating systems. This build does not even need to install libavrdude alongside the avrdude executable.

Yes there are pretty strong requests to have this types of static binaries for Linux and macOS. Arduino avrdude-packing project is distributing such binaries for Linux, macOS and Windows. We have the CI script based on Arduino avrdude-packing project as well but needs some improvement (eg: no libserialport support).
https://github.com/avrdudes/avrdude/blob/main/.github/workflows/arduino_packing.yml
https://github.com/arduino/avrdude-packing (only up to 7.2 release).

For libavrdude library, currently it is not possible to build dynamic library for Windows and there may be such use case if we want to allow 3rd party apps developer who do not want to open source their implementation. There may be such use case (dynamic library) for other OS as well. This is a moot point as of now there are no real GUI application which leverage libarvdude library.

@mcuee
Copy link
Collaborator Author

mcuee commented Mar 2, 2024

Example working static build under Linux.

cmake -D CMAKE_C_FLAGS=-I/usr/local/include -D CMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -pthread -Wl,--no-as-needed -ldl -lz -ludev" -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON -B build_static
cmake --build build_static/
detail build log under Ubuntu Linux 20.04
mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ ./build_static.sh 
-- The C compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/bin/git (found version "2.25.1") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found BISON: /usr/bin/bison (found version "3.5.1")
-- 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 - 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:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Linux-5.15.0-94-generic
-- CMAKE_SYSTEM: Linux-5.15.0-94-generic
-- CMAKE_FIND_ROOT_PATH: 
-- CMAKE_C_COMPILER: /usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.3-20240229 (34366a6b)
-- USE_EXTERNAL_LIBS: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /usr/lib/x86_64-linux-gnu/libelf.a
-- HAVE_LIBUSB: /usr/local/lib/libusb.a
-- HAVE_LIBUSB_1_0: /usr/local/lib/libusb-1.0.a
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHIDAPI: /usr/local/lib/libhidapi-libusb.a
-- HAVE_LIBFTDI: HAVE_LIBFTDI-NOTFOUND
-- HAVE_LIBFTDI1: /usr/local/lib/libftdi1.a
-- HAVE_LIBREADLINE: /usr/lib/x86_64-linux-gnu/libreadline.a
-- HAVE_LIBSERIALPORT: 1
-- HAVE_LIBELF_H: 1
-- HAVE_LIBELF_LIBELF_H: 
-- HAVE_USB_H: 1
-- HAVE_LUSB0_USB_H: 
-- HAVE_LIBUSB_H: 
-- HAVE_LIBUSB_1_0_LIBUSB_H: 1
-- HAVE_HIDAPI_HIDAPI_H: 1
-- LIBUSB_COMPAT_DIR: 
-- HAVE_LIBGPIOD: 
-- ----------------------
-- 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.5s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/avr/avrdude_main/build_static
Change Dir: '/home/mcuee/build/avr/avrdude_main/build_static'

Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile
/usr/bin/cmake -S/home/mcuee/build/avr/avrdude_main -B/home/mcuee/build/avr/avrdude_main/build_static --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles /home/mcuee/build/avr/avrdude_main/build_static//CMakeFiles/progress.marks
/usr/bin/make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make  -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/conf.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make  -f src/CMakeFiles/conf.dir/build.make src/CMakeFiles/conf.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[  1%] Generating avrdude.conf
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E copy /home/mcuee/build/avr/avrdude_main/src/avrdude.conf.in avrdude.conf.in
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -D "AVRDUDE_FULL_VERSION=7.3-20240229 (34366a6b)" -D HAVE_PARPORT=0 -D HAVE_LINUXSPI=0 -D HAVE_LINUXGPIO=0 -D DEFAULT_PAR_PORT=/dev/parport0 -D DEFAULT_SER_PORT=/dev/ttyS0 -D DEFAULT_LINUXGPIO_PORT=gpiochip0 -P /home/mcuee/build/avr/avrdude_main/src/configure.cmake
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[  1%] Built target conf
/usr/bin/make  -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[  2%] [FLEX][Parser] Building scanner with flex 2.6.4
cd /home/mcuee/build/avr/avrdude_main/src && /usr/bin/flex -o/home/mcuee/build/avr/avrdude_main/build_static/lexer.c lexer.l
[  3%] [BISON][Parser] Building parser with bison 3.5.1
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/bison --defines=/home/mcuee/build/avr/avrdude_main/build_static/config_gram.h -o /home/mcuee/build/avr/avrdude_main/build_static/config_gram.c /home/mcuee/build/avr/avrdude_main/src/config_gram.y
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/libavrdude.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make  -f src/CMakeFiles/libavrdude.dir/build.make src/CMakeFiles/libavrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[  5%] Building C object src/CMakeFiles/libavrdude.dir/arduino.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/arduino.c.o -MF CMakeFiles/libavrdude.dir/arduino.c.o.d -o CMakeFiles/libavrdude.dir/arduino.c.o -c /home/mcuee/build/avr/avrdude_main/src/arduino.c
[  6%] Building C object src/CMakeFiles/libavrdude.dir/avr.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avr.c.o -MF CMakeFiles/libavrdude.dir/avr.c.o.d -o CMakeFiles/libavrdude.dir/avr.c.o -c /home/mcuee/build/avr/avrdude_main/src/avr.c
[  7%] Building C object src/CMakeFiles/libavrdude.dir/avr910.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avr910.c.o -MF CMakeFiles/libavrdude.dir/avr910.c.o.d -o CMakeFiles/libavrdude.dir/avr910.c.o -c /home/mcuee/build/avr/avrdude_main/src/avr910.c
[  9%] Building C object src/CMakeFiles/libavrdude.dir/avrcache.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrcache.c.o -MF CMakeFiles/libavrdude.dir/avrcache.c.o.d -o CMakeFiles/libavrdude.dir/avrcache.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrcache.c
[ 10%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrftdi.c.o -MF CMakeFiles/libavrdude.dir/avrftdi.c.o.d -o CMakeFiles/libavrdude.dir/avrftdi.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrftdi.c
[ 11%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o -MF CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o.d -o CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrftdi_tpi.c
[ 13%] Building C object src/CMakeFiles/libavrdude.dir/avrintel.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrintel.c.o -MF CMakeFiles/libavrdude.dir/avrintel.c.o.d -o CMakeFiles/libavrdude.dir/avrintel.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrintel.c
[ 14%] Building C object src/CMakeFiles/libavrdude.dir/avrpart.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/avrpart.c.o -MF CMakeFiles/libavrdude.dir/avrpart.c.o.d -o CMakeFiles/libavrdude.dir/avrpart.c.o -c /home/mcuee/build/avr/avrdude_main/src/avrpart.c
[ 15%] Building C object src/CMakeFiles/libavrdude.dir/bitbang.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/bitbang.c.o -MF CMakeFiles/libavrdude.dir/bitbang.c.o.d -o CMakeFiles/libavrdude.dir/bitbang.c.o -c /home/mcuee/build/avr/avrdude_main/src/bitbang.c
[ 17%] Building C object src/CMakeFiles/libavrdude.dir/buspirate.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/buspirate.c.o -MF CMakeFiles/libavrdude.dir/buspirate.c.o.d -o CMakeFiles/libavrdude.dir/buspirate.c.o -c /home/mcuee/build/avr/avrdude_main/src/buspirate.c
[ 18%] Building C object src/CMakeFiles/libavrdude.dir/butterfly.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/butterfly.c.o -MF CMakeFiles/libavrdude.dir/butterfly.c.o.d -o CMakeFiles/libavrdude.dir/butterfly.c.o -c /home/mcuee/build/avr/avrdude_main/src/butterfly.c
[ 19%] Building C object src/CMakeFiles/libavrdude.dir/ch341a.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ch341a.c.o -MF CMakeFiles/libavrdude.dir/ch341a.c.o.d -o CMakeFiles/libavrdude.dir/ch341a.c.o -c /home/mcuee/build/avr/avrdude_main/src/ch341a.c
[ 21%] Building C object src/CMakeFiles/libavrdude.dir/config.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/config.c.o -MF CMakeFiles/libavrdude.dir/config.c.o.d -o CMakeFiles/libavrdude.dir/config.c.o -c /home/mcuee/build/avr/avrdude_main/src/config.c
[ 22%] Building C object src/CMakeFiles/libavrdude.dir/confwin.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/confwin.c.o -MF CMakeFiles/libavrdude.dir/confwin.c.o.d -o CMakeFiles/libavrdude.dir/confwin.c.o -c /home/mcuee/build/avr/avrdude_main/src/confwin.c
[ 23%] Building C object src/CMakeFiles/libavrdude.dir/crc16.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/crc16.c.o -MF CMakeFiles/libavrdude.dir/crc16.c.o.d -o CMakeFiles/libavrdude.dir/crc16.c.o -c /home/mcuee/build/avr/avrdude_main/src/crc16.c
[ 25%] Building C object src/CMakeFiles/libavrdude.dir/dfu.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/dfu.c.o -MF CMakeFiles/libavrdude.dir/dfu.c.o.d -o CMakeFiles/libavrdude.dir/dfu.c.o -c /home/mcuee/build/avr/avrdude_main/src/dfu.c
[ 26%] Building C object src/CMakeFiles/libavrdude.dir/dryrun.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/dryrun.c.o -MF CMakeFiles/libavrdude.dir/dryrun.c.o.d -o CMakeFiles/libavrdude.dir/dryrun.c.o -c /home/mcuee/build/avr/avrdude_main/src/dryrun.c
[ 27%] Building C object src/CMakeFiles/libavrdude.dir/fileio.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/fileio.c.o -MF CMakeFiles/libavrdude.dir/fileio.c.o.d -o CMakeFiles/libavrdude.dir/fileio.c.o -c /home/mcuee/build/avr/avrdude_main/src/fileio.c
[ 28%] Building C object src/CMakeFiles/libavrdude.dir/flip1.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/flip1.c.o -MF CMakeFiles/libavrdude.dir/flip1.c.o.d -o CMakeFiles/libavrdude.dir/flip1.c.o -c /home/mcuee/build/avr/avrdude_main/src/flip1.c
[ 30%] Building C object src/CMakeFiles/libavrdude.dir/flip2.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/flip2.c.o -MF CMakeFiles/libavrdude.dir/flip2.c.o.d -o CMakeFiles/libavrdude.dir/flip2.c.o -c /home/mcuee/build/avr/avrdude_main/src/flip2.c
[ 31%] Building C object src/CMakeFiles/libavrdude.dir/ft245r.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ft245r.c.o -MF CMakeFiles/libavrdude.dir/ft245r.c.o.d -o CMakeFiles/libavrdude.dir/ft245r.c.o -c /home/mcuee/build/avr/avrdude_main/src/ft245r.c
[ 32%] Building C object src/CMakeFiles/libavrdude.dir/jtagmkI.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/jtagmkI.c.o -MF CMakeFiles/libavrdude.dir/jtagmkI.c.o.d -o CMakeFiles/libavrdude.dir/jtagmkI.c.o -c /home/mcuee/build/avr/avrdude_main/src/jtagmkI.c
[ 34%] Building C object src/CMakeFiles/libavrdude.dir/jtagmkII.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/jtagmkII.c.o -MF CMakeFiles/libavrdude.dir/jtagmkII.c.o.d -o CMakeFiles/libavrdude.dir/jtagmkII.c.o -c /home/mcuee/build/avr/avrdude_main/src/jtagmkII.c
[ 35%] Building C object src/CMakeFiles/libavrdude.dir/jtag3.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/jtag3.c.o -MF CMakeFiles/libavrdude.dir/jtag3.c.o.d -o CMakeFiles/libavrdude.dir/jtag3.c.o -c /home/mcuee/build/avr/avrdude_main/src/jtag3.c
[ 36%] Building C object src/CMakeFiles/libavrdude.dir/leds.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/leds.c.o -MF CMakeFiles/libavrdude.dir/leds.c.o.d -o CMakeFiles/libavrdude.dir/leds.c.o -c /home/mcuee/build/avr/avrdude_main/src/leds.c
[ 38%] Building C object src/CMakeFiles/libavrdude.dir/linuxgpio.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/linuxgpio.c.o -MF CMakeFiles/libavrdude.dir/linuxgpio.c.o.d -o CMakeFiles/libavrdude.dir/linuxgpio.c.o -c /home/mcuee/build/avr/avrdude_main/src/linuxgpio.c
[ 39%] Building C object src/CMakeFiles/libavrdude.dir/linuxspi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/linuxspi.c.o -MF CMakeFiles/libavrdude.dir/linuxspi.c.o.d -o CMakeFiles/libavrdude.dir/linuxspi.c.o -c /home/mcuee/build/avr/avrdude_main/src/linuxspi.c
[ 40%] Building C object src/CMakeFiles/libavrdude.dir/lists.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/lists.c.o -MF CMakeFiles/libavrdude.dir/lists.c.o.d -o CMakeFiles/libavrdude.dir/lists.c.o -c /home/mcuee/build/avr/avrdude_main/src/lists.c
[ 42%] Building C object src/CMakeFiles/libavrdude.dir/micronucleus.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/micronucleus.c.o -MF CMakeFiles/libavrdude.dir/micronucleus.c.o.d -o CMakeFiles/libavrdude.dir/micronucleus.c.o -c /home/mcuee/build/avr/avrdude_main/src/micronucleus.c
[ 43%] Building C object src/CMakeFiles/libavrdude.dir/par.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/par.c.o -MF CMakeFiles/libavrdude.dir/par.c.o.d -o CMakeFiles/libavrdude.dir/par.c.o -c /home/mcuee/build/avr/avrdude_main/src/par.c
[ 44%] Building C object src/CMakeFiles/libavrdude.dir/pgm.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/pgm.c.o -MF CMakeFiles/libavrdude.dir/pgm.c.o.d -o CMakeFiles/libavrdude.dir/pgm.c.o -c /home/mcuee/build/avr/avrdude_main/src/pgm.c
[ 46%] Building C object src/CMakeFiles/libavrdude.dir/pgm_type.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/pgm_type.c.o -MF CMakeFiles/libavrdude.dir/pgm_type.c.o.d -o CMakeFiles/libavrdude.dir/pgm_type.c.o -c /home/mcuee/build/avr/avrdude_main/src/pgm_type.c
[ 47%] Building C object src/CMakeFiles/libavrdude.dir/pickit2.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/pickit2.c.o -MF CMakeFiles/libavrdude.dir/pickit2.c.o.d -o CMakeFiles/libavrdude.dir/pickit2.c.o -c /home/mcuee/build/avr/avrdude_main/src/pickit2.c
[ 48%] Building C object src/CMakeFiles/libavrdude.dir/pindefs.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/pindefs.c.o -MF CMakeFiles/libavrdude.dir/pindefs.c.o.d -o CMakeFiles/libavrdude.dir/pindefs.c.o -c /home/mcuee/build/avr/avrdude_main/src/pindefs.c
[ 50%] Building C object src/CMakeFiles/libavrdude.dir/ppi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ppi.c.o -MF CMakeFiles/libavrdude.dir/ppi.c.o.d -o CMakeFiles/libavrdude.dir/ppi.c.o -c /home/mcuee/build/avr/avrdude_main/src/ppi.c
[ 51%] Building C object src/CMakeFiles/libavrdude.dir/ppiwin.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ppiwin.c.o -MF CMakeFiles/libavrdude.dir/ppiwin.c.o.d -o CMakeFiles/libavrdude.dir/ppiwin.c.o -c /home/mcuee/build/avr/avrdude_main/src/ppiwin.c
[ 52%] Building C object src/CMakeFiles/libavrdude.dir/serbb_posix.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/serbb_posix.c.o -MF CMakeFiles/libavrdude.dir/serbb_posix.c.o.d -o CMakeFiles/libavrdude.dir/serbb_posix.c.o -c /home/mcuee/build/avr/avrdude_main/src/serbb_posix.c
[ 53%] Building C object src/CMakeFiles/libavrdude.dir/serbb_win32.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/serbb_win32.c.o -MF CMakeFiles/libavrdude.dir/serbb_win32.c.o.d -o CMakeFiles/libavrdude.dir/serbb_win32.c.o -c /home/mcuee/build/avr/avrdude_main/src/serbb_win32.c
[ 55%] Building C object src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.o -MF CMakeFiles/libavrdude.dir/ser_avrdoper.c.o.d -o CMakeFiles/libavrdude.dir/ser_avrdoper.c.o -c /home/mcuee/build/avr/avrdude_main/src/ser_avrdoper.c
[ 56%] Building C object src/CMakeFiles/libavrdude.dir/ser_posix.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ser_posix.c.o -MF CMakeFiles/libavrdude.dir/ser_posix.c.o.d -o CMakeFiles/libavrdude.dir/ser_posix.c.o -c /home/mcuee/build/avr/avrdude_main/src/ser_posix.c
[ 57%] Building C object src/CMakeFiles/libavrdude.dir/ser_win32.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/ser_win32.c.o -MF CMakeFiles/libavrdude.dir/ser_win32.c.o.d -o CMakeFiles/libavrdude.dir/ser_win32.c.o -c /home/mcuee/build/avr/avrdude_main/src/ser_win32.c
[ 59%] Building C object src/CMakeFiles/libavrdude.dir/serialadapter.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/serialadapter.c.o -MF CMakeFiles/libavrdude.dir/serialadapter.c.o.d -o CMakeFiles/libavrdude.dir/serialadapter.c.o -c /home/mcuee/build/avr/avrdude_main/src/serialadapter.c
[ 60%] Building C object src/CMakeFiles/libavrdude.dir/serialupdi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/serialupdi.c.o -MF CMakeFiles/libavrdude.dir/serialupdi.c.o.d -o CMakeFiles/libavrdude.dir/serialupdi.c.o -c /home/mcuee/build/avr/avrdude_main/src/serialupdi.c
[ 61%] Building C object src/CMakeFiles/libavrdude.dir/stk500.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/stk500.c.o -MF CMakeFiles/libavrdude.dir/stk500.c.o.d -o CMakeFiles/libavrdude.dir/stk500.c.o -c /home/mcuee/build/avr/avrdude_main/src/stk500.c
[ 63%] Building C object src/CMakeFiles/libavrdude.dir/stk500v2.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/stk500v2.c.o -MF CMakeFiles/libavrdude.dir/stk500v2.c.o.d -o CMakeFiles/libavrdude.dir/stk500v2.c.o -c /home/mcuee/build/avr/avrdude_main/src/stk500v2.c
[ 64%] Building C object src/CMakeFiles/libavrdude.dir/stk500generic.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/stk500generic.c.o -MF CMakeFiles/libavrdude.dir/stk500generic.c.o.d -o CMakeFiles/libavrdude.dir/stk500generic.c.o -c /home/mcuee/build/avr/avrdude_main/src/stk500generic.c
[ 65%] Building C object src/CMakeFiles/libavrdude.dir/strutil.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/strutil.c.o -MF CMakeFiles/libavrdude.dir/strutil.c.o.d -o CMakeFiles/libavrdude.dir/strutil.c.o -c /home/mcuee/build/avr/avrdude_main/src/strutil.c
[ 67%] Building C object src/CMakeFiles/libavrdude.dir/teensy.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/teensy.c.o -MF CMakeFiles/libavrdude.dir/teensy.c.o.d -o CMakeFiles/libavrdude.dir/teensy.c.o -c /home/mcuee/build/avr/avrdude_main/src/teensy.c
[ 68%] Building C object src/CMakeFiles/libavrdude.dir/term.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/term.c.o -MF CMakeFiles/libavrdude.dir/term.c.o.d -o CMakeFiles/libavrdude.dir/term.c.o -c /home/mcuee/build/avr/avrdude_main/src/term.c
[ 69%] Building C object src/CMakeFiles/libavrdude.dir/updi_link.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_link.c.o -MF CMakeFiles/libavrdude.dir/updi_link.c.o.d -o CMakeFiles/libavrdude.dir/updi_link.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_link.c
[ 71%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_nvm.c.o -MF CMakeFiles/libavrdude.dir/updi_nvm.c.o.d -o CMakeFiles/libavrdude.dir/updi_nvm.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_nvm.c
[ 72%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v0.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_nvm_v0.c.o -MF CMakeFiles/libavrdude.dir/updi_nvm_v0.c.o.d -o CMakeFiles/libavrdude.dir/updi_nvm_v0.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_nvm_v0.c
[ 73%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v2.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_nvm_v2.c.o -MF CMakeFiles/libavrdude.dir/updi_nvm_v2.c.o.d -o CMakeFiles/libavrdude.dir/updi_nvm_v2.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_nvm_v2.c
[ 75%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v3.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_nvm_v3.c.o -MF CMakeFiles/libavrdude.dir/updi_nvm_v3.c.o.d -o CMakeFiles/libavrdude.dir/updi_nvm_v3.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_nvm_v3.c
[ 76%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v4.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_nvm_v4.c.o -MF CMakeFiles/libavrdude.dir/updi_nvm_v4.c.o.d -o CMakeFiles/libavrdude.dir/updi_nvm_v4.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_nvm_v4.c
[ 77%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm_v5.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_nvm_v5.c.o -MF CMakeFiles/libavrdude.dir/updi_nvm_v5.c.o.d -o CMakeFiles/libavrdude.dir/updi_nvm_v5.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_nvm_v5.c
[ 78%] Building C object src/CMakeFiles/libavrdude.dir/updi_readwrite.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_readwrite.c.o -MF CMakeFiles/libavrdude.dir/updi_readwrite.c.o.d -o CMakeFiles/libavrdude.dir/updi_readwrite.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_readwrite.c
[ 80%] Building C object src/CMakeFiles/libavrdude.dir/updi_state.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/updi_state.c.o -MF CMakeFiles/libavrdude.dir/updi_state.c.o.d -o CMakeFiles/libavrdude.dir/updi_state.c.o -c /home/mcuee/build/avr/avrdude_main/src/updi_state.c
[ 81%] Building C object src/CMakeFiles/libavrdude.dir/urclock.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/urclock.c.o -MF CMakeFiles/libavrdude.dir/urclock.c.o.d -o CMakeFiles/libavrdude.dir/urclock.c.o -c /home/mcuee/build/avr/avrdude_main/src/urclock.c
[ 82%] Building C object src/CMakeFiles/libavrdude.dir/usbasp.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/usbasp.c.o -MF CMakeFiles/libavrdude.dir/usbasp.c.o.d -o CMakeFiles/libavrdude.dir/usbasp.c.o -c /home/mcuee/build/avr/avrdude_main/src/usbasp.c
[ 84%] Building C object src/CMakeFiles/libavrdude.dir/usb_hidapi.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/usb_hidapi.c.o -MF CMakeFiles/libavrdude.dir/usb_hidapi.c.o.d -o CMakeFiles/libavrdude.dir/usb_hidapi.c.o -c /home/mcuee/build/avr/avrdude_main/src/usb_hidapi.c
[ 85%] Building C object src/CMakeFiles/libavrdude.dir/usb_libusb.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/usb_libusb.c.o -MF CMakeFiles/libavrdude.dir/usb_libusb.c.o.d -o CMakeFiles/libavrdude.dir/usb_libusb.c.o -c /home/mcuee/build/avr/avrdude_main/src/usb_libusb.c
[ 86%] Building C object src/CMakeFiles/libavrdude.dir/usbtiny.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/usbtiny.c.o -MF CMakeFiles/libavrdude.dir/usbtiny.c.o.d -o CMakeFiles/libavrdude.dir/usbtiny.c.o -c /home/mcuee/build/avr/avrdude_main/src/usbtiny.c
[ 88%] Building C object src/CMakeFiles/libavrdude.dir/update.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/update.c.o -MF CMakeFiles/libavrdude.dir/update.c.o.d -o CMakeFiles/libavrdude.dir/update.c.o -c /home/mcuee/build/avr/avrdude_main/src/update.c
[ 89%] Building C object src/CMakeFiles/libavrdude.dir/wiring.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/wiring.c.o -MF CMakeFiles/libavrdude.dir/wiring.c.o.d -o CMakeFiles/libavrdude.dir/wiring.c.o -c /home/mcuee/build/avr/avrdude_main/src/wiring.c
[ 90%] Building C object src/CMakeFiles/libavrdude.dir/xbee.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/xbee.c.o -MF CMakeFiles/libavrdude.dir/xbee.c.o.d -o CMakeFiles/libavrdude.dir/xbee.c.o -c /home/mcuee/build/avr/avrdude_main/src/xbee.c
[ 92%] Building C object src/CMakeFiles/libavrdude.dir/__/lexer.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/__/lexer.c.o -MF CMakeFiles/libavrdude.dir/__/lexer.c.o.d -o CMakeFiles/libavrdude.dir/__/lexer.c.o -c /home/mcuee/build/avr/avrdude_main/build_static/lexer.c
[ 93%] Building C object src/CMakeFiles/libavrdude.dir/__/config_gram.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/libavrdude.dir/__/config_gram.c.o -MF CMakeFiles/libavrdude.dir/__/config_gram.c.o.d -o CMakeFiles/libavrdude.dir/__/config_gram.c.o -c /home/mcuee/build/avr/avrdude_main/build_static/config_gram.c
[ 94%] Linking C static library libavrdude.a
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -P CMakeFiles/libavrdude.dir/cmake_clean_target.cmake
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/libavrdude.dir/link.txt --verbose=1
/usr/bin/ar qc libavrdude.a CMakeFiles/libavrdude.dir/arduino.c.o CMakeFiles/libavrdude.dir/avr.c.o CMakeFiles/libavrdude.dir/avr910.c.o CMakeFiles/libavrdude.dir/avrcache.c.o CMakeFiles/libavrdude.dir/avrftdi.c.o CMakeFiles/libavrdude.dir/avrftdi_tpi.c.o CMakeFiles/libavrdude.dir/avrintel.c.o CMakeFiles/libavrdude.dir/avrpart.c.o CMakeFiles/libavrdude.dir/bitbang.c.o CMakeFiles/libavrdude.dir/buspirate.c.o CMakeFiles/libavrdude.dir/butterfly.c.o CMakeFiles/libavrdude.dir/ch341a.c.o CMakeFiles/libavrdude.dir/config.c.o CMakeFiles/libavrdude.dir/confwin.c.o CMakeFiles/libavrdude.dir/crc16.c.o CMakeFiles/libavrdude.dir/dfu.c.o CMakeFiles/libavrdude.dir/dryrun.c.o CMakeFiles/libavrdude.dir/fileio.c.o CMakeFiles/libavrdude.dir/flip1.c.o CMakeFiles/libavrdude.dir/flip2.c.o CMakeFiles/libavrdude.dir/ft245r.c.o CMakeFiles/libavrdude.dir/jtagmkI.c.o CMakeFiles/libavrdude.dir/jtagmkII.c.o CMakeFiles/libavrdude.dir/jtag3.c.o CMakeFiles/libavrdude.dir/leds.c.o CMakeFiles/libavrdude.dir/linuxgpio.c.o CMakeFiles/libavrdude.dir/linuxspi.c.o CMakeFiles/libavrdude.dir/lists.c.o CMakeFiles/libavrdude.dir/micronucleus.c.o CMakeFiles/libavrdude.dir/par.c.o CMakeFiles/libavrdude.dir/pgm.c.o CMakeFiles/libavrdude.dir/pgm_type.c.o CMakeFiles/libavrdude.dir/pickit2.c.o CMakeFiles/libavrdude.dir/pindefs.c.o CMakeFiles/libavrdude.dir/ppi.c.o CMakeFiles/libavrdude.dir/ppiwin.c.o CMakeFiles/libavrdude.dir/serbb_posix.c.o CMakeFiles/libavrdude.dir/serbb_win32.c.o CMakeFiles/libavrdude.dir/ser_avrdoper.c.o CMakeFiles/libavrdude.dir/ser_posix.c.o CMakeFiles/libavrdude.dir/ser_win32.c.o CMakeFiles/libavrdude.dir/serialadapter.c.o CMakeFiles/libavrdude.dir/serialupdi.c.o CMakeFiles/libavrdude.dir/stk500.c.o CMakeFiles/libavrdude.dir/stk500v2.c.o CMakeFiles/libavrdude.dir/stk500generic.c.o CMakeFiles/libavrdude.dir/strutil.c.o CMakeFiles/libavrdude.dir/teensy.c.o CMakeFiles/libavrdude.dir/term.c.o CMakeFiles/libavrdude.dir/updi_link.c.o CMakeFiles/libavrdude.dir/updi_nvm.c.o CMakeFiles/libavrdude.dir/updi_nvm_v0.c.o CMakeFiles/libavrdude.dir/updi_nvm_v2.c.o CMakeFiles/libavrdude.dir/updi_nvm_v3.c.o CMakeFiles/libavrdude.dir/updi_nvm_v4.c.o CMakeFiles/libavrdude.dir/updi_nvm_v5.c.o CMakeFiles/libavrdude.dir/updi_readwrite.c.o CMakeFiles/libavrdude.dir/updi_state.c.o CMakeFiles/libavrdude.dir/urclock.c.o CMakeFiles/libavrdude.dir/usbasp.c.o CMakeFiles/libavrdude.dir/usb_hidapi.c.o CMakeFiles/libavrdude.dir/usb_libusb.c.o CMakeFiles/libavrdude.dir/usbtiny.c.o CMakeFiles/libavrdude.dir/update.c.o CMakeFiles/libavrdude.dir/wiring.c.o CMakeFiles/libavrdude.dir/xbee.c.o CMakeFiles/libavrdude.dir/__/lexer.c.o CMakeFiles/libavrdude.dir/__/config_gram.c.o
/usr/bin/ranlib libavrdude.a
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[ 94%] Built target libavrdude
/usr/bin/make  -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/depend
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
cd /home/mcuee/build/avr/avrdude_main/build_static && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/mcuee/build/avr/avrdude_main /home/mcuee/build/avr/avrdude_main/src /home/mcuee/build/avr/avrdude_main/build_static /home/mcuee/build/avr/avrdude_main/build_static/src /home/mcuee/build/avr/avrdude_main/build_static/src/CMakeFiles/avrdude.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/make  -f src/CMakeFiles/avrdude.dir/build.make src/CMakeFiles/avrdude.dir/build
make[2]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_static'
[ 96%] Building C object src/CMakeFiles/avrdude.dir/main.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/avrdude.dir/main.c.o -MF CMakeFiles/avrdude.dir/main.c.o.d -o CMakeFiles/avrdude.dir/main.c.o -c /home/mcuee/build/avr/avrdude_main/src/main.c
[ 97%] Building C object src/CMakeFiles/avrdude.dir/developer_opts.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/avrdude.dir/developer_opts.c.o -MF CMakeFiles/avrdude.dir/developer_opts.c.o.d -o CMakeFiles/avrdude.dir/developer_opts.c.o -c /home/mcuee/build/avr/avrdude_main/src/developer_opts.c
[ 98%] Building C object src/CMakeFiles/avrdude.dir/whereami.c.o
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cc -DCONFIG_DIR=\"/usr/local/etc\" -I/home/mcuee/build/avr/avrdude_main/build_static/src -I/home/mcuee/build/avr/avrdude_main -I/home/mcuee/build/avr/avrdude_main/build_static -I/home/mcuee/build/avr/avrdude_main/src -I/usr/local/include -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/avrdude.dir/whereami.c.o -MF CMakeFiles/avrdude.dir/whereami.c.o.d -o CMakeFiles/avrdude.dir/whereami.c.o -c /home/mcuee/build/avr/avrdude_main/src/whereami.c
[100%] Linking C executable avrdude
cd /home/mcuee/build/avr/avrdude_main/build_static/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/avrdude.dir/link.txt --verbose=1
/usr/bin/cc -I/usr/local/include -O2 -g -DNDEBUG -L/usr/local/lib -pthread -Wl,--no-as-needed -ldl -lz -ludev CMakeFiles/avrdude.dir/main.c.o CMakeFiles/avrdude.dir/developer_opts.c.o CMakeFiles/avrdude.dir/whereami.c.o -o avrdude  libavrdude.a -lm /usr/lib/x86_64-linux-gnu/libelf.a /usr/local/lib/libusb.a /usr/local/lib/libusb-1.0.a /usr/local/lib/libhidapi-libusb.a /usr/local/lib/libftdi1.a /usr/lib/x86_64-linux-gnu/libreadline.a /usr/local/lib/libserialport.a -lncurses 
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
[100%] Built target avrdude
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_static'
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_static/CMakeFiles 0

Results:

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ ls ./build_static/src/
ac_cfg.h  avrdude.conf     avrdude.spec  cmake_install.cmake  Makefile
avrdude   avrdude.conf.in  CMakeFiles    libavrdude.a

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ ldd ./build_static/src/avrdude
	linux-vdso.so.1 (0x00007ffe44b9c000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fafe4f71000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fafe4f55000)
	libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007fafe4f28000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fafe4dd9000)
	libncurses.so.6 => /lib/x86_64-linux-gnu/libncurses.so.6 (0x00007fafe4db0000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fafe4d80000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fafe4d5b000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fafe4b69000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fafe54d2000)

Normal build outcome (using default build.sh).

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ ls ./build_linux/src/
ac_cfg.h  avrdude.conf     avrdude.spec  cmake_install.cmake  Makefile
avrdude   avrdude.conf.in  CMakeFiles    libavrdude.a

mcuee@UbuntuSwift3 ~/build/avr/avrdude_main (main)$ ldd ./build_linux/src/avrdude
	linux-vdso.so.1 (0x00007ffccff9e000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007efe0bf0c000)
	libelf.so.1 => /lib/x86_64-linux-gnu/libelf.so.1 (0x00007efe0bef0000)
	libusb-0.1.so.4 => /usr/local/lib/libusb-0.1.so.4 (0x00007efe0bee8000)
	libusb-1.0.so.0 => /usr/local/lib/libusb-1.0.so.0 (0x00007efe0bec8000)
	libhidapi-libusb.so.0 => /usr/local/lib/libhidapi-libusb.so.0 (0x00007efe0bebd000)
	libftdi1.so.2 => /usr/local/lib/libftdi1.so.2 (0x00007efe0beaa000)
	libreadline.so.8 => /lib/x86_64-linux-gnu/libreadline.so.8 (0x00007efe0be5a000)
	libserialport.so.0 => /usr/local/lib/libserialport.so.0 (0x00007efe0be47000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007efe0bc55000)
	/lib64/ld-linux-x86-64.so.2 (0x00007efe0c53a000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007efe0bc39000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007efe0bc33000)
	libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007efe0bc04000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007efe0bbe1000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007efe0bbb1000)

@stefanrueger
Copy link
Collaborator

@ndim Good analysis.

"all-dynamic" build [...] ideal [...] in a world with a stable libavrdude API and ABI

Isn't the critical part here that avrdude is linked with the libavrdude dynamic library that is shipped at the same time?Could that be enforced by correct versioning? I agree, linking avrdude statically against libavrdude guards against this type of error.

Anyway, I have too little experience in building projects for different platforms to have a preference for which options the AVRDUDE project should have.

@ndim
Copy link
Contributor

ndim commented Mar 3, 2024

I am not concerned about compatibility between the avrdude tool and the libavrdude library. Both are developed by the same people in the same repository after all.

But if you offer libavrdude to a global audience to allow them to develop tools which make use of libavrdude, you must expect that third parties actually start using libavrdude in their software and prepare for that scenario.

That is when incompatibly changing libavrdude can break those third party tools. Either by breaking the ABI (relevant for dynamic linking, mainly on BSD, Linux, OSX) or by breaking the API (relevant for all systems). Then libavrdude devs need to coordinate with the external libavrdude users, each distro needs to coordinate rebuilding third party tool packages, and users who have built third party tools dynamically linked against a OS package will have them broken.

Or with API changes, third party software might stop building with a newer libavrdude.

So with an unstable libavrdude API/ABI, fully dynamic builds do not provide much value.

The loooong list of part specific constants macro definitions might need to be converted into data structures and functions acting on those which represent the semantics of those compile time definitions at runtime. So the API/ABI would only cover a few functions getting and dealing with those part specific data structures which are provided by libavrdude. Then those data structures and functions could remain stable in the longer term. You might need to add a new function from time to time which does not break existing API or ABI.

Anyway, API/ABI design specifics are getting a little off topic for an issue which is primarily about build types.

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

No branches or pull requests

7 participants