Skip to content

Build failure with Kernel >= 6.0: error: flexible array member ‘usbdevfs_urb::iso_frame_desc’ not at end of ‘struct usb_handle’ #74

@mdartmann

Description

@mdartmann

On Kernel 6.0-rc6 with gcc 12.1, building android-tools 33.0.3 fails with the following error:

/usr/lib/ccache/bin/g++ -DADB_HOST=1 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/home/mae/.cache/kiss/proc/121205/build/android-tools/build/vendor -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/base/libs/androidfw/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/boringssl/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/crypto/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/pairing_auth/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/pairing_connection/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/tls/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/core/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/core/libcrypto_utils/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/core/libcutils/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/libbase/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/libziparchive/include -I/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/native/include -march=x86-64-v3 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Wno-error=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -O3 -DNDEBUG -Wno-attributes -std=gnu++20 -MD -MT vendor/CMakeFiles/libadb.dir/adb/client/usb_linux.cpp.o -MF vendor/CMakeFiles/libadb.dir/adb/client/usb_linux.cpp.o.d -o vendor/CMakeFiles/libadb.dir/adb/client/usb_linux.cpp.o -c /home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp
In file included from /home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:28:
/usr/include/linux/usbdevice_fs.h:134:41: error: flexible array member ‘usbdevfs_urb::iso_frame_desc’ not at end of ‘struct usb_handle’
  134 |         struct usbdevfs_iso_packet_desc iso_frame_desc[];
      |                                         ^~~~~~~~~~~~~~
/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:76:18: note: next member ‘usbdevfs_urb usb_handle::urb_out’ declared here
   76 |     usbdevfs_urb urb_out;
      |                  ^~~~~~~
/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:61:8: note: in the definition of ‘struct usb_handle’
   61 | struct usb_handle {
      |        ^~~~~~~~~~

Build script:

cmake -B build -G Ninja \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_C_FLAGS="${CFLAGS}" \
    -D CMAKE_CXX_FLAGS="${CXXFLAGS}"

sed -i "s|-Werror|-Wno-error|g" build/build.ninja

ninja -C build
ninja -C build install

Flags:

export CFLAGS='-march=x86-64-v3 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection'
export CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
export LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions