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

QDB2 Plugin will not Compile on x86_64: cast loses precision

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.10
    • Core: Plugins, SQL Support
    • None

    Description

       When attempting to compile the QDB2 driver on Linux 64-bit, g++ throws an error as it cannot convert from the int of Qt::Handle(int) to a 64-bit void*. As I understand it, this bug was introduced in 5.7

      The first reference to this I found is this Stackoverflow.

      QDB2 won't compile

      The second is from Fossies

      Fossies Change

      And finally more an an explanation from Milania's Blog

      Milanias Blog

      Attempted to compile with the -m64 flag enabled, but it had no effect.

      g++ -c -pipe -m64 -g -Og -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -Werror -Wno-error=cpp -Wno-error=deprecated-decla
      rations -Wno-error=strict-overflow -Wno-error=implicit-fallthrough -D_REENTRANT -fPIC -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQ
      T_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB 
      ...
      ...
      /home/.../Git/qt5/qtbase/src/plugins/sqldrivers/db2/qsql_db2.cpp: In constructor 'QDB2Driver::QDB2Driver(Qt::HANDLE, Qt::HANDLE, QObject*)': 
      /home/.../Git/qt5/qtbase/src/plugins/sqldrivers/db2/qsql_db2.cpp:1199:46: error: cast from 'Qt::HANDLE {aka void*}' to 'SQLHANDLE {aka int}' loses precision [-fpermissive] 
          d->hEnv = reinterpret_cast<SQLHANDLE>(env); 
                                                   ^ 
      /home/.../Git/qt5/qtbase/src/plugins/sqldrivers/db2/qsql_db2.cpp:1200:46: error: cast from 'Qt::HANDLE {aka void*}' to 'SQLHANDLE {aka int}' loses precision [-fpermissive] 
          d->hDbc = reinterpret_cast<SQLHANDLE>(con); 
                                                   ^
      
      
      

      Reverting back to the change linked in Fossies allows the plugin to compile and load.

      Edit 1: Fixed stackoverflow link

       

      Attachments

        Issue Links

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

          Activity

            People

              laknoll Lars Knoll
              andrewdemarest Andrew Demarest
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes