6502Decoder icon indicating copy to clipboard operation
6502Decoder copied to clipboard

Build failure for fx2pipe on LMDE

Open jscrane opened this issue 1 year ago • 3 comments

Hi, I'm getting a weird compiler error building this:

Making all in usb_io
make[2]: Entering directory '/home/steve/src/6502Decoder/fx2pipe/usb_io'
g++ -DHAVE_CONFIG_H -I. -I.. -I. -I.. -I..    -g -O2 -MT wwusb.o -MD -MP -MF .deps/wwusb.Tpo -c -o wwusb.o wwusb.cc
In file included from wwusb.h:25,
                 from wwusb.cc:22:
/usr/include/linux/usbdevice_fs.h:134:41: error: flexible array member ‘usbdevfs_urb::iso_frame_desc’ not at end of ‘struct WWUSBDevice::URB’
  134 |         struct usbdevfs_iso_packet_desc iso_frame_desc[];
      |                                         ^~~~~~~~~~~~~~
wwusb.h:119:29: note: next member ‘int WWUSBDevice::URB::cancelled’ declared here
  119 |                         int cancelled;
      |                             ^~~~~~~~~
wwusb.h:116:24: note: in the definition of ‘struct WWUSBDevice::URB’
  116 |                 struct URB : LinkedListBase<URB>, usbdevfs_urb
      |                        ^~~
make[2]: *** [Makefile:218: wwusb.o] Error 1
make[2]: Leaving directory '/home/steve/src/6502Decoder/fx2pipe/usb_io'

My system is:

$ uname -a
Linux steevo 6.1.0-20-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.85-1 (2024-04-11) x86_64 GNU/Linux

Thanks! Steve

jscrane avatar Apr 18 '24 15:04 jscrane

Can you check what version(s) of libusb you have installed

dpkg -i | grep libusb

If I remember correctly, fx2pipe needs libusb0,1 and won't compile/work against libusb1.0.

For reference, there was an eevblog thread about this: https://www.eevblog.com/forum/programming/updating-fx2pipe-to-work-with-libusb-1-0/

hoglet67 avatar Apr 18 '24 16:04 hoglet67

Might also be worth you trying cannelloni: https://github.com/jhol/cannelloni

hoglet67 avatar Apr 18 '24 16:04 hoglet67

$ dpkg -l | grep libusb
ii  libgusb2:amd64                             0.3.10-1                                     amd64        GLib wrapper around libusb1
ii  libusb-0.1-4:amd64                         2:0.1.12-32                                  amd64        userspace USB programming library
ii  libusb-1.0-0:amd64                         2:1.0.26-1                                   amd64        userspace USB programming library
ii  libusb-1.0-0-dev:amd64                     2:1.0.26-1                                   amd64        userspace USB programming library development files
ii  libusb-1.0-doc                             2:1.0.26-1                                   all          documentation for userspace USB programming
ii  libusb-dev                                 2:0.1.12-32                                  amd64        userspace USB programming library development files
ii  libusbmuxd6:amd64                          2.0.2-3                                      amd64        USB multiplexor daemon for iPhone and iPod Touch devices - library

I will have a look at cannelloni. Thanks!

jscrane avatar Apr 18 '24 17:04 jscrane

I finally got around to updating one of my systems to Ubuntu 24.04 and hit this same issue.

The cause is a change to the header file /usr/include/linux/usbdevice_fs.h from:

struct usbdevfs_urb {
...	struct usbdevfs_iso_packet_desc iso_frame_desc[0];
};

to

struct usbdevfs_urb {
...	struct usbdevfs_iso_packet_desc iso_frame_desc[];
};

I've committed a local copy of the old header file, which works around the error.

The root cause here is the usbdevfs_urb struct ends with a flexible array, then fx2pipe's wwusb.h extends this. I don't have the energy to unpick this properly at the moment, but I've tested the resultant fx2pipe on Ubuntu 24.04 and it seems to work.

hoglet67 avatar Feb 27 '25 17:02 hoglet67