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

Unable to build libavrdude dynamic and static library with CMake buildsystem #952

Closed
subnut opened this issue May 9, 2022 · 17 comments
Closed
Labels
enhancement New feature or request

Comments

@subnut
Copy link
Contributor

subnut commented May 9, 2022

Previously, ./configure would build both static and shared libraries in one go.
Now, using the new CMake build, I am unable to do so.

Please tell me how to do so.

@mcuee
Copy link
Collaborator

mcuee commented May 9, 2022

This was used as a reason against CMake in the libusb build system discussion.
libusb/libusb#1134

But I believe something can be done as in the libftdi example.
http://developer.intra2net.com/git/?p=libftdi

@mcuee
Copy link
Collaborator

mcuee commented May 9, 2022

@subnut Are you able to build the share library? Somehow I have no issues to build the static library under MSYS2 (mingw32 and mingw64) but not able to do the same for the shared library.

click for the full build log
$ cmake ..
-- Configuration summary:
-- ----------------------
-- DO HAVE    libelf
-- DO HAVE    libusb
-- DO HAVE    libusb_1_0
-- DO HAVE    libhidapi
-- DON'T HAVE libftdi
-- DO HAVE    libftdi1
-- ENABLED    doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: C:/work/avr/avrdude/build_mingw64


$ mingw32-make -i
Consolidate compiler generated dependencies of target libavrdude
[  1%] Building C object src/CMakeFiles/libavrdude.dir/arduino.c.obj
[  3%] Building C object src/CMakeFiles/libavrdude.dir/avr.c.obj
[  4%] Building C object src/CMakeFiles/libavrdude.dir/avr910.c.obj
[  6%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi.c.obj
[  8%] Building C object src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.obj
[  9%] Building C object src/CMakeFiles/libavrdude.dir/avrpart.c.obj
[ 11%] Building C object src/CMakeFiles/libavrdude.dir/bitbang.c.obj
[ 12%] Building C object src/CMakeFiles/libavrdude.dir/buspirate.c.obj
[ 14%] Building C object src/CMakeFiles/libavrdude.dir/butterfly.c.obj
[ 16%] Building C object src/CMakeFiles/libavrdude.dir/config.c.obj
[ 17%] Building C object src/CMakeFiles/libavrdude.dir/confwin.c.obj
[ 19%] Building C object src/CMakeFiles/libavrdude.dir/crc16.c.obj
[ 20%] Building C object src/CMakeFiles/libavrdude.dir/dfu.c.obj
[ 22%] Building C object src/CMakeFiles/libavrdude.dir/fileio.c.obj
[ 24%] Building C object src/CMakeFiles/libavrdude.dir/flip1.c.obj
[ 25%] Building C object src/CMakeFiles/libavrdude.dir/flip2.c.obj
[ 27%] Building C object src/CMakeFiles/libavrdude.dir/ft245r.c.obj
[ 29%] Building C object src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj
[ 30%] Building C object src/CMakeFiles/libavrdude.dir/jtagmkII.c.obj
[ 32%] Building C object src/CMakeFiles/libavrdude.dir/jtag3.c.obj
[ 33%] Building C object src/CMakeFiles/libavrdude.dir/linuxgpio.c.obj
[ 35%] Building C object src/CMakeFiles/libavrdude.dir/linuxspi.c.obj
[ 37%] Building C object src/CMakeFiles/libavrdude.dir/lists.c.obj
[ 38%] Building C object src/CMakeFiles/libavrdude.dir/micronucleus.c.obj
[ 40%] Building C object src/CMakeFiles/libavrdude.dir/par.c.obj
[ 41%] Building C object src/CMakeFiles/libavrdude.dir/pgm.c.obj
[ 43%] Building C object src/CMakeFiles/libavrdude.dir/pgm_type.c.obj
[ 45%] Building C object src/CMakeFiles/libavrdude.dir/pickit2.c.obj
[ 46%] Building C object src/CMakeFiles/libavrdude.dir/pindefs.c.obj
[ 48%] Building C object src/CMakeFiles/libavrdude.dir/ppi.c.obj
[ 50%] Building C object src/CMakeFiles/libavrdude.dir/ppiwin.c.obj
[ 51%] Building C object src/CMakeFiles/libavrdude.dir/serbb_posix.c.obj
[ 53%] Building C object src/CMakeFiles/libavrdude.dir/serbb_win32.c.obj
[ 54%] Building C object src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.obj
[ 56%] Building C object src/CMakeFiles/libavrdude.dir/ser_posix.c.obj
[ 58%] Building C object src/CMakeFiles/libavrdude.dir/ser_win32.c.obj
[ 59%] Building C object src/CMakeFiles/libavrdude.dir/serialupdi.c.obj
[ 61%] Building C object src/CMakeFiles/libavrdude.dir/stk500.c.obj
[ 62%] Building C object src/CMakeFiles/libavrdude.dir/stk500v2.c.obj
[ 64%] Building C object src/CMakeFiles/libavrdude.dir/stk500generic.c.obj
[ 66%] Building C object src/CMakeFiles/libavrdude.dir/teensy.c.obj
[ 67%] Building C object src/CMakeFiles/libavrdude.dir/updi_link.c.obj
[ 69%] Building C object src/CMakeFiles/libavrdude.dir/updi_nvm.c.obj
[ 70%] Building C object src/CMakeFiles/libavrdude.dir/updi_readwrite.c.obj
[ 72%] Building C object src/CMakeFiles/libavrdude.dir/updi_state.c.obj
[ 74%] Building C object src/CMakeFiles/libavrdude.dir/usbasp.c.obj
[ 75%] Building C object src/CMakeFiles/libavrdude.dir/usb_hidapi.c.obj
[ 77%] Building C object src/CMakeFiles/libavrdude.dir/usb_libusb.c.obj
[ 79%] Building C object src/CMakeFiles/libavrdude.dir/usbtiny.c.obj
[ 80%] Building C object src/CMakeFiles/libavrdude.dir/update.c.obj
[ 82%] Building C object src/CMakeFiles/libavrdude.dir/wiring.c.obj
[ 83%] Building C object src/CMakeFiles/libavrdude.dir/xbee.c.obj
[ 85%] Building C object src/CMakeFiles/libavrdude.dir/__/lexer.c.obj
[ 87%] Building C object src/CMakeFiles/libavrdude.dir/__/config_gram.c.obj
[ 88%] Linking C shared library libavrdude.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(arduino.c.obj):arduino.c:(.text+0x3d): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(arduino.c.obj):arduino.c:(.text+0xd8): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(arduino.c.obj):arduino.c:(.text+0x11c): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(arduino.c.obj):arduino.c:(.text+0x15d): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(arduino.c.obj):arduino.c:(.rdata$.refptr.progname[.refptr.progname]+0x0): undefined reference to `progname'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr.c.obj):avr.c:(.text+0xc2): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr.c.obj):avr.c:(.text+0x18d): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr.c.obj):avr.c:(.text+0x265): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr.c.obj):avr.c:(.text+0x324): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr.c.obj):avr.c:(.text+0x338): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr.c.obj):avr.c:(.text+0x35a): more undefined references to `avrdude_message' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr.c.obj):avr.c:(.rdata$.refptr.progbuf[.refptr.progbuf]+0x0): undefined reference to `progbuf'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr910.c.obj):avr910.c:(.text+0x94): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr910.c.obj):avr910.c:(.text+0x1a4): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr910.c.obj):avr910.c:(.text+0x242): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr910.c.obj):avr910.c:(.text+0x44b): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr910.c.obj):avr910.c:(.text+0x473): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr910.c.obj):avr910.c:(.text+0x49b): more undefined references to `avrdude_message' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avr910.c.obj):avr910.c:(.rdata$.refptr.ovsigck[.refptr.ovsigck]+0x0): undefined reference to `ovsigck'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi.c.obj):avrftdi.c:(.text+0x1fc): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi.c.obj):avrftdi.c:(.text+0x212): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi.c.obj):avrftdi.c:(.text+0x228): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi.c.obj):avrftdi.c:(.text+0x23e): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi.c.obj):avrftdi.c:(.text+0x254): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi.c.obj):avrftdi.c:(.text+0x26a): more undefined references to `avrdude_message' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi.c.obj):avrftdi.c:(.rdata$.refptr.verbose[.refptr.verbose]+0x0): undefined reference to `verbose'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi_tpi.c.obj):avrftdi_tpi.c:(.text+0x3d4): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrftdi_tpi.c.obj):avrftdi_tpi.c:(.text+0x56b): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrpart.c.obj):avrpart.c:(.text+0x70): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrpart.c.obj):avrpart.c:(.text+0xde): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrpart.c.obj):avrpart.c:(.text+0x72d): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(avrpart.c.obj):avrpart.c:(.text+0x794): more undefined references to `avrdude_message' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(fileio.c.obj):fileio.c:(.rdata$.refptr.quell_progress[.refptr.quell_progress]+0x0): undefined reference to `quell_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(flip1.c.obj):flip1.c:(.text+0x22a): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(flip1.c.obj):flip1.c:(.text+0x28c): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(flip1.c.obj):flip1.c:(.text+0x309): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(flip1.c.obj):flip1.c:(.text+0x355): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(flip1.c.obj):flip1.c:(.text+0x390): undefined reference to `avrdude_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\libavrdude.dir/objects.a(flip1.c.obj):flip1.c:(.text+0x3cb): more undefined references to `avrdude_message' follow
collect2.exe: error: ld returned 1 exit status
[ 91%] Built target libavrdude
Scanning dependencies of target avrdude
Consolidate compiler generated dependencies of target avrdude
[ 93%] Building C object src/CMakeFiles/avrdude.dir/main.c.obj
[ 95%] Building C object src/CMakeFiles/avrdude.dir/term.c.obj
[ 96%] Building C object src/CMakeFiles/avrdude.dir/whereami.c.obj
[ 98%] Building RC object src/CMakeFiles/avrdude.dir/windows.rc.obj
[100%] Linking C executable avrdude.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x4e2): undefined reference to `sort_programmers'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x4fc): undefined reference to `walk_programmers'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x58a): undefined reference to `walk_programmer_types'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x678): undefined reference to `sort_avrparts'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x692): undefined reference to `walk_avrparts'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x6ff): undefined reference to `ldestroy_cb'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x725): undefined reference to `ldestroy'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x74b): undefined reference to `ldestroy'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x75b): undefined reference to `cleanup_config'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x8f0): undefined reference to `init_config'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x90e): undefined reference to `lcreat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x958): undefined reference to `lcreat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x9a2): undefined reference to `lcreat'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0xe91): undefined reference to `ladd'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0xfbd): undefined reference to `parse_op'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1019): undefined reference to `ladd'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1048): undefined reference to `dup_update'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1073): undefined reference to `ladd'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x10b4): undefined reference to `ladd'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x14d1): undefined reference to `win_sys_config_set'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1561): undefined reference to `win_usr_config_set'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1663): undefined reference to `read_config'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1735): undefined reference to `read_config'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1785): undefined reference to `lsize'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x17a7): undefined reference to `lfirst'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x17c2): undefined reference to `ldata'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x17fd): undefined reference to `read_config'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x184d): undefined reference to `lnext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1ada): undefined reference to `locate_programmer'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1c41): undefined reference to `lsize'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1dc5): undefined reference to `locate_part'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1eed): undefined reference to `avr_initmem'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1f28): undefined reference to `lfirst'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x1f43): undefined reference to `ldata'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2056): undefined reference to `lnext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2412): undefined reference to `avr_display'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x243c): undefined reference to `programmer_display'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x264d): undefined reference to `avr_signature'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x283c): undefined reference to `avr_unlock'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x28a0): undefined reference to `avr_locate_mem'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2a9a): undefined reference to `locate_part_by_signature'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2cc2): undefined reference to `lsize'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2d4e): undefined reference to `lfirst'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2d69): undefined reference to `ldata'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2d89): undefined reference to `avr_locate_mem'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2e22): undefined reference to `lnext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2ebc): undefined reference to `avr_chip_erase'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2f1b): undefined reference to `lfirst'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2f33): undefined reference to `ldata'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2f64): undefined reference to `do_op'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.text+0x2f8e): undefined reference to `lnext'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.rdata$.refptr.programmers[.refptr.programmers]+0x0): undefined reference to `programmers'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.rdata$.refptr.part_list[.refptr.part_list]+0x0): undefined reference to `part_list'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.rdata$.refptr.update_progress[.refptr.update_progress]+0x0): undefined reference to `update_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.rdata$.refptr.default_programmer[.refptr.default_programmer]+0x0): undefined reference to `default_programmer'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.rdata$.refptr.default_bitclock[.refptr.default_bitclock]+0x0): undefined reference to `default_bitclock'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.rdata$.refptr.default_serial[.refptr.default_serial]+0x0): undefined reference to `default_serial'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.rdata$.refptr.default_parallel[.refptr.default_parallel]+0x0): undefined reference to `default_parallel'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(main.c.obj):main.c:(.rdata$.refptr.free_update[.refptr.free_update]+0x0): undefined reference to `free_update'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x635): undefined reference to `avr_locate_mem'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x96d): undefined reference to `report_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0xa34): undefined reference to `report_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0xa5c): undefined reference to `report_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0xb3a): undefined reference to `avr_locate_mem'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x18dc): undefined reference to `report_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x1924): undefined reference to `avr_write_byte'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x1a76): undefined reference to `report_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x1aa0): undefined reference to `report_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x1e18): undefined reference to `avr_display'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x1e6e): undefined reference to `avr_signature'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\avrdude.dir/objects.a(term.c.obj):term.c:(.text+0x1ea4): undefined reference to `avr_locate_mem'
collect2.exe: error: ld returned 1 exit status
[100%] Built target avrdude

@subnut
Copy link
Contributor Author

subnut commented May 9, 2022

@mcuee Yes, I am. But I am on Linux, and I do not have a Windows system nearby to test.

@mcuee
Copy link
Collaborator

mcuee commented May 9, 2022

@mcuee Yes, I am. But I am on Linux, and I do not have a Windows system nearby to test.

Thanks. I will try your patch as well to see if that helps. Or maybe I will try to fix my MSY2 MinGW32/64 build.

@subnut
Copy link
Contributor Author

subnut commented May 9, 2022

@mcuee I don't think my patch is going to fix that.

https://stackoverflow.com/a/57932764

The reason why this worked in Linux and not in Windows is that DLL needs to have all external dependencies resolved during linking, while in Linux SO can have undefined symbols, which are resolved only when the library is used.

@mariusgreuel
Copy link
Contributor

@dl8dtl Building the avrdude libraries is getting quite a bit attention. I spend very little time looking at this because I was under the impression that the avrdude library is not really used. Also, the avrdude code base does not really seem to be prepared for building libraries (i.e. external references such as progname, exposure of internal data structures, lack of versioning, etc.).

What's your view on this? Are libraries part of the avrdude delivery, if so, both static and dynamic libraries?

@dl8dtl
Copy link
Contributor

dl8dtl commented May 9, 2022

Basically, the separation of the library backend from the CLI frontend has been a long-standing wish, but it's still kinda work in progress, see for example issue #774
The idea is that a completely separated backend would make it much easier to provide a GUI frontend as an alternative to the traditional CLI frontend. All existing GUI attempts wrap around the CLI which is merely a crock only.
For the CLI, it's probably fine to just build upon the static library, but for the idea of a possible GUI frontend, at least under non-Windows systems, a shared library has some merit.

@mcuee
Copy link
Collaborator

mcuee commented May 9, 2022

How can I shared a version of avrdude binary which is dynamically linked to libusb-1.0.dll and libhidapi.dll under Windows? I do not really need to build the shared library.

#955 has been raised for this issue.

@mariusgreuel
Copy link
Contributor

I guess my question is whether we accept PRs for this, or just call the libraries 'deprecated' until there is a real need for it. Right now, I see very little value in PRs trying to build avrdude dummy DLLs, just for the sake of building it. It would be a whole different matter if there was a real project behind this.

@mcuee
Copy link
Collaborator

mcuee commented Jun 11, 2022

Pull requrst #960 was closed -- but it actually helps to fix the issue under macOS even though it can not help on Windows.

@mcuee
Copy link
Collaborator

mcuee commented Jan 14, 2023

Right now macOS homebrew is using a trick to build shared library.
https://github.com/Homebrew/homebrew-core/blob/master/Formula/avrdude.rb

I can use the trick to build shared library and static library with seperate build, which seems to be the way to go for CMake.

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
Copy link
Collaborator

mcuee commented Jan 14, 2023

As of now, there is no way to build shared libavrdude.dll under Windows, either with MinGW or MSVC.

Example using MSYS2 mingw.

$ cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON  -B build_shared -DCMAKE_SHARED_LINKER_FLAGS=-Wl,-undefined,dynamic_lookup

$ cmake --build build_shared
[1/2] cmd.exe /C "cd . && C:\msys64\mingw64\bin\cc.exe -O2 -g -DNDEBUG  -Wl,-undefined,dynamic_lookup -shared -o src\libavrdude.dll -Wl,--out-implib,src\liblibavrdude.dll.a -Wl,--major-image-version,1,--minor-image-version,0 src/CMakeFiles/libavrdude.dir/arduino.c.obj src/CMakeFiles/libavrdude.dir/avr.c.obj src/CMakeFiles/libavrdude.dir/avr910.c.obj src/CMakeFiles/libavrdude.dir/avrcache.c.obj src/CMakeFiles/libavrdude.dir/avrftdi.c.obj src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.obj src/CMakeFiles/libavrdude.dir/avrpart.c.obj src/CMakeFiles/libavrdude.dir/bitbang.c.obj src/CMakeFiles/libavrdude.dir/buspirate.c.obj src/CMakeFiles/libavrdude.dir/butterfly.c.obj src/CMakeFiles/libavrdude.dir/config.c.obj src/CMakeFiles/libavrdude.dir/confwin.c.obj src/CMakeFiles/libavrdude.dir/crc16.c.obj src/CMakeFiles/libavrdude.dir/dfu.c.obj src/CMakeFiles/libavrdude.dir/fileio.c.obj src/CMakeFiles/libavrdude.dir/flip1.c.obj src/CMakeFiles/libavrdude.dir/flip2.c.obj src/CMakeFiles/libavrdude.dir/ft245r.c.obj src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj src/CMakeFiles/libavrdude.dir/jtagmkII.c.obj src/CMakeFiles/libavrdude.dir/jtag3.c.obj src/CMakeFiles/libavrdude.dir/linuxgpio.c.obj src/CMakeFiles/libavrdude.dir/linuxspi.c.obj src/CMakeFiles/libavrdude.dir/lists.c.obj src/CMakeFiles/libavrdude.dir/micronucleus.c.obj src/CMakeFiles/libavrdude.dir/par.c.obj src/CMakeFiles/libavrdude.dir/pgm.c.obj src/CMakeFiles/libavrdude.dir/pgm_type.c.obj src/CMakeFiles/libavrdude.dir/pickit2.c.obj src/CMakeFiles/libavrdude.dir/pindefs.c.obj src/CMakeFiles/libavrdude.dir/ppi.c.obj src/CMakeFiles/libavrdude.dir/ppiwin.c.obj src/CMakeFiles/libavrdude.dir/serbb_posix.c.obj src/CMakeFiles/libavrdude.dir/serbb_win32.c.obj src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.obj src/CMakeFiles/libavrdude.dir/ser_posix.c.obj src/CMakeFiles/libavrdude.dir/ser_win32.c.obj src/CMakeFiles/libavrdude.dir/serialupdi.c.obj src/CMakeFiles/libavrdude.dir/stk500.c.obj src/CMakeFiles/libavrdude.dir/stk500v2.c.obj src/CMakeFiles/libavrdude.dir/stk500generic.c.obj src/CMakeFiles/libavrdude.dir/teensy.c.obj src/CMakeFiles/libavrdude.dir/updi_link.c.obj src/CMakeFiles/libavrdude.dir/updi_nvm.c.obj src/CMakeFiles/libavrdude.dir/updi_readwrite.c.obj src/CMakeFiles/libavrdude.dir/updi_state.c.obj src/CMakeFiles/libavrdude.dir/urclock.c.obj src/CMakeFiles/libavrdude.dir/usbasp.c.obj src/CMakeFiles/libavrdude.dir/usb_hidapi.c.obj src/CMakeFiles/libavrdude.dir/usb_libusb.c.obj src/CMakeFiles/libavrdude.dir/usbtiny.c.obj src/CMakeFiles/libavrdude.dir/update.c.obj src/CMakeFiles/libavrdude.dir/wiring.c.obj src/CMakeFiles/libavrdude.dir/xbee.c.obj src/CMakeFiles/libavrdude.dir/__/lexer.c.obj src/CMakeFiles/libavrdude.dir/__/config_gram.c.obj  -lm  C:/msys64/mingw64/lib/libelf.a  C:/msys64/mingw64/lib/libusb.dll.a  C:/msys64/mingw64/lib/libusb-1.0.dll.a  C:/msys64/mingw64/lib/libhid.a  C:/msys64/mingw64/lib/libhidapi.dll.a  C:/msys64/mingw64/lib/libftdi1.dll.a  C:/msys64/mingw64/lib/libreadline.dll.a  -lsetupapi  -lws2_32  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
FAILED: src/libavrdude.dll src/liblibavrdude.dll.a
cmd.exe /C "cd . && C:\msys64\mingw64\bin\cc.exe -O2 -g -DNDEBUG  -Wl,-undefined,dynamic_lookup -shared -o src\libavrdude.dll -Wl,--out-implib,src\liblibavrdude.dll.a -Wl,--major-image-version,1,--minor-image-version,0 src/CMakeFiles/libavrdude.dir/arduino.c.obj src/CMakeFiles/libavrdude.dir/avr.c.obj src/CMakeFiles/libavrdude.dir/avr910.c.obj src/CMakeFiles/libavrdude.dir/avrcache.c.obj src/CMakeFiles/libavrdude.dir/avrftdi.c.obj src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.obj src/CMakeFiles/libavrdude.dir/avrpart.c.obj src/CMakeFiles/libavrdude.dir/bitbang.c.obj src/CMakeFiles/libavrdude.dir/buspirate.c.obj src/CMakeFiles/libavrdude.dir/butterfly.c.obj src/CMakeFiles/libavrdude.dir/config.c.obj src/CMakeFiles/libavrdude.dir/confwin.c.obj src/CMakeFiles/libavrdude.dir/crc16.c.obj src/CMakeFiles/libavrdude.dir/dfu.c.obj src/CMakeFiles/libavrdude.dir/fileio.c.obj src/CMakeFiles/libavrdude.dir/flip1.c.obj src/CMakeFiles/libavrdude.dir/flip2.c.obj src/CMakeFiles/libavrdude.dir/ft245r.c.obj src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj src/CMakeFiles/libavrdude.dir/jtagmkII.c.obj src/CMakeFiles/libavrdude.dir/jtag3.c.obj src/CMakeFiles/libavrdude.dir/linuxgpio.c.obj src/CMakeFiles/libavrdude.dir/linuxspi.c.obj src/CMakeFiles/libavrdude.dir/lists.c.obj src/CMakeFiles/libavrdude.dir/micronucleus.c.obj src/CMakeFiles/libavrdude.dir/par.c.obj src/CMakeFiles/libavrdude.dir/pgm.c.obj src/CMakeFiles/libavrdude.dir/pgm_type.c.obj src/CMakeFiles/libavrdude.dir/pickit2.c.obj src/CMakeFiles/libavrdude.dir/pindefs.c.obj src/CMakeFiles/libavrdude.dir/ppi.c.obj src/CMakeFiles/libavrdude.dir/ppiwin.c.obj src/CMakeFiles/libavrdude.dir/serbb_posix.c.obj src/CMakeFiles/libavrdude.dir/serbb_win32.c.obj src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.obj src/CMakeFiles/libavrdude.dir/ser_posix.c.obj src/CMakeFiles/libavrdude.dir/ser_win32.c.obj src/CMakeFiles/libavrdude.dir/serialupdi.c.obj src/CMakeFiles/libavrdude.dir/stk500.c.obj src/CMakeFiles/libavrdude.dir/stk500v2.c.obj src/CMakeFiles/libavrdude.dir/stk500generic.c.obj src/CMakeFiles/libavrdude.dir/teensy.c.obj src/CMakeFiles/libavrdude.dir/updi_link.c.obj src/CMakeFiles/libavrdude.dir/updi_nvm.c.obj src/CMakeFiles/libavrdude.dir/updi_readwrite.c.obj src/CMakeFiles/libavrdude.dir/updi_state.c.obj src/CMakeFiles/libavrdude.dir/urclock.c.obj src/CMakeFiles/libavrdude.dir/usbasp.c.obj src/CMakeFiles/libavrdude.dir/usb_hidapi.c.obj src/CMakeFiles/libavrdude.dir/usb_libusb.c.obj src/CMakeFiles/libavrdude.dir/usbtiny.c.obj src/CMakeFiles/libavrdude.dir/update.c.obj src/CMakeFiles/libavrdude.dir/wiring.c.obj src/CMakeFiles/libavrdude.dir/xbee.c.obj src/CMakeFiles/libavrdude.dir/__/lexer.c.obj src/CMakeFiles/libavrdude.dir/__/config_gram.c.obj  -lm  C:/msys64/mingw64/lib/libelf.a  C:/msys64/mingw64/lib/libusb.dll.a  C:/msys64/mingw64/lib/libusb-1.0.dll.a  C:/msys64/mingw64/lib/libhid.a  C:/msys64/mingw64/lib/libhidapi.dll.a  C:/msys64/mingw64/lib/libftdi1.dll.a  C:/msys64/mingw64/lib/libreadline.dll.a  -lsetupapi  -lws2_32  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/arduino.c.obj: in function `arduino_read_sig_bytes':
C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:67: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:68: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:62: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:63: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:47: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/arduino.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:59: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr.c.obj:avr.c:(.rdata$.refptr.quell_progress[.refptr.quell_progress]+0x0): undefined reference to `quell_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr.c.obj:avr.c:(.rdata$.refptr.verbose[.refptr.verbose]+0x0): undefined reference to `verbose'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr.c.obj:avr.c:(.rdata$.refptr.progname[.refptr.progname]+0x0): undefined reference to `progname'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr910.c.obj: in function `avr910_setup':
C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:60: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr910.c.obj: in function `avr910_parseextparms':
C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:336: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:320: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:330: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:324: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr910.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:83: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr910.c.obj:avr910.c:(.rdata$.refptr.ovsigck[.refptr.ovsigck]+0x0): undefined reference to `ovsigck'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avrcache.c.obj: in function `cacheAddress':
C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:214: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:219: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avrcache.c.obj: in function `loadCachePage':
C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:237: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:236: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avrcache.c.obj: in function `writeCachePage':
C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:301: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avrcache.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:284: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/config.c.obj:config.c:(.rdata$.refptr.uP_table[.refptr.uP_table]+0x0): undefined reference to `uP_table'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/dfu.c.obj: in function `get_usb_string':
C:/work/avr/avrdude_test/avrdude_main/src/dfu.c:431: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/dfu.c:438: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/dfu.c.obj: in function `dfu_open':
C:/work/avr/avrdude_test/avrdude_main/src/dfu.c:113: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/dfu.c:137: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/dfu.c:120: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/dfu.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/dfu.c:210: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/ft245r.c.obj:ft245r.c:(.rdata$.refptr.progbuf[.refptr.progbuf]+0x0): undefined reference to `progbuf'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj: in function `jtagmkI_resync':
C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:247: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:255: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:283: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:292: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:258: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:259: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/urclock.c.obj:urclock.c:(.rdata$.refptr.partdesc[.refptr.partdesc]+0x0): undefined reference to `partdesc'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/usbasp.c.obj: in function `usbasp_parseextparms':
C:/work/avr/avrdude_test/avrdude_main/src/usbasp.c:291: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/usbasp.c:286: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/usbasp.c.obj: in function `usbasp_setup':
C:/work/avr/avrdude_test/avrdude_main/src/usbasp.c:266: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/usbasp.c.obj: in function `usbasp_tpi_write_byte':
C:/work/avr/avrdude_test/avrdude_main/src/usbasp.c:1247: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/usbasp.c.obj: in function `usbasp_transmit':
C:/work/avr/avrdude_test/avrdude_main/src/usbasp.c:376: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/usbasp.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/usbasp.c:378: more undefined references to `avrdude_message2' follow
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

@mcuee
Copy link
Collaborator

mcuee commented Jan 14, 2023

Under Linux, there is no issues build the static link and dynamic link libraries.

The default build.sh will build static link libarvdude.a.

mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ sudo cmake --build build_linux --target install
[sudo] password for mcuee: 
[ 89%] Built target libavrdude
[ 98%] Built target avrdude
[100%] Built target conf
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/local/bin/avrdude
-- Set runtime path of "/usr/local/bin/avrdude" to ""
-- Installing: /usr/local/lib/libavrdude.a
-- Up-to-date: /usr/local/include/libavrdude.h
-- Installing: /usr/local/etc/avrdude.conf
-- Up-to-date: /usr/local/share/man/man1/avrdude.1

But it is also easy to build shared library libavrdude.so.

mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ cat build_shared.sh 
#!/bin/sh
#
# Build script for Unix-like systems, using the CMake subsystem

cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D DEBUG_CMAKE=1 -D USE_STATIC_LIBS=OFF -DBUILD_SHARED_LIBS=ON -D CMAKE_VERBOSE_MAKEFILE=ON  -B build_shared -D CMAKE_EXE_LINKER_FLAGS="-pthread -ludev -lz" 

cmake --build build_shared

mcuee@UbuntuSwift3:~/build/avr/avrdude_main$ sudo cmake --build build_shared --target install
/usr/bin/cmake -S/home/mcuee/build/avr/avrdude_main -B/home/mcuee/build/avr/avrdude_main/build_shared --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_shared/CMakeFiles /home/mcuee/build/avr/avrdude_main/build_shared/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_shared'
/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_shared'
cd /home/mcuee/build/avr/avrdude_main/build_shared && /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_shared /home/mcuee/build/avr/avrdude_main/build_shared/src /home/mcuee/build/avr/avrdude_main/build_shared/src/CMakeFiles/libavrdude.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_shared'
/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_shared'
make[2]: Nothing to be done for 'src/CMakeFiles/libavrdude.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_shared'
[ 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_shared'
cd /home/mcuee/build/avr/avrdude_main/build_shared && /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_shared /home/mcuee/build/avr/avrdude_main/build_shared/src /home/mcuee/build/avr/avrdude_main/build_shared/src/CMakeFiles/avrdude.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_shared'
/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_shared'
make[2]: Nothing to be done for 'src/CMakeFiles/avrdude.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_shared'
[ 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_shared'
cd /home/mcuee/build/avr/avrdude_main/build_shared && /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_shared /home/mcuee/build/avr/avrdude_main/build_shared/src /home/mcuee/build/avr/avrdude_main/build_shared/src/CMakeFiles/conf.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_shared'
/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_shared'
make[2]: Nothing to be done for 'src/CMakeFiles/conf.dir/build'.
make[2]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_shared'
[100%] Built target conf
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_shared'
/usr/bin/cmake -E cmake_progress_start /home/mcuee/build/avr/avrdude_main/build_shared/CMakeFiles 0
/usr/bin/make -f CMakeFiles/Makefile2 preinstall
make[1]: Entering directory '/home/mcuee/build/avr/avrdude_main/build_shared'
make[1]: Nothing to be done for 'preinstall'.
make[1]: Leaving directory '/home/mcuee/build/avr/avrdude_main/build_shared'
Install the project...
/usr/bin/cmake -P cmake_install.cmake
-- Install configuration: "RelWithDebInfo"
-- Up-to-date: /usr/local/bin/avrdude
-- Up-to-date: /usr/local/lib/libavrdude.so.1.0.0
-- Up-to-date: /usr/local/lib/libavrdude.so.1
-- Up-to-date: /usr/local/lib/libavrdude.so
-- Up-to-date: /usr/local/include/libavrdude.h
-- Up-to-date: /usr/local/etc/avrdude.conf
-- Up-to-date: /usr/local/share/man/man1/avrdude.1

@mcuee mcuee changed the title Unable to build both static and shared libraries with the new CMake buildsystem Unable to build both static and shared libavrdude library with CMake buildsystem Jan 15, 2023
@mcuee mcuee added the help wanted Extra attention is needed label Jun 5, 2023
@mcuee
Copy link
Collaborator

mcuee commented Jun 20, 2023

Just want to mention this issue is still there.

[68/70] cmd.exe /C "cd . && C:\msys64\mingw64\bin\cc.exe -O2 -g -DNDEBUG  -Wl,-undefined,dynamic_lookup -shared -o src\libavrdude.dll -Wl,--out-implib,src\liblibavrdude.dll.a -Wl,--major-image-version,1,--minor-image-version,0 src/CMakeFiles/libavrdude.dir/arduino.c.obj src/CMakeFiles/libavrdude.dir/avr.c.obj src/CMakeFiles/libavrdude.dir/avr910.c.obj src/CMakeFiles/libavrdude.dir/avrcache.c.obj src/CMakeFiles/libavrdude.dir/avrftdi.c.obj src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.obj src/CMakeFiles/libavrdude.dir/avrintel.c.obj src/CMakeFiles/libavrdude.dir/avrpart.c.obj src/CMakeFiles/libavrdude.dir/bitbang.c.obj src/CMakeFiles/libavrdude.dir/buspirate.c.obj src/CMakeFiles/libavrdude.dir/butterfly.c.obj src/CMakeFiles/libavrdude.dir/ch341a.c.obj src/CMakeFiles/libavrdude.dir/config.c.obj src/CMakeFiles/libavrdude.dir/confwin.c.obj src/CMakeFiles/libavrdude.dir/crc16.c.obj src/CMakeFiles/libavrdude.dir/dfu.c.obj src/CMakeFiles/libavrdude.dir/dryrun.c.obj src/CMakeFiles/libavrdude.dir/fileio.c.obj src/CMakeFiles/libavrdude.dir/flip1.c.obj src/CMakeFiles/libavrdude.dir/flip2.c.obj src/CMakeFiles/libavrdude.dir/ft245r.c.obj src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj src/CMakeFiles/libavrdude.dir/jtagmkII.c.obj src/CMakeFiles/libavrdude.dir/jtag3.c.obj src/CMakeFiles/libavrdude.dir/linuxgpio.c.obj src/CMakeFiles/libavrdude.dir/linuxspi.c.obj src/CMakeFiles/libavrdude.dir/lists.c.obj src/CMakeFiles/libavrdude.dir/micronucleus.c.obj src/CMakeFiles/libavrdude.dir/par.c.obj src/CMakeFiles/libavrdude.dir/pgm.c.obj src/CMakeFiles/libavrdude.dir/pgm_type.c.obj src/CMakeFiles/libavrdude.dir/pickit2.c.obj src/CMakeFiles/libavrdude.dir/pindefs.c.obj src/CMakeFiles/libavrdude.dir/ppi.c.obj src/CMakeFiles/libavrdude.dir/ppiwin.c.obj src/CMakeFiles/libavrdude.dir/serbb_posix.c.obj src/CMakeFiles/libavrdude.dir/serbb_win32.c.obj src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.obj src/CMakeFiles/libavrdude.dir/ser_posix.c.obj src/CMakeFiles/libavrdude.dir/ser_win32.c.obj src/CMakeFiles/libavrdude.dir/serialupdi.c.obj src/CMakeFiles/libavrdude.dir/stk500.c.obj src/CMakeFiles/libavrdude.dir/stk500v2.c.obj src/CMakeFiles/libavrdude.dir/stk500generic.c.obj src/CMakeFiles/libavrdude.dir/strutil.c.obj src/CMakeFiles/libavrdude.dir/teensy.c.obj src/CMakeFiles/libavrdude.dir/term.c.obj src/CMakeFiles/libavrdude.dir/updi_link.c.obj src/CMakeFiles/libavrdude.dir/updi_nvm.c.obj src/CMakeFiles/libavrdude.dir/updi_readwrite.c.obj src/CMakeFiles/libavrdude.dir/updi_state.c.obj src/CMakeFiles/libavrdude.dir/urclock.c.obj src/CMakeFiles/libavrdude.dir/usbasp.c.obj src/CMakeFiles/libavrdude.dir/usb_hidapi.c.obj src/CMakeFiles/libavrdude.dir/usb_libusb.c.obj src/CMakeFiles/libavrdude.dir/usbtiny.c.obj src/CMakeFiles/libavrdude.dir/update.c.obj src/CMakeFiles/libavrdude.dir/wiring.c.obj src/CMakeFiles/libavrdude.dir/xbee.c.obj src/CMakeFiles/libavrdude.dir/__/lexer.c.obj src/CMakeFiles/libavrdude.dir/__/config_gram.c.obj  -lm  C:/msys64/mingw64/lib/libelf.a  C:/msys64/mingw64/lib/libusb.dll.a  C:/msys64/mingw64/lib/libusb-1.0.dll.a  C:/msys64/mingw64/lib/libhidapi.dll.a  C:/msys64/mingw64/lib/libftdi1.dll.a  C:/msys64/mingw64/lib/libreadline.dll.a  C:/msys64/mingw64/lib/libncurses.a  -lsetupapi  -lhid  -lws2_32  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
FAILED: src/libavrdude.dll src/liblibavrdude.dll.a
cmd.exe /C "cd . && C:\msys64\mingw64\bin\cc.exe -O2 -g -DNDEBUG  -Wl,-undefined,dynamic_lookup -shared -o src\libavrdude.dll -Wl,--out-implib,src\liblibavrdude.dll.a -Wl,--major-image-version,1,--minor-image-version,0 src/CMakeFiles/libavrdude.dir/arduino.c.obj src/CMakeFiles/libavrdude.dir/avr.c.obj src/CMakeFiles/libavrdude.dir/avr910.c.obj src/CMakeFiles/libavrdude.dir/avrcache.c.obj src/CMakeFiles/libavrdude.dir/avrftdi.c.obj src/CMakeFiles/libavrdude.dir/avrftdi_tpi.c.obj src/CMakeFiles/libavrdude.dir/avrintel.c.obj src/CMakeFiles/libavrdude.dir/avrpart.c.obj src/CMakeFiles/libavrdude.dir/bitbang.c.obj src/CMakeFiles/libavrdude.dir/buspirate.c.obj src/CMakeFiles/libavrdude.dir/butterfly.c.obj src/CMakeFiles/libavrdude.dir/ch341a.c.obj src/CMakeFiles/libavrdude.dir/config.c.obj src/CMakeFiles/libavrdude.dir/confwin.c.obj src/CMakeFiles/libavrdude.dir/crc16.c.obj src/CMakeFiles/libavrdude.dir/dfu.c.obj src/CMakeFiles/libavrdude.dir/dryrun.c.obj src/CMakeFiles/libavrdude.dir/fileio.c.obj src/CMakeFiles/libavrdude.dir/flip1.c.obj src/CMakeFiles/libavrdude.dir/flip2.c.obj src/CMakeFiles/libavrdude.dir/ft245r.c.obj src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj src/CMakeFiles/libavrdude.dir/jtagmkII.c.obj src/CMakeFiles/libavrdude.dir/jtag3.c.obj src/CMakeFiles/libavrdude.dir/linuxgpio.c.obj src/CMakeFiles/libavrdude.dir/linuxspi.c.obj src/CMakeFiles/libavrdude.dir/lists.c.obj src/CMakeFiles/libavrdude.dir/micronucleus.c.obj src/CMakeFiles/libavrdude.dir/par.c.obj src/CMakeFiles/libavrdude.dir/pgm.c.obj src/CMakeFiles/libavrdude.dir/pgm_type.c.obj src/CMakeFiles/libavrdude.dir/pickit2.c.obj src/CMakeFiles/libavrdude.dir/pindefs.c.obj src/CMakeFiles/libavrdude.dir/ppi.c.obj src/CMakeFiles/libavrdude.dir/ppiwin.c.obj src/CMakeFiles/libavrdude.dir/serbb_posix.c.obj src/CMakeFiles/libavrdude.dir/serbb_win32.c.obj src/CMakeFiles/libavrdude.dir/ser_avrdoper.c.obj src/CMakeFiles/libavrdude.dir/ser_posix.c.obj src/CMakeFiles/libavrdude.dir/ser_win32.c.obj src/CMakeFiles/libavrdude.dir/serialupdi.c.obj src/CMakeFiles/libavrdude.dir/stk500.c.obj src/CMakeFiles/libavrdude.dir/stk500v2.c.obj src/CMakeFiles/libavrdude.dir/stk500generic.c.obj src/CMakeFiles/libavrdude.dir/strutil.c.obj src/CMakeFiles/libavrdude.dir/teensy.c.obj src/CMakeFiles/libavrdude.dir/term.c.obj src/CMakeFiles/libavrdude.dir/updi_link.c.obj src/CMakeFiles/libavrdude.dir/updi_nvm.c.obj src/CMakeFiles/libavrdude.dir/updi_readwrite.c.obj src/CMakeFiles/libavrdude.dir/updi_state.c.obj src/CMakeFiles/libavrdude.dir/urclock.c.obj src/CMakeFiles/libavrdude.dir/usbasp.c.obj src/CMakeFiles/libavrdude.dir/usb_hidapi.c.obj src/CMakeFiles/libavrdude.dir/usb_libusb.c.obj src/CMakeFiles/libavrdude.dir/usbtiny.c.obj src/CMakeFiles/libavrdude.dir/update.c.obj src/CMakeFiles/libavrdude.dir/wiring.c.obj src/CMakeFiles/libavrdude.dir/xbee.c.obj src/CMakeFiles/libavrdude.dir/__/lexer.c.obj src/CMakeFiles/libavrdude.dir/__/config_gram.c.obj  -lm  C:/msys64/mingw64/lib/libelf.a  C:/msys64/mingw64/lib/libusb.dll.a  C:/msys64/mingw64/lib/libusb-1.0.dll.a  C:/msys64/mingw64/lib/libhidapi.dll.a  C:/msys64/mingw64/lib/libftdi1.dll.a  C:/msys64/mingw64/lib/libreadline.dll.a  C:/msys64/mingw64/lib/libncurses.a  -lsetupapi  -lhid  -lws2_32  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/arduino.c.obj: in function `arduino_read_sig_bytes':
C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:67: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:68: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:62: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:63: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:47: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/arduino.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/arduino.c:59: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr.c.obj:avr.c:(.rdata$.refptr.quell_progress[.refptr.quell_progress]+0x0): undefined reference to `quell_progress'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr.c.obj:avr.c:(.rdata$.refptr.progname[.refptr.progname]+0x0): undefined reference to `progname'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr.c.obj:avr.c:(.rdata$.refptr.verbose[.refptr.verbose]+0x0): undefined reference to `verbose'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr910.c.obj: in function `avr910_setup':
C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:60: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr910.c.obj: in function `avr910_parseextparms':
C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:320: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:344: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:330: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:324: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr910.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/avr910.c:337: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avr910.c.obj:avr910.c:(.rdata$.refptr.ovsigck[.refptr.ovsigck]+0x0): undefined reference to `ovsigck'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avrcache.c.obj: in function `cacheAddress':
C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:221: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:226: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avrcache.c.obj: in function `loadCachePage':
C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:244: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:243: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avrcache.c.obj: in function `writeCachePage':
C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:309: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/avrcache.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/avrcache.c:292: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/dryrun.c.obj:dryrun.c:(.rdata$.refptr.partdesc[.refptr.partdesc]+0x0): undefined reference to `partdesc'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/fileio.c.obj: in function `fileio_fmt_autodetect_fp':
C:/work/avr/avrdude_test/avrdude_main/src/fileio.c:1412: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/fileio.c.obj: in function `fileio_fmt_autodetect':
C:/work/avr/avrdude_test/avrdude_main/src/fileio.c:1422: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/fileio.c.obj: in function `segment_normalise':
C:/work/avr/avrdude_test/avrdude_main/src/fileio.c:1469: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/fileio.c:1460: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/fileio.c.obj: in function `fileio_setparms':
C:/work/avr/avrdude_test/avrdude_main/src/fileio.c:1309: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/fileio.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/fileio.c:1233: more undefined references to `avrdude_message2' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/ft245r.c.obj:ft245r.c:(.rdata$.refptr.progbuf[.refptr.progbuf]+0x0): undefined reference to `progbuf'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj: in function `jtagmkI_resync':
C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:247: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:255: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:283: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:292: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:258: undefined reference to `avrdude_message2'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/CMakeFiles/libavrdude.dir/jtagmkI.c.obj:C:/work/avr/avrdude_test/avrdude_main/src/jtagmkI.c:259: more undefined references to `avrdude_message2' follow
collect2.exe: error: ld returned 1 exit status
[69/70] C:\msys64\mingw64\bin\cc.exe -DCONFIG_DIR="\"C:/Program Files (x86)/avrdude/etc\"" -IC:/work/avr/avrdude_test/avrdude_main/build_shared/src -IC:/work/avr/avrdude_test/avrdude_main -IC:/work/avr/avrdude_test/avrdude_main/build_shared -IC:/msys64/mingw64/include/libusb-compat -IC:/work/avr/avrdude_test/avrdude_main/src -O2 -g -DNDEBUG -std=gnu11 -Wall -Wextra -Wno-unused-parameter -MD -MT src/CMakeFiles/avrdude.dir/developer_opts.c.obj -MF src\CMakeFiles\avrdude.dir\developer_opts.c.obj.d -o src/CMakeFiles/avrdude.dir/developer_opts.c.obj -c C:/work/avr/avrdude_test/avrdude_main/src/developer_opts.c
ninja: build stopped: subcommand failed.

@mcuee mcuee changed the title Unable to build both static and shared libavrdude library with CMake buildsystem Unable to build libavrdude dynamic library with CMake buildsystem under Windows Jun 21, 2023
@mcuee mcuee removed the enhancement New feature or request label Jun 21, 2023
@mcuee mcuee added the bug Something isn't working label Jun 21, 2023
@mcuee
Copy link
Collaborator

mcuee commented Jun 21, 2023

It seems to me that most CMake based project will require seperate build for static and dynamic library. So the original request can be closed as not planned.

@mcuee mcuee changed the title Unable to build libavrdude dynamic library with CMake buildsystem under Windows Unable to build libavrdude dynamic and static library with CMake buildsystem Jun 21, 2023
@mcuee mcuee added enhancement New feature or request and removed bug Something isn't working help wanted Extra attention is needed labels Jun 21, 2023
@mcuee
Copy link
Collaborator

mcuee commented Jun 21, 2023

But the Windows dynamic library build is a bug to me. So I will create a new issue for that.

@mcuee mcuee closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2023
@ndim
Copy link
Contributor

ndim commented Aug 11, 2024

Regarding _avrdude_message2 and the Windows linking problems, see also #1874 (comment) and some of the follow-on comments.

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

Successfully merging a pull request may close this issue.

5 participants