libftdi Archives

Subject: macOS build problem due to latest patch

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Fabrice Fontaine <fontaine.fabrice@xxxxxxxxx>
Date: Sun, 26 Mar 2023 15:05:38 +0800
It seems to me the last patch has caused issues to build libftdi gt
under macOS.

Once I revert the patch, it works fine.

mcuee@mcuees-Mac-mini libftdi % cmake -B build
CMake Warning (dev) at CMakeLists.txt:2 (project):
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at CMakeLists.txt:15 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Build type: RelWithDebInfo
-- Checking for module 'libusb-1.0'
--   Found libusb-1.0, version 1.0.26
CMake Warning (dev) at
/opt/homebrew/Cellar/cmake/3.26.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:438
(message):
  The package name passed to `find_package_handle_standard_args` (LIBUSB)
  does not match the name of the calling package (USB1).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindUSB1.cmake:33 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:28 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found LIBUSB: usb-1.0
-- Detected git snapshot version: v1.5-14-g7c01e8c
-- Building ftdi_eeprom
-- Summary of build options:

  Build static libs: ON
  Build C++ bindings: OFF
  Build Python bindings: OFF
  Build ftdi_eeprom: ON
  Build examples: ON
  Build tests: OFF
  Build API documentation: OFF

-- Configuring done (0.2s)
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   ftdi1

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done (0.0s)
-- Build files have been written to: /Users/mcuee/build/libftdi/libftdi/build
mcuee@mcuees-Mac-mini libftdi % cmake --build build
[  3%] Building C object src/CMakeFiles/ftdi1.dir/ftdi.c.o
[  6%] Building C object src/CMakeFiles/ftdi1.dir/ftdi_stream.c.o
[  9%] Linking C shared library libftdi1.dylib
ld: library not found for -lusb-1.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [src/CMakeFiles/ftdi1.dir/build.make:113:
src/libftdi1.2.5.0.dylib] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:203: src/CMakeFiles/ftdi1.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

mcuee@mcuees-Mac-mini libftdi % git revert
b5b8fab6063ad90bb5ef05a72708ecde1796bc81 --no-edit
...

mcuee@mcuees-Mac-mini libftdi % cmake -B build
...

mcuee@mcuees-Mac-mini libftdi % cmake --build build
[  3%] Building C object src/CMakeFiles/ftdi1.dir/ftdi.c.o
[  6%] Building C object src/CMakeFiles/ftdi1.dir/ftdi_stream.c.o
[  9%] Linking C shared library libftdi1.dylib
[  9%] Built target ftdi1
[ 12%] Building C object src/CMakeFiles/ftdi1-static.dir/ftdi.c.o
[ 15%] Building C object src/CMakeFiles/ftdi1-static.dir/ftdi_stream.c.o
[ 18%] Linking C static library libftdi1.a
[ 18%] Built target ftdi1-static
[ 21%] Building C object ftdi_eeprom/CMakeFiles/ftdi_eeprom.dir/main.c.o
[ 25%] Linking C executable ftdi_eeprom
[ 25%] Built target ftdi_eeprom
[ 28%] Building C object examples/CMakeFiles/simple.dir/simple.c.o
[ 31%] Linking C executable simple
[ 31%] Built target simple
[ 34%] Building C object examples/CMakeFiles/bitbang.dir/bitbang.c.o
[ 37%] Linking C executable bitbang
[ 37%] Built target bitbang
[ 40%] Building C object examples/CMakeFiles/bitbang2.dir/bitbang2.c.o
[ 43%] Linking C executable bitbang2
[ 43%] Built target bitbang2
[ 46%] Building C object examples/CMakeFiles/bitbang_cbus.dir/bitbang_cbus.c.o
[ 50%] Linking C executable bitbang_cbus
[ 50%] Built target bitbang_cbus
[ 53%] Building C object
examples/CMakeFiles/bitbang_ft2232.dir/bitbang_ft2232.c.o
[ 56%] Linking C executable bitbang_ft2232
[ 56%] Built target bitbang_ft2232
[ 59%] Building C object examples/CMakeFiles/find_all.dir/find_all.c.o
[ 62%] Linking C executable find_all
[ 62%] Built target find_all
[ 65%] Building C object examples/CMakeFiles/serial_test.dir/serial_test.c.o
[ 68%] Linking C executable serial_test
[ 68%] Built target serial_test
[ 71%] Building C object examples/CMakeFiles/baud_test.dir/baud_test.c.o
[ 75%] Linking C executable baud_test
[ 75%] Built target baud_test
[ 78%] Building C object examples/CMakeFiles/stream_test.dir/stream_test.c.o
[ 81%] Linking C executable stream_test
[ 81%] Built target stream_test
[ 84%] Building C object examples/CMakeFiles/eeprom.dir/eeprom.c.o
[ 87%] Linking C executable eeprom
[ 87%] Built target eeprom
[ 90%] Building C object examples/CMakeFiles/async.dir/async.c.o
/Users/mcuee/build/libftdi/libftdi/examples/async.c:165:17: warning:
variable 'retval' is used uninitialized whenever 'if' condition is
true [-Wsometimes-uninitialized]
            if (res == 3) {
                ^~~~~~~~
/Users/mcuee/build/libftdi/libftdi/examples/async.c:178:12: note:
uninitialized use occurs here
    return retval;
           ^~~~~~
/Users/mcuee/build/libftdi/libftdi/examples/async.c:165:13: note:
remove the 'if' if its condition is always false
            if (res == 3) {
            ^~~~~~~~~~~~~~~
/Users/mcuee/build/libftdi/libftdi/examples/async.c:158:16: warning:
variable 'retval' is used uninitialized whenever 'while' loop exits
because its condition is false [-Wsometimes-uninitialized]
        while (i--) {
               ^~~
/Users/mcuee/build/libftdi/libftdi/examples/async.c:178:12: note:
uninitialized use occurs here
    return retval;
           ^~~~~~
/Users/mcuee/build/libftdi/libftdi/examples/async.c:158:16: note:
remove the condition if it is always true
        while (i--) {
               ^~~
               1
/Users/mcuee/build/libftdi/libftdi/examples/async.c:149:9: warning:
variable 'retval' is used uninitialized whenever 'if' condition is
true [-Wsometimes-uninitialized]
    if (do_read) {
        ^~~~~~~
/Users/mcuee/build/libftdi/libftdi/examples/async.c:178:12: note:
uninitialized use occurs here
    return retval;
           ^~~~~~
/Users/mcuee/build/libftdi/libftdi/examples/async.c:149:5: note:
remove the 'if' if its condition is always false
    if (do_read) {
    ^~~~~~~~~~~~~~
/Users/mcuee/build/libftdi/libftdi/examples/async.c:33:21: note:
initialize the variable 'retval' to silence this warning
    int i, f, retval;
                    ^
                     = 0
3 warnings generated.
[ 93%] Linking C executable async
[ 93%] Built target async
[ 96%] Building C object examples/CMakeFiles/purge_test.dir/purge_test.c.o
[100%] Linking C executable purge_test
[100%] Built target purge_test

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread