Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Segmentation Error On QSqlDriver::AddDatabase
QtWS25 Last Chance

Segmentation Error On QSqlDriver::AddDatabase

Scheduled Pinned Locked Moved Solved 3rd Party Software
5 Posts 3 Posters 574 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MoekieBoekie
    wrote on last edited by MoekieBoekie
    #1

    Goodday,

    I get an segmenation fault when loading the QMysql-driver with the line:

    QSqlDatabase::addDatabase("QMYSQL" , "connection");
    

    (sidenote, QSqlDatabase::addDatabase("QSQLITE","connection"); work as expected without seg-fault)

    Now the next list of points should already be a trigger that I am doing something 'special' and weird. But I hope anyway that someone can help me :)

    Due to legacy software I had to build Qt5 under special conditions

    • I am building my env in a (docker) container
    • I am using the Qt5 source v5.15.2
    • I am building with OpenSSL 1.1.1v (linking against is explicitly)
      -- Also buid from sources
    • I am building mariadb, linked against openssl 1.1.1v as well.

    I am kicking of the configuration as follows:

    MYSQL_PREFIX='/usr' OPENSSL_LIBS='-L/usr/lib64 -lssl -lcrypto' ./configure -opensource -confirm-license -debug -v \
                   -prefix /usr \
                   -plugin-sql-mysql \
                   -sql-mysql \
                   -openssl-linked -no-securetransport -no-schannel \
                   -make libs \
                   -nomake tools \
                   -nomake examples \
                   -nomake tests \
                   -no-opengl \
                   -no-gui \
                   -skip qt3d \
                   -skip qtandroidextras \
                   -skip qtcanvas3d \
                   -skip qtcharts \
                   -skip qtconnectivity \
                   -skip qtdatavis3d \
                   -skip qtdeclarative \
                   -skip qtdoc \
                   -skip qtgamepad \
                   -skip qtgraphicaleffects \
                   -skip qtimageformats \
                   -skip qtlocation \
                   -skip qtmacextras \
                   -skip qtmultimedia \
                   -skip qtnetworkauth \
                   -skip qtpurchasing \
                   -skip qtquickcontrols \
                   -skip qtquickcontrols2 \
                   -skip qtscript \
                   -skip qtscxml \
                   -skip qtsensors \
                   -skip qtserialbus \
                   -skip qtserialport \
                   -skip qtspeech \
                   -skip qtsvg \
                   -skip qttools \
                   -skip qttranslations \
                   -skip qtvirtualkeyboard \
                   -skip qtwayland \
                   -skip qtwebchannel \
                   -skip qtwebengine \
                   -skip qtwebsockets \
                   -skip qtwebview \
                   -skip qtwinextras \
                   -skip qtx11extras \
                   -skip qtxmlpatterns \
                   -no-feature-texthtmlparser \
                   -no-feature-textodfwriter \
                   -no-feature-concurrent \
                   -no-feature-effects \
                   -no-feature-sharedmemory \
                   -no-feature-systemsemaphore \
                   -no-feature-im \
                   -no-feature-process \
                   -no-feature-dom \
                   -no-feature-filesystemmodel \
                   -no-feature-filesystemwatcher \
                   -no-feature-graphicsview \
                   -no-feature-graphicseffect \
                   -no-feature-sizegrip \
                   -no-feature-calendarwidget \
                   -no-feature-printpreviewwidget \
                   -no-feature-keysequenceedit \
                   -no-feature-colordialog \
                   -no-feature-filedialog \
                   -no-feature-fontdialog \
                   -no-feature-printpreviewdialog \
                   -no-feature-progressdialog \
                   -no-feature-inputdialog \
                   -no-feature-errormessage \
                   -no-feature-wizard \
                   -no-feature-datawidgetmapper \
                   -no-feature-imageformat_bmp \
                   -no-feature-imageformat_ppm \
                   -no-feature-imageformat_xbm \
                   -no-feature-imageformat_png \
                   -no-feature-imageformat_jpeg \
                   -no-feature-image_heuristic_mask \
                   -no-feature-image_text \
                   -no-feature-colornames \
                   -no-feature-cups \
                   -no-feature-translation \
                   -no-feature-codecs \
                   -no-feature-big_codecs \
                   -no-feature-iconv \
                   -no-feature-ftp \
                   -no-feature-udpsocket \
                   -no-feature-networkproxy \
                   -no-feature-socks5 \
                   -no-feature-networkdiskcache \
                   -no-feature-bearermanagement \
                   -no-feature-completer \
                   -no-feature-fscompleter \
                   -no-feature-desktopservices \
                   -no-feature-mimetype \
                   -no-feature-systemtrayicon \
                   -no-feature-undocommand \
                   -no-feature-undostack \
                   -no-feature-undogroup \
                   -no-feature-undoview \
                   -no-feature-statemachine \
                   -no-feature-gestures \
                   -no-feature-dbus
    

    The build succeeds and I am able to find all the drivers at runtime when I am setting the environment variable QT_PLUGIN_PATH

    The stack trace on the segmentation fault I get is as follows:

    __strcmp_avx2 0x00007ffff6ba8467
    lh_insert 0x00007ffff79d0489
    OBJ_NAME_add 0x00007ffff794f3bb
    ossl_init_ssl_base_ossl_ 0x00007ffff69d78e1
    __pthread_once_slow pthread_once.c:116
    CRYPTO_THREAD_run_once 0x00007ffff68ac999
    OPENSSL_init_ssl 0x00007ffff69d7aa3
    ma_tls_start openssl.c:221
    mysql_once_init mariadb_lib.c:4334
    mysql_once_init mariadb_lib.c:4289
    __pthread_once_slow pthread_once.c:116
    ___pthread_once pthread_once.c:143
    mysql_server_init mariadb_lib.c:4365
    qLibraryInit qsql_mysql.cpp:1100
    QMYSQLDriver::QMYSQLDriver qsql_mysql.cpp:1130
    QMYSQLDriverPlugin::create main.cpp:67
    qLoadPlugin<…> qfactoryloader_p.h:108
    QSqlDatabasePrivate::init qsqldatabase.cpp:699
    QSqlDatabase::QSqlDatabase qsqldatabase.cpp:635
    QSqlDatabase::addDatabase qsqldatabase.cpp:472
    main servicemain.cpp:192
    __libc_start_call_main libc_start_call_main.h:58
    __libc_start_main_impl libc-start.c:360
    _start 0x0000000000430211
    

    Does anyone see/ recognise something wrong ?

    Christian EhrlicherC 1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, just guessing but you're using Ubuntu 18.04.6 or Ubuntu 20.04.6 try upgrading to Ubuntu 22.04.3.

      M 1 Reply Last reply
      0
      • hskoglundH hskoglund

        Hi, just guessing but you're using Ubuntu 18.04.6 or Ubuntu 20.04.6 try upgrading to Ubuntu 22.04.3.

        M Offline
        M Offline
        MoekieBoekie
        wrote on last edited by
        #3

        @hskoglund
        Sorry, the docker base container is debian: stable-slim

        1 Reply Last reply
        0
        • M MoekieBoekie

          Goodday,

          I get an segmenation fault when loading the QMysql-driver with the line:

          QSqlDatabase::addDatabase("QMYSQL" , "connection");
          

          (sidenote, QSqlDatabase::addDatabase("QSQLITE","connection"); work as expected without seg-fault)

          Now the next list of points should already be a trigger that I am doing something 'special' and weird. But I hope anyway that someone can help me :)

          Due to legacy software I had to build Qt5 under special conditions

          • I am building my env in a (docker) container
          • I am using the Qt5 source v5.15.2
          • I am building with OpenSSL 1.1.1v (linking against is explicitly)
            -- Also buid from sources
          • I am building mariadb, linked against openssl 1.1.1v as well.

          I am kicking of the configuration as follows:

          MYSQL_PREFIX='/usr' OPENSSL_LIBS='-L/usr/lib64 -lssl -lcrypto' ./configure -opensource -confirm-license -debug -v \
                         -prefix /usr \
                         -plugin-sql-mysql \
                         -sql-mysql \
                         -openssl-linked -no-securetransport -no-schannel \
                         -make libs \
                         -nomake tools \
                         -nomake examples \
                         -nomake tests \
                         -no-opengl \
                         -no-gui \
                         -skip qt3d \
                         -skip qtandroidextras \
                         -skip qtcanvas3d \
                         -skip qtcharts \
                         -skip qtconnectivity \
                         -skip qtdatavis3d \
                         -skip qtdeclarative \
                         -skip qtdoc \
                         -skip qtgamepad \
                         -skip qtgraphicaleffects \
                         -skip qtimageformats \
                         -skip qtlocation \
                         -skip qtmacextras \
                         -skip qtmultimedia \
                         -skip qtnetworkauth \
                         -skip qtpurchasing \
                         -skip qtquickcontrols \
                         -skip qtquickcontrols2 \
                         -skip qtscript \
                         -skip qtscxml \
                         -skip qtsensors \
                         -skip qtserialbus \
                         -skip qtserialport \
                         -skip qtspeech \
                         -skip qtsvg \
                         -skip qttools \
                         -skip qttranslations \
                         -skip qtvirtualkeyboard \
                         -skip qtwayland \
                         -skip qtwebchannel \
                         -skip qtwebengine \
                         -skip qtwebsockets \
                         -skip qtwebview \
                         -skip qtwinextras \
                         -skip qtx11extras \
                         -skip qtxmlpatterns \
                         -no-feature-texthtmlparser \
                         -no-feature-textodfwriter \
                         -no-feature-concurrent \
                         -no-feature-effects \
                         -no-feature-sharedmemory \
                         -no-feature-systemsemaphore \
                         -no-feature-im \
                         -no-feature-process \
                         -no-feature-dom \
                         -no-feature-filesystemmodel \
                         -no-feature-filesystemwatcher \
                         -no-feature-graphicsview \
                         -no-feature-graphicseffect \
                         -no-feature-sizegrip \
                         -no-feature-calendarwidget \
                         -no-feature-printpreviewwidget \
                         -no-feature-keysequenceedit \
                         -no-feature-colordialog \
                         -no-feature-filedialog \
                         -no-feature-fontdialog \
                         -no-feature-printpreviewdialog \
                         -no-feature-progressdialog \
                         -no-feature-inputdialog \
                         -no-feature-errormessage \
                         -no-feature-wizard \
                         -no-feature-datawidgetmapper \
                         -no-feature-imageformat_bmp \
                         -no-feature-imageformat_ppm \
                         -no-feature-imageformat_xbm \
                         -no-feature-imageformat_png \
                         -no-feature-imageformat_jpeg \
                         -no-feature-image_heuristic_mask \
                         -no-feature-image_text \
                         -no-feature-colornames \
                         -no-feature-cups \
                         -no-feature-translation \
                         -no-feature-codecs \
                         -no-feature-big_codecs \
                         -no-feature-iconv \
                         -no-feature-ftp \
                         -no-feature-udpsocket \
                         -no-feature-networkproxy \
                         -no-feature-socks5 \
                         -no-feature-networkdiskcache \
                         -no-feature-bearermanagement \
                         -no-feature-completer \
                         -no-feature-fscompleter \
                         -no-feature-desktopservices \
                         -no-feature-mimetype \
                         -no-feature-systemtrayicon \
                         -no-feature-undocommand \
                         -no-feature-undostack \
                         -no-feature-undogroup \
                         -no-feature-undoview \
                         -no-feature-statemachine \
                         -no-feature-gestures \
                         -no-feature-dbus
          

          The build succeeds and I am able to find all the drivers at runtime when I am setting the environment variable QT_PLUGIN_PATH

          The stack trace on the segmentation fault I get is as follows:

          __strcmp_avx2 0x00007ffff6ba8467
          lh_insert 0x00007ffff79d0489
          OBJ_NAME_add 0x00007ffff794f3bb
          ossl_init_ssl_base_ossl_ 0x00007ffff69d78e1
          __pthread_once_slow pthread_once.c:116
          CRYPTO_THREAD_run_once 0x00007ffff68ac999
          OPENSSL_init_ssl 0x00007ffff69d7aa3
          ma_tls_start openssl.c:221
          mysql_once_init mariadb_lib.c:4334
          mysql_once_init mariadb_lib.c:4289
          __pthread_once_slow pthread_once.c:116
          ___pthread_once pthread_once.c:143
          mysql_server_init mariadb_lib.c:4365
          qLibraryInit qsql_mysql.cpp:1100
          QMYSQLDriver::QMYSQLDriver qsql_mysql.cpp:1130
          QMYSQLDriverPlugin::create main.cpp:67
          qLoadPlugin<…> qfactoryloader_p.h:108
          QSqlDatabasePrivate::init qsqldatabase.cpp:699
          QSqlDatabase::QSqlDatabase qsqldatabase.cpp:635
          QSqlDatabase::addDatabase qsqldatabase.cpp:472
          main servicemain.cpp:192
          __libc_start_call_main libc_start_call_main.h:58
          __libc_start_main_impl libc-start.c:360
          _start 0x0000000000430211
          

          Does anyone see/ recognise something wrong ?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @MoekieBoekie said in Segmentation Error On QSqlDriver::AddDatabase:

          __strcmp_avx2

          Does your virtualization support AVX2?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          M 1 Reply Last reply
          2
          • Christian EhrlicherC Christian Ehrlicher

            @MoekieBoekie said in Segmentation Error On QSqlDriver::AddDatabase:

            __strcmp_avx2

            Does your virtualization support AVX2?

            M Offline
            M Offline
            MoekieBoekie
            wrote on last edited by
            #5

            @Christian-Ehrlicher

            Yeah, this seemed to be the problem...
            Took much longer to than I want to admit before I found it...

            I wanted to post my fix already, but newbies on the forum can only post every 10 minutes 😅

            1 Reply Last reply
            2
            • M MoekieBoekie has marked this topic as solved on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved