building Qt6 OCI driver for MacOS Monterey
-
Hey guys, I'm trying to build a Qt6 OCI driver on mac OS Monterey from the Terminal shell as follows:
COMMAND:
qt-cmake ~/Qt/6.3.2/macos/plugins/sqldrivers -DOracle_INCLUDE_DIR=~/oracle/instantclient-19_8/sdk/include -DOracle_LIBRARY=~/oracle/instantclient-19_8/libclntsh.dylibRESULT:
QMake is asking for a CMakeLists.txtCMake Error: The source directory "/Users/myuser/Qt/6.3.2/macos/plugins/sqldrivers" does not appear to contain CMakeLists.txt
Question - How should I create the CMakeLists.txt?
-
Hi and welcome to devnet,
You don't. Download the Qt sources. You are trying to build the driver in your actual installation.
-
@SGaist - Ok, I finally got the command line below to work.
qt-cmake -G Ninja ~/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=~/Qt/6.3.2/gcc_64 -DOracle_INCLUDE_DIR=~/oracle/instantclient-19_8/sdk/include -DOracle_LIBRARY=~/oracle/instantclient-19_8/libclntsh.dylib
Issue: When I ran the next commans, I get an error
- cmake --build .
However, when I ran this command I get an exception
Exception
FAILED: oci/CMakeFiles/QOCIDriverPlugin.dir/main.cpp.o /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/qsqldriver.h:112:18: note: overridden virtual function is here virtual bool hasFeature(DriverFeature f) const = 0;
Can you please assist?
-
You did not post enough of the build error.
-
➜ ```
sqloci cmake --build .[ 9%] Automatic MOC for target QOCIDriverPlugin [ 9%] Built target QOCIDriverPlugin_autogen [ 18%] Building CXX object oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o In file included from /Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/mocs_compilation.cpp:2: In file included from /Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/EWIEGA46WW/moc_qsql_oci_p.cpp:10: /Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/EWIEGA46WW/../../../../Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci_p.h:81:10: error: 'hasFeature' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] bool hasFeature(DriverFeature f) const; ^ /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/qsqldriver.h:112:18: note: overridden virtual function is here virtual bool hasFeature(DriverFeature f) const = 0; ^ 1 error generated. make[2]: *** [oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o] Error 1 make[1]: *** [oci/CMakeFiles/QOCIDriverPlugin.dir/all] Error 2 make: *** [all] Error 2
-
@SGaist - please see the attached error
[ 9%] Automatic MOC for target QOCIDriverPlugin
[ 9%] Built target QOCIDriverPlugin_autogen
[ 18%] Building CXX object oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o
In file included from /Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/mocs_compilation.cpp:2:
In file included from /Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/EWIEGA46WW/moc_qsql_oci_p.cpp:10:
/Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/EWIEGA46WW/../../../../Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci_p.h:81:10: error: 'hasFeature' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
bool hasFeature(DriverFeature f) const;
^
/Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/qsqldriver.h:112:18: note: overridden virtual function is here
virtual bool hasFeature(DriverFeature f) const = 0;
^
1 error generated.
make[2]: *** [oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [oci/CMakeFiles/QOCIDriverPlugin.dir/all] Error 2
make: *** [all] Error 2 -
hi @AndyS , @JKSH can you please assist?
After running the cmake build command, I get
cmake --build .
ERROR EXCEPTION
[ 9%] Automatic MOC for target QOCIDriverPlugin
[ 9%] Built target QOCIDriverPlugin_autogen
[ 18%] Building CXX object oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o
In file included from /Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/mocs_compilation.cpp:2:
In file included from /Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/EWIEGA46WW/moc_qsql_oci_p.cpp:10:
/Users/myuser/sqloci/oci/QOCIDriverPlugin_autogen/EWIEGA46WW/../../../../Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci_p.h:81:10: error: 'hasFeature' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
bool hasFeature(DriverFeature f) const;
^
/Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/qsqldriver.h:112:18: note: overridden virtual function is here
virtual bool hasFeature(DriverFeature f) const = 0;
^
1 error generated.
make[2]: *** [oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [oci/CMakeFiles/QOCIDriverPlugin.dir/all] Error 2
make: *** [all] Error 2 -
@SGaist , @AndyS , @JKSH - Please find the entire exceptions when running the script to build the libqsqloci.dylib
Any help would be greatly appreciated. Thanks for your help!Exception
➜ myoci qt-cmake -G Ninja /Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers -DCMAKE_INSTALL_PREFIX=/Users/myuser/Qt/6.3.2/gcc_64 -DOracle_INCLUDE_DIR="/Users/myuser/oracle/instantclient-19_8" -DOracle_LIBRARY="/Users/myuser/oracle/instantclient-19_8/libclntsh.dylib" -DCMAKE_MAKE_PROGRAM="/Users/myuser/Qt/Tools/Ninja/ninja"
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE-- Configuration summary shown below. It has also been written to /Users/myuser/myoci/config.summary
-- Configure with --log-level=STATUS or higher to increase CMake's message verbosity. The log level does not persist across reconfigurations.-- Configure summary:
Qt Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... yes
ODBC ................................... no
PostgreSQL ............................. no
SQLite ................................. yes
Using system provided SQLite ......... no-- Configuring done
-- Generating done
-- Build files have been written to: /Users/myuser/myoci
➜ myoci cmake --build .
[4/11] Building CXX object oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o
FAILED: oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o
/usr/bin/clang++ -DGL_SILENCE_DEPRECATION -DQOCIDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN -DQT_SQL_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/Users/myuser/myoci/oci/QOCIDriverPlugin_autogen/include -I/Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci -I/Users/myuser/myoci/oci -I/Users/myuser/myoci/include -isystem /Users/myuser/oracle/instantclient-19_8 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers -iframework /Users/myuser/Qt/6.3.2/macos/lib -isystem /Users/myuser/Qt/6.3.2/macos/mkspecs/macx-clang -isystem /Users/myuser/Qt/6.3.2/macos/include -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers/6.3.2 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers/6.3.2/QtCore -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/6.3.2 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/6.3.2/QtSql -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers -g -DNDEBUG -O2 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.14 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-exceptions -Werror "-Wno-error=#warnings" -Wno-error=deprecated-declarations -fapplication-extension -std=c++17 -MD -MT oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o -MF oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o.d -o oci/CMakeFiles/QOCIDriverPlugin.dir/QOCIDriverPlugin_autogen/mocs_compilation.cpp.o -c /Users/myuser/myoci/oci/QOCIDriverPlugin_autogen/mocs_compilation.cpp
In file included from /Users/myuser/myoci/oci/QOCIDriverPlugin_autogen/mocs_compilation.cpp:2:
In file included from /Users/myuser/myoci/oci/QOCIDriverPlugin_autogen/EWIEGA46WW/moc_qsql_oci_p.cpp:10:
/Users/myuser/myoci/oci/QOCIDriverPlugin_autogen/EWIEGA46WW/../../../../Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci_p.h:81:10: error: 'hasFeature' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
bool hasFeature(DriverFeature f) const;
^
/Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/qsqldriver.h:112:18: note: overridden virtual function is here
virtual bool hasFeature(DriverFeature f) const = 0;
^
1 error generated.
[5/11] Building CXX object oci/CMakeFiles/QOCIDriverPlugin.dir/main.cpp.o
FAILED: oci/CMakeFiles/QOCIDriverPlugin.dir/main.cpp.o
/usr/bin/clang++ -DGL_SILENCE_DEPRECATION -DQOCIDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN -DQT_SQL_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/Users/myuser/myoci/oci/QOCIDriverPlugin_autogen/include -I/Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci -I/Users/myuser/myoci/oci -I/Users/myuser/myoci/include -isystem /Users/myuser/oracle/instantclient-19_8 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers -iframework /Users/myuser/Qt/6.3.2/macos/lib -isystem /Users/myuser/Qt/6.3.2/macos/mkspecs/macx-clang -isystem /Users/myuser/Qt/6.3.2/macos/include -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers/6.3.2 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers/6.3.2/QtCore -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/6.3.2 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/6.3.2/QtSql -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers -g -DNDEBUG -O2 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.14 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-exceptions -Werror "-Wno-error=#warnings" -Wno-error=deprecated-declarations -fapplication-extension -std=c++17 -MD -MT oci/CMakeFiles/QOCIDriverPlugin.dir/main.cpp.o -MF oci/CMakeFiles/QOCIDriverPlugin.dir/main.cpp.o.d -o oci/CMakeFiles/QOCIDriverPlugin.dir/main.cpp.o -c /Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/main.cpp
In file included from /Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/main.cpp:42:
/Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci_p.h:81:10: error: 'hasFeature' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
bool hasFeature(DriverFeature f) const;
^
/Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/qsqldriver.h:112:18: note: overridden virtual function is here
virtual bool hasFeature(DriverFeature f) const = 0;
^
1 error generated.
[6/11] Building CXX object oci/CMakeFiles/QOCIDriverPlugin.dir/qsql_oci.cpp.o
FAILED: oci/CMakeFiles/QOCIDriverPlugin.dir/qsql_oci.cpp.o
/usr/bin/clang++ -DGL_SILENCE_DEPRECATION -DQOCIDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_PLUGIN -DQT_SQL_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/Users/myuser/myoci/oci/QOCIDriverPlugin_autogen/include -I/Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci -I/Users/myuser/myoci/oci -I/Users/myuser/myoci/include -isystem /Users/myuser/oracle/instantclient-19_8 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers -iframework /Users/myuser/Qt/6.3.2/macos/lib -isystem /Users/myuser/Qt/6.3.2/macos/mkspecs/macx-clang -isystem /Users/myuser/Qt/6.3.2/macos/include -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers/6.3.2 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtCore.framework/Headers/6.3.2/QtCore -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/6.3.2 -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/6.3.2/QtSql -isystem /Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers -g -DNDEBUG -O2 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.14 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-exceptions -Werror "-Wno-error=#warnings" -Wno-error=deprecated-declarations -fapplication-extension -std=c++17 -MD -MT oci/CMakeFiles/QOCIDriverPlugin.dir/qsql_oci.cpp.o -MF oci/CMakeFiles/QOCIDriverPlugin.dir/qsql_oci.cpp.o.d -o oci/CMakeFiles/QOCIDriverPlugin.dir/qsql_oci.cpp.o -c /Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci.cpp
In file included from /Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci.cpp:40:
/Users/myuser/Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci_p.h:81:10: error: 'hasFeature' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
bool hasFeature(DriverFeature f) const;
^
/Users/myuser/Qt/6.3.2/macos/lib/QtSql.framework/Headers/qsqldriver.h:112:18: note: overridden virtual function is here
virtual bool hasFeature(DriverFeature f) const = 0;
^
1 error generated.
[8/11] Building CXX object sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite.cpp.o
[9/11] Building C object sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/Users/myuser/Qt/6.3.2/Src/qtbase/src/3rdparty/sqlite/sqlite3.c.o
ninja: build stopped: subcommand failed.
➜ myoci
➜ myoci cmake --install .
-- Install configuration: "RelWithDebInfo"
-- Installing: /Users/myuser/Qt/6.3.2/gcc_64/lib/cmake/Qt6Sql/Qt6QOCIDriverPluginConfig.cmake
-- Installing: /Users/myuser/Qt/6.3.2/gcc_64/lib/cmake/Qt6Sql/Qt6QOCIDriverPluginConfigVersion.cmake
-- Installing: /Users/myuser/Qt/6.3.2/gcc_64/lib/cmake/Qt6Sql/Qt6QOCIDriverPluginConfigVersionImpl.cmake
CMake Error at oci/cmake_install.cmake:49 (file):
file INSTALL cannot find
"/Users/myuser/myoci/plugins/sqldrivers/libqsqloci.dylib": No such
file or directory.
Call Stack (most recent call first):
cmake_install.cmake:42 (include) -
@Albert-M said in building Qt6 OCI driver for MacOS Monterey:
Qt/6.3.2/Src/qtbase/src/plugins/sqldrivers/oci/qsql_oci_p.h:81:10: error: 'hasFeature' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
Your compiler is refusing to proceed because
hasFeature()
does not have theoverride
keyword applied. So the fix is to modify the header and mark it asoverride
.Please open a bug report for this at https://bugreports.qt.io
-
@JKSH said in building Qt6 OCI driver for MacOS Monterey:
overrides a member function but is not marked 'override'
@JKSH - Thanks you so much! The issue is now resolved.
Resolution
I added the override to the syntax and recompiled !
Screen Shot 2022-10-12 at 2.17.24 PM.png
![alt text] -
@JKSH said in building Qt6 OCI driver for MacOS Monterey:
Please open a bug report for this at https://bugreports.qt.io
No longer needed: https://codereview.qt-project.org/c/qt/qtbase/+/437946