Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-35074

Try to load udev at runtime if we do not link against it

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P1: Critical
    • 5.2.1
    • None
    • Serial Port
    • None
    • d97a152bf14cd7b58e576bd6b4a5f304527f940e

    Description

      Initial patch attached [1], but since a non-udev build with Qt 4 crashes, it causes a regression for those cases, so that crash has to be fixed first.

      Once that is done, this patch can be applied.

      Program received signal SIGSEGV, Segmentation fault.
      0x00007ffff7ddc138 in udev_list_entry_get_name () from /usr/lib/libQtSerialPort.so.1
      (gdb) bt
      #0 0x00007ffff7ddc138 in udev_list_entry_get_name () from /usr/lib/libQtSerialPort.so.1
      #1 0x00007ffff392f4c0 in ?? () from /usr/lib/libudev.so.1
      #2 0x00007ffff392fc89 in ?? () from /usr/lib/libudev.so.1
      #3 0x00007ffff39304f0 in udev_enumerate_scan_devices () from /usr/lib/libudev.so.1
      #4 0x00007ffff7bcec74 in availablePortsByUdev () at qserialportinfo_unix.cpp:229
      #5 0x00007ffff7bcf55d in QSerialPortInfo::availablePorts () at qserialportinfo_unix.cpp:323
      #6 0x0000000000401f3e in main (argc=1, argv=0x7fffffffe798) at main.cpp:52
      (gdb)

      I compared the symbols with Qt 4 and Qt 5 and they have the same offset values. It is getting peculiar...

      I also tried the following change to explicitly resemble the Qt 5 operation, but did not help:

      diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
      index 1187165..229efb5 100644
      --- a/src/serialport/qtudev_p.h
      +++ b/src/serialport/qtudev_p.h
      @@ -96,10 +96,13 @@ inline QFunctionPointer resolveSymbol(const char *symbolName)
       {
           QFunctionPointer symbolFunctionPointer = udevLibrary.resolve(symbolName);
       #else
      -inline void *resolveSymbol(const char *symbolName)
      +typedef void (*QFunctionPointer)();
      +inline QFunctionPointer resolveSymbol(const char *symbolName)
       {
      -    void *symbolFunctionPointer = udevLibrary.resolve(symbolName);
      +    QFunctionPointer symbolFunctionPointer = QFunctionPointer(udevLibrary.resolve(symbolName));
       #endif
      +    printf("Symbol name: %s\n", symbolName);
      +    printf("Symbol address: %p\n", symbolFunctionPointer);
           if (!symbolFunctionPointer)
               qWarning("Failed to resolve the udev symbol: %s", symbolName);
      
      

      [1] https://codereview.qt-project.org/#change,72143

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lpapp Laszlo Papp
            lpapp Laszlo Papp
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes