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

CMake wrongly detect libftfi+libftdi1 under macOS but actually only libftdi1 is installed -- invalid #963

Closed
mcuee opened this issue May 14, 2022 · 4 comments
Labels
invalid This doesn't seem right

Comments

@mcuee
Copy link
Collaborator

mcuee commented May 14, 2022

This is a monor issue but you will see things like the following under Linux and macOS where there is only libftdi1 installed. It does not really cause any issue though.

-- DO HAVE    libhidapi
-- DO HAVE    libftdi (but prefer to use libftdi1)

CMake debug log for macOS (Mac Mini M1).


mcuee@mcuees-Mac-mini build1 % cmake -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/Cellar -D CMAKE_BUILD_TYPE=RelWithDebInf -DCMAKE_VERBOSE_MAKEFILE="ON" -DDEBUG_CMAKE="ON" ..
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- 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
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /opt/homebrew/bin/git (found version "2.36.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 - found
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Darwin-21.4.0
-- CMAKE_SYSTEM: Darwin-21.4.0
-- CMAKE_FIND_ROOT_PATH: 
-- CMAKE_C_COMPILER: /Library/Developer/CommandLineTools/usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.0-20220508 (4601bee)
-- USE_EXTERNAL: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /opt/homebrew/lib/libelf.a
-- HAVE_LIBUSB: /opt/homebrew/lib/libusb.dylib
-- HAVE_LIBUSB_1_0: /opt/homebrew/lib/libusb-1.0.dylib
-- 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.dylib
-- HAVE_LIBFTDI1: /opt/homebrew/lib/libftdi1.dylib
-- HAVE_LIBREADLINE: /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libreadline.tbd
-- 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/build1
@mcuee
Copy link
Collaborator Author

mcuee commented May 15, 2022

Not so sure if pkg-config is the right tool to help out or not.
Ref: #925 (comment)

@mcuee
Copy link
Collaborator Author

mcuee commented May 16, 2022

BTW, there is no issues under MSYS2 mingw.

Detailed CMake debug log:

/c/work/avr/avrdude_test/avrdude-7.0_cmake/avrdude-7.0/build_mingw64
$ cmake -G"MSYS Makefiles" -D CMAKE_BUILD_TYPE=RelWithDebInf -DCMAKE_VERBOSE_MAKEFILE="ON" -DDEBUG_CMAKE="ON" ..
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: C:/msys64/usr/bin/git.exe (found version "2.36.1")
-- 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.22000
-- CMAKE_SYSTEM: Windows-10.0.22000
-- CMAKE_FIND_ROOT_PATH:
-- CMAKE_C_COMPILER: C:/msys64/mingw64/bin/gcc.exe
-- CONFIG_DIR: C:/Program Files (x86)/avrdude/etc
-- AVRDUDE_FULL_VERSION: 7.0
-- 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.dll.a
-- 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-7.0_cmake/avrdude-7.0/build_mingw64

@mcuee
Copy link
Collaborator Author

mcuee commented May 16, 2022

Hmm, I check again under Ubuntu 20.04, it seems to be okay.

mcuee@UbuntuSwift3:~/build/avr/avrdude/build_ubuntu$ cmake -D CMAKE_BUILD_TYPE=RelWithDebInf -D CMAKE_VERBOSE_MAKEFILE="ON" -D DEBUG_CMAKE="ON" ..
-- The C compiler identification is GNU 9.4.0
-- The CXX 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
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX 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.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.0-20220508 (4601bee)
-- USE_EXTERNAL: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /usr/lib/x86_64-linux-gnu/libelf.so
-- HAVE_LIBUSB: /usr/local/lib/libusb.so
-- HAVE_LIBUSB_1_0: /usr/local/lib/libusb-1.0.so
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHID: HAVE_LIBHID-NOTFOUND
-- HAVE_LIBHIDAPI: /usr/local/lib/libhidapi-libusb.so
-- HAVE_LIBFTDI: HAVE_LIBFTDI-NOTFOUND
-- HAVE_LIBFTDI1: /usr/local/lib/libftdi1.so
-- HAVE_LIBREADLINE: HAVE_LIBREADLINE-NOTFOUND
-- 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
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mcuee/build/avr/avrdude/build_ubuntu

@mcuee mcuee changed the title CMake wrongly detect libftfi+libftdi1 under Linux/macOS but actually only libftdi1 is installed CMake wrongly detect libftfi+libftdi1 under macOS but actually only libftdi1 is installed May 16, 2022
@mcuee
Copy link
Collaborator Author

mcuee commented May 16, 2022

This is invalid. I checked my macOS and it indeed has both libftdi and libftdi1 installed. Sorry for the noise.

mcuee@mcuees-Mac-mini build1 % pkg-config --libs libftdi
-L/opt/homebrew/Cellar/libftdi0/0.20/lib -lftdi -lusb
mcuee@mcuees-Mac-mini build1 % pkg-config --libs libftdi1
-L/opt/homebrew/Cellar/libftdi/1.5_2/lib -L/opt/homebrew/Cellar/libusb/HEAD-ba69847/lib -lftdi1 -lusb-1.0

I have never installed libftdi but appraently homebrew uses libftdi0 as the dependancy which caused my confusion.

mcuee@mcuees-Mac-mini build1 % brew remove libftdi0
Error: Refusing to uninstall /opt/homebrew/Cellar/libftdi0/0.20
because it is required by avrdude, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies libftdi0

mcuee@mcuees-Mac-mini build1 % brew uninstall avrdude
Uninstalling /opt/homebrew/Cellar/avrdude/7.0... (9 files, 2.4MB)
mcuee@mcuees-Mac-mini build1 % brew uninstall libftdi0
Uninstalling /opt/homebrew/Cellar/libftdi0/0.20... (23 files, 582.3KB)


mcuee@mcuees-Mac-mini build % cmake -D CMAKE_C_FLAGS=-I/opt/homebrew/include -D CMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/Cellar -D CMAKE_BUILD_TYPE=RelWithDebInf -DCMAKE_VERBOSE_MAKEFILE="ON" -DDEBUG_CMAKE="ON" ..
-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- 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
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /opt/homebrew/bin/git (found version "2.36.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 - found
-- Configuration summary:
-- ----------------------
-- CMAKE_HOST_SYSTEM: Darwin-21.4.0
-- CMAKE_SYSTEM: Darwin-21.4.0
-- CMAKE_FIND_ROOT_PATH: 
-- CMAKE_C_COMPILER: /Library/Developer/CommandLineTools/usr/bin/cc
-- CONFIG_DIR: /usr/local/etc
-- AVRDUDE_FULL_VERSION: 7.0
-- USE_EXTERNAL: OFF
-- USE_LIBUSBWIN32: OFF
-- HAVE_LIBELF: /opt/homebrew/lib/libelf.a
-- HAVE_LIBUSB: /opt/homebrew/lib/libusb.dylib
-- HAVE_LIBUSB_1_0: /opt/homebrew/lib/libusb-1.0.dylib
-- HAVE_LIBUSB_WIN32: HAVE_LIBUSB_WIN32-NOTFOUND
-- HAVE_LIBHID: /opt/homebrew/lib/libhid.dylib
-- HAVE_LIBHIDAPI: /opt/homebrew/lib/libhidapi.dylib
-- HAVE_LIBFTDI: HAVE_LIBFTDI-NOTFOUND
-- HAVE_LIBFTDI1: /opt/homebrew/lib/libftdi1.dylib
-- HAVE_LIBREADLINE: /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libreadline.tbd
-- 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
-- DISABLED   doc
-- DISABLED   parport
-- DISABLED   linuxgpio
-- DISABLED   linuxspi
-- ----------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mcuee/build/avr/cmake7build/avrdude-7.0/build

@mcuee mcuee closed this as completed May 16, 2022
@mcuee mcuee changed the title CMake wrongly detect libftfi+libftdi1 under macOS but actually only libftdi1 is installed CMake wrongly detect libftfi+libftdi1 under macOS but actually only libftdi1 is installed -- invalid May 16, 2022
@mcuee mcuee added the invalid This doesn't seem right label Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant