Skip to content

Build sqlitebrowser from source, sqlcipher support (Windows) #482

Closed

Description

@huy-cong

Greetings everyone,
My goal is to re-compile sqlitebrowser for Windows with the support to open encrypted database. I downloaded the source code and already "scan" the support you insert in source (#ifdef ENABLE_SQLCIPHER)
I have Qt 5.4 & sqlcipher (binary & almagation files - license trial from Zetetic, and source code avaible ofc), but I dont know which steps to follow to attach sqlcipher with sqlitebrowser.
For now I did:
qmake CONFIG+=sqlcipher
make

But it gives me this error (which I though do not related much on sqlcipher...):

"
make[2]: Entering directory '/d/LibExternal/sqlitebrowser-3.8.0/libs/antlr-2.7.7'
g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I'.' -I'.' -I'../../../../Tools/local32/dst/qt/include' -I'../../../../Tools/local32/dst/qt/include/QtGui' -I'../../../../Tools/local32/dst/qt/include/QtCore' -I'release' -I'../../../../Tools/local32/dst/qt/mkspecs/win32-g++' -o release/NoViableAltForCharException.o src/NoViableAltForCharException.cpp
In file included from D:/Tools/mingw32/i686-w64-mingw32/include/_mingw.h:13:0,
from D:/Tools/mingw32/i686-w64-mingw32/include/crtdefs.h:10,
from D:/Tools/mingw32/i686-w64-mingw32/include/wchar.h:9,
from D:/Tools/mingw32/i686-w64-mingw32/include/c++/cwchar:44,
from D:/Tools/mingw32/i686-w64-mingw32/include/c++/bits/postypes.h:40,
from D:/Tools/mingw32/i686-w64-mingw32/include/c++/bits/char_traits.h:40,
from D:/Tools/mingw32/i686-w64-mingw32/include/c++/string:40,
from ./antlr/ANTLRException.hpp:12,
from ./antlr/RecognitionException.hpp:12,
from ./antlr/NoViableAltForCharException.hpp:12,
from src/NoViableAltForCharException.cpp:8:
D:/Tools/mingw32/i686-w64-mingw32/include/sec_api/string_s.h: In function 'errno_t antlr::strcpy_s(char (&)[__size], const char*)':
D:/Tools/mingw32/i686-w64-mingw32/include/sec_api/string_s.h:28:3: error: '::strcpy_s' has not been declared
_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_0_2(errno_t,strcpy_s,char,,_Dst,size_t,,_SizeInBytes,const char *,,_Src)
^
D:/Tools/mingw32/i686-w64-mingw32/include/sec_api/string_s.h:28:3: note: suggested alternative:
In file included from D:/Tools/mingw32/i686-w64-mingw32/include/_mingw.h:13:0,
from D:/Tools/mingw32/i686-w64-mingw32/include/crtdefs.h:10,
from D:/Tools/mingw32/i686-w64-mingw32/include/wchar.h:9,
from D:/Tools/mingw32/i686-w64-mingw32/include/c++/cwchar:44,
from D:/Tools/mingw32/i686-w64-mingw32/include/c++/bits/postypes.h:40,
from D:/Tools/mingw32/i686-w64-mingw32/include/c++/bits/char_traits.h:40,
from D:/Tools/mingw32/i686-w64-mingw32/include/c++/string:40,
from ./antlr/ANTLRException.hpp:12,
from ./antlr/RecognitionException.hpp:12,
from ./antlr/NoViableAltForCharException.hpp:12,
from src/NoViableAltForCharException.cpp:8:
D:/Tools/mingw32/i686-w64-mingw32/include/sec_api/string_s.h:28:3: note: 'antlr::strcpy_s'
_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_0_2(errno_t,strcpy_s,char,,_Dst,size_t,,_SizeInBytes,const char *,,_Src)
^
"

Do you have any ideas what is gone wrong? Is there anything I miss in the configuration steps?

Thanks a lot for any helps,
Best regards,

Huy Cong Vu

Activity

  1. huy-cong commented on Jan 7, 2016

    @huy-cong
    Author

    Hi guys,
    Sorry for duplicate posts in here and your private mail @justinclift, I guess we should discuss here from now on, It'll be easier for both of us :)

  2. justinclift commented on Jan 7, 2016

    @justinclift
    Member

    Interesting questions. @rp- creates our Windows release builds using Visual Studio (I think, that's from memory). Our nightly Windows builds use an older process, cross-compiling from Linux using MXE.

    From your error output above, it looks like you're using mingw32. I'm unsure if anyone's tried that yet. 😁

    And yeah, lets discuss here. It distributes the problem solving / knowledge wider. 😉

  3. huy-cong commented on Jan 7, 2016

    @huy-cong
    Author

    Yes indeed, I usually compile my other Qt projects with mingw32 and this configuration and it works fine.
    This error showned up when I tried to compile antlr lib. I'm not sure that it depends on string_s.h (which is standard) from other packages or not.

  4. justinclift commented on Jan 7, 2016

    @justinclift
    Member

    Yeah, I'm not sure either. I don't code C++ (at this point), I more help out this project with compiling on OSX and making packages there.

    Is there any way you can add an #include (or C++ equivalent) or something for string_s.h, to see if that works? Note - That's just me guessing. 😁

  5. glawrence commented on Jan 7, 2016

    @glawrence
    Contributor

    I keep meaning to look Windows builds, so will try and get restarted on this

  6. rp- commented on Jan 8, 2016

    @rp-
    Contributor

    building sqlitebrowser itself is not much of a problem with cmake on windows.

    Its more a problem of getting the dependencies correctly built, e.g. sqlite is a bit of a pitty because there are no build files for VS and you have to do them on your own with the correct .def file.

    I don't build with qmake anymore and don't know how a mingw build will work out on windows.

  7. huy-cong commented on Jan 8, 2016

    @huy-cong
    Author

    I'll try with cmake then.
    Following this link, I must have MXE to compile? I had msys2 already https://github.com/sqlitebrowser/sqlitebrowser/blob/master/BUILDING.md#cross-compiling-for-windows

    And then in the cmake file, I find some absolute path for the libs, which means that I have to set it to the right path on my system?
    "
    if(WIN32 AND MSVC)
    if(CMAKE_CL_64)
    set(QT5_PATH "E:/Qt64/Qt5.5.1/5.5/msvc2013_64")
    set(SQLITE3_PATH "E:/libs/sqlite3_x64")
    set(OPENSSL_PATH "E:/libs/openssl-1.0.2a-x64_86-win64")
    set(VSREDIST "vcredist_x64.exe")
    else()
    set(QT5_PATH "E:/Qt/Qt5.5.1/5.5/msvc2013")
    set(SQLITE3_PATH "E:/libs/sqlite3")
    set(OPENSSL_PATH "E:/libs/openssl-1.0.2a-i386-win32")
    set(VSREDIST "vcredist_x86.exe")
    endif()
    set(USE_QT5 TRUE)
    set(CMAKE_PREFIX_PATH "${QT5_PATH};${SQLITE3_PATH}")
    endif()
    "

  8. rp- commented on Jan 8, 2016

    @rp-
    Contributor

    No, MXE is for cross compiling from linux (for our nightly builds)

    The installer .exe is created using VS2013 and cmake.
    Yes you would need to set the paths to our install/library directories

  9. huy-cong commented on Jan 8, 2016

    @huy-cong
    Author

    Oh wrong call, it is a cross-compiling for Windows from Linux, won't work with me then :(
    So if I stay in Windows and use cmake (with mingw) is it still possible?

  10. rp- commented on Jan 8, 2016

    @rp-
    Contributor

    yes it should be possible

  11. huy-cong commented on Jan 13, 2016

    @huy-cong
    Author

    I'm trying to build with MingW 32 bits without success for now.
    When I ran cmake -Dsqlcipher, it gives me this error:

    -- Could NOT find Antlr2 (missing: ANTLR2_LIBRARIES ANTLR2_INCLUDE_DIRS)
    CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
    Please set them or make sure they are set and tested correctly in the CMake files:
    LIBSQLITE

    Eventhough I already add the path to my sqlcipher lib files:

    find_library(LIBSQLITE ${LIBSQLITE_NAME} HINTS /local32/dst/sqlcipher/lib)
    set(ADDITIONAL_INCLUDE_PATHS ${ADDITIONAL_INCLUDE_PATHS} /local32/dst/sqlcipher/include)

    I had libsqlcipher.a & libsqlcipher.la in lib directory (build from sqlcipher source with same MingW 32 tools). I wonder is these 2 files the CMake are looking for?

    2nd questions: I must set these variables to the path of sources or binary?
    SQLITE3_PATH
    OPENSSL_PATH

  12. 9 remaining items

  13. justinclift commented on Apr 27, 2016

    @justinclift
    Member

    @huy-cong Do you still have your CMakeLists.txt file around?

    I'm trying to get this working with MSVC 2013 + CMake (documenting the progress here), but am hitting the same ANTLR error you show above.

    Any ideas?

  14. justinclift commented on Apr 27, 2016

    @justinclift
    Member

    Managed to get past that error, and get CMake to generate the project files. It seems like the project is being compiled in x86 mode though, not x64, as it then complains about a mismatch.

    Does anyone know where to set that? I was very careful to download the x64 versions of Qt, OpenSSL, etc, and I'm running Win 8.1 x64. So, I'm unsure where it's getting x86 from. ???

  15. drescherjm commented on Apr 27, 2016

    @drescherjm

    Does anyone know where to set that?

    You set this in cmake-gui by selecting a 64 bit generator. All 64 bit generators for Visual Studio will have Win64 at the end.

    So, I'm unsure where it's getting x86 from. ???

    The default generator is 32 bit

  16. justinclift commented on Apr 27, 2016

    @justinclift
    Member

    Thanks @drescherjm I'll take a look at that again. I was trying things from the command line, as the GUI didn't seem to have a way to "Open File" to select an existing project.

    I'll take a look again. 😄

  17. justinclift commented on Apr 27, 2016

    @justinclift
    Member

    Hmmm, that seems to have completed the build. Ok, this might be worth putting more time into after all.

    Thanks heaps @drescherjm, that seems to have solved that problem. 😁

    Now to see if I can get the "install" step working...

  18. justinclift commented on Apr 27, 2016

    @justinclift
    Member

    Holy crap. It worked.

    first compile of db4s on windows

    Tomorrow, I'm going to document the living stuffing out of the process to make that work. 😄

  19. drescherjm commented on Apr 27, 2016

    @drescherjm

    BTW, You can also set the generator on the command line via cmake -G "generator"

    cmake --help

    will list the options.

  20. justinclift commented on Apr 27, 2016

    @justinclift
    Member

    Awesome, that's really, really helpful. 😄

  21. justinclift commented on Apr 27, 2016

    @justinclift
    Member

    The target for building a package with NSIS is also working too. Hmmm, it might be possible for us to get SQLCipher support working too. Another thing to try tomorrow. 😄

  22. justinclift commented on Apr 28, 2016

    @justinclift
    Member

    Update - I've gone through the process (from a newly installed Win 8.1 desktop) to compiled & packages 64-bit version on DB4S on Windows, taking 104 screenshots along the way.

    Mentally brain fogged now, so the cropping and turning-them-into-useful-docs process is going to have to wait a few hours before starting, or perhaps tomorrow morning.

  23. justinclift commented on May 2, 2016

    @justinclift
    Member

    For anyone interested, the docs-in-development for compiling DB4S on Windows are here:

        https://github.com/sqlitebrowser/sqlitebrowser/wiki/Setting-up-a-Win64-development-environment-for-DB4S

    They're in an ok state now. Some fine tuning still needs to be done to make things prettier, but the content is workable as-is. 😄

    Now if I can just get SQLCipher to compile... 😉

  24. justinclift commented on May 4, 2016

    @justinclift
    Member

    SQLCipher seems to compile ok, and DB4S seems to pretty much "just work" with it when the right includes/directory-paths/filenames are given to it. Initial package here for testing, if anyone wants to give it a shot:

        http://nightlies.sqlitebrowser.org/win64/sqlitebrowser-win64-with_sqlcipher-201605041823.exe

  25. kiwina commented on May 10, 2016

    @kiwina

    just tried no luck

  26. justinclift commented on May 10, 2016

    @justinclift
    Member

    @kiwina Heh Heh Heh, that's a bit light on details. 😉

    Which bits did you try, and what went wrong? Screenshots of error messages and similar are helpful, so we can investigate and try to fix it.

    As an extra thought, we've been putting time into making further instructions for compiling SQLCipher on Windows:

        https://github.com/justinclift/sqlitebrowser/wiki/Win64-setup-—-Compiling-SQLCipher

    They're also still a "work in progress", but might be useful depending on the problem you're hitting.

    Anyway, if you're ok to let us know what broke when you tried things, that would help. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions