Menu

#286 Deprecated warnings with libftdi 1.5

0.10.0
new
nobody
None
http://openocd.zylin.com/5891
libftdi1
high
change request
2023-08-22
2020-10-27
MrLavender
No

The build fails with libftdi 1.5 because of deprecated warnings and -Werror. I'm sorry I don't have time to investigate further, I just worked around it using CFLAGS="-g -O2 -Wno-deprecated" with configure.

src/jtag/drivers/presto.c:163:6: error: 'ftdi_usb_purge_buffers' is deprecated
      [-Werror,-Wdeprecated-declarations]
        if (ftdi_usb_purge_buffers(&presto->ftdic) < 0) {
            ^
/usr/local/Cellar/libftdi/1.5/include/libftdi1/ftdi.h:566:9: note:
      'ftdi_usb_purge_buffers' has been explicitly marked deprecated here
    int DEPRECATED(ftdi_usb_purge_buffers(struct ftdi_context *ftdi));
        ^
/usr/local/Cellar/libftdi/1.5/include/libftdi1/ftdi.h:247:42: note: expanded
      from macro 'DEPRECATED'
#define DEPRECATED(func) __attribute__ ((deprecated)) func
                                         ^
src/jtag/drivers/presto.c:177:7: error: 'ftdi_usb_purge_buffers' is deprecated
      [-Werror,-Wdeprecated-declarations]
                if (ftdi_usb_purge_buffers(&presto->ftdic) < 0)
                    ^
/usr/local/Cellar/libftdi/1.5/include/libftdi1/ftdi.h:566:9: note:
      'ftdi_usb_purge_buffers' has been explicitly marked deprecated here
    int DEPRECATED(ftdi_usb_purge_buffers(struct ftdi_context *ftdi));
        ^
/usr/local/Cellar/libftdi/1.5/include/libftdi1/ftdi.h:247:42: note: expanded
      from macro 'DEPRECATED'
#define DEPRECATED(func) __attribute__ ((deprecated)) func
                                         ^
2 errors generated.

Discussion

  • Antonio Borneo

    Antonio Borneo - 2020-10-27
    • Component: --> libftdi1
    • Priority: --> high
    • Type: --> change request
     
    • Paul Fertser

      Paul Fertser - 2020-10-27

      On Tue, Oct 27, 2020 at 10:38:10PM -0000, Antonio Borneo wrote:

      At a first check, seams enough replacing ftdi_usb_purge_buffers() with
      ftdi_tcioflush().
      The prototype of the functions is exactly the same, so simply run
      sed -i s/ftdi_usb_purge_buffers/ftdi_usb_purge_buffers/ src/jtag/drivers/{openjtag.c,presto.c}

      I guess you meant

      sed -i s/ftdi_usb_purge_buffers/ftdi_tcioflush/ src/jtag/drivers/{openjtag.c,presto.c}

      The difficoult part now is to make 'configure' able to detect the current
      version of libftdi1 and force using one of the two API.

      Probably change the .c code to use ftdi_tcioflush and add an
      appropriate macro to replace it with the old function name when
      pkg-config reports an older libftdi is used.

       
      • Antonio Borneo

        Antonio Borneo - 2020-10-27

        Yes, that's what I meant. Thanks. Just a tiring day.
        It's exactly what I'm preparing. Now I'm testing with the new library (not available yet on arch)

         
  • Antonio Borneo

    Antonio Borneo - 2020-10-27

    libftdi1 have changed the API from 1.4 (2017-08-07) to 1.5 (2020-07-07)
    At a first check, seams enough replacing ftdi_usb_purge_buffers() with ftdi_tcioflush().
    The prototype of the functions is exactly the same, so simply run
    sed -i s/ftdi_usb_purge_buffers/ftdi_usb_purge_buffers/ src/jtag/drivers/{openjtag.c,presto.c}

    The difficoult part now is to make 'configure' able to detect the current version of libftdi1 and force using one of the two API.

    We are going to deliver OpenOCD v0.11.0 soon, and the we should stop merging new features in ~10 days. I would like to see this fixed in time for v0.11.0 to avoid creating an hard dependency with libftdi1 1.4.

     
  • Antonio Borneo

    Antonio Borneo - 2020-10-27

    libftdi1 1.5 allows to silent the deprecated messages by defining _FTDI_DISABLE_DEPRECATED

    Using:
    CFLAGS=-D_FTDI_DISABLE_DEPRECATED ./configure
    should work.
    This issue is not a blocking point, but has to be fixed.

     
  • Antonio Borneo

    Antonio Borneo - 2020-10-28
     
    • Tommy Murphy

      Tommy Murphy - 2023-08-22

      Doesn't this resolve it, the patch has been merged a long time ago, and consequently this ticket can be closed?

       
  • Jonathan Kimmitt

    On my system, I needed to use:

    sed -i -e s/ftdi_usb_purge_buffers/ftdi_tcioflush/ src/jtag/drivers/{openjtag.c,presto.c}

     

Log in to post a comment.

MongoDB Logo MongoDB