Building QSQLCipher trouble on MacOS.

  • Hello all!
    I am trying to build this SQLCipher plugin on Qt 5.12.2 on MacOS. Got error like this:

    $ make
    cd qsqlcipher/ && ( test -e Makefile || /Users/alexandr/Applications/Qt5.12/5.12.2/ios/bin/qmake -o Makefile /mobile_libs/qsqlcipher-qt5/qsqlcipher/ ) && /Applications/ -f Makefile
    Info: creating stash file /mobile_libs/qsqlcipher-qt5/build/qsqlcipher/.qmake.stash
    Project WARNING: Cross compiling without sysroot. Disabling pkg-config.
    Project WARNING: Cross compiling without sysroot. Disabling pkg-config.
    sh: --exists: command not found
    Project ERROR: sqlcipher development package not found
    make: *** [sub-qsqlcipher-make_first] Error 3

    The question is where to get sqlcipher development package?
    Before it I've been installing all requirements from reference.

    SQLCiher itself built via homebrew and it's working.


    TARGET = qsqlcipher
    QT_FOR_CONFIG += sqldrivers-private
    HEADERS += $$PWD/qsql_sqlite_p.h \
        ../../../../../../../usr/local/Cellar/sqlcipher/HEAD-162b061/include/sqlcipher/sqlite3.h \
    SOURCES += $$PWD/qsql_sqlite.cpp $$PWD/smain.cpp
    CONFIG += link_pkgconfig
    PKGCONFIG += sqlcipher
    # or if pkg-config is not available
    OTHER_FILES += sqlcipher.json
    PLUGIN_CLASS_NAME = QSQLCipherDriverPlugin
    # follows contents of include(../qsqldriverbase.pri)
    QT  = core core-private sql-private
    PLUGIN_TYPE = sqldrivers
    INCLUDEPATH += $$PWD/../../../../../../../usr/include
    DEPENDPATH += $$PWD/../../../../../../../usr/include
    LIBS += -L$$PWD/../../../../../../../usr/lib/ -lcrypto.0.9.7
    INCLUDEPATH += $$PWD/../../../../../../../usr/local/Cellar/sqlcipher/HEAD-162b061/include
    DEPENDPATH += $$PWD/../../../../../../../usr/local/Cellar/sqlcipher/HEAD-162b061/include
    LIBS += -L$$PWD/../../../../../../../usr/local/Cellar/sqlcipher/HEAD-162b061/lib/ -lsqlcipher.0

  • Found another plugin QtCipherSqlitePlugin. It built perfectly (with huge list of unused var warnings). For now in my application I have this:

    QML debugging is enabled. Only use this in a safe environment.
    QSqlDatabase: SQLITECIPHER driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    Failed to restore the database
    QSqlQuery::exec: database not open

    How to install this plugin? In reference for this plugin mentioned to copy it somewhere? Where should it be copied?

  • Solved. Need to copy result of compilation to [QT_HOME]/5.12.2/clang_64/plugins/sqldrivers

  • @bogong Thanx :)
    Whould you give me a simple code, how to use this plugin?

  • Lifetime Qt Champion

    @Andy-Pelawi said in Building QSQLCipher trouble on MacOS.:

    Whould you give me a simple code, how to use this plugin?

  • @Christian-Ehrlicher Thanx :)

    I testing my code using this :
    and success.

    And how to access the encrypted this db using a database manager like dbeaver? Do you have any suggestions?
    Sorry for my English :)

  • Lifetime Qt Champion

    I don't know dbeaver but since it looks like it can open all kinds of databases it should also have a plugin for sqlcipher

Log in to reply