SRombauts / SQLiteCpp

SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper.
http://srombauts.github.io/SQLiteCpp
MIT License
2.22k stars 510 forks source link

unable to build with cmake + MSVC on Windows #492

Closed AlexanderBarnt closed 4 weeks ago

AlexanderBarnt commented 1 month ago

SQLiteCpp version: 3.3.2 CMAKE GUI version: 3.30.0 MSVC: 2022, Version 17.9.7

Unable to build it with cmake GUI + MSVC 2022.

CMAKE output:

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19044.
The C compiler identification is MSVC 19.39.33523.0
The CXX compiler identification is MSVC 19.39.33523.0
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x86/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x86/cl.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
Using c++ standard c++11
CMake version: 3.30.0
Project version: 3.3.2
CMAKE_CXX_COMPILER 'C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x86/cl.exe' 'MSVC' '19.39.33523.0'
CMAKE_CXX_FLAGS                '/DWIN32 /D_WINDOWS /W3 /GR /EHsc'
CMAKE_CXX_FLAGS_DEBUG          '/MDd /Zi /Ob0 /Od /RTC1'
CMAKE_CXX_FLAGS_RELEASE        '/MD /O2 /Ob2 /DNDEBUG'
CMAKE_CXX_FLAGS_RELWITHDEBINFO '/MD /Zi /O2 /Ob1 /DNDEBUG'
CMAKE_CXX_FLAGS_MINSIZEREL     '/MD /O1 /Ob1 /DNDEBUG'
Compile sqlite3 from source in subdirectory
CMake Warning (dev) at CMakeLists.txt:390 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Found PythonInterp: C:/Python312/python.exe (found version "3.12.3")
Found Cppcheck: X:/Programs/Perl/strawberry-perl-5.40.0.1-64bit-portable/c/bin/cppcheck.exe Cppcheck 2.14.0
SQLITECPP_RUN_DOXYGEN OFF
SQLITECPP_BUILD_EXAMPLES OFF
SQLITECPP_BUILD_TESTS OFF
Configuring done (3.4s)

it was able to generate the solution files for VS but when i try to compile i got:

Build started at 12:03 AM...
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1>1>Checking Build System
2>------ Build started: Project: sqlite3, Configuration: Debug Win32 ------
3>------ Build started: Project: SQLiteCpp_cpplint, Configuration: Debug Win32 ------
4>------ Build started: Project: SQLiteCpp_cppcheck, Configuration: Debug Win32 ------
2>Building Custom Rule X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/sqlite3/CMakeLists.txt
2>sqlite3.c
3>X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\cpplint.py:877: SyntaxWarning: invalid escape sequence '\D'
3>  """FullName after removing the local path to the repository.
2>sqlite3.vcxproj -> X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\BUILD\sqlite3\Debug\sqlite3.lib
3>X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\cpplint.py:2710: SyntaxWarning: invalid escape sequence '\('
3>  line = re.sub(r'operator(==|!=|<|<<|<=|>=|>>|>)\(', 'operator\(', line)
3>X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\cpplint.py:2912: SyntaxWarning: invalid escape sequence '\('
3>  if (Search('for *\(.*[^:]:[^: ]', line) or
3>X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\cpplint.py:2913: SyntaxWarning: invalid escape sequence '\('
3>  Search('for *\(.*[^: ]:[^:]', line)):
3>X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\cpplint.py:50: DeprecationWarning: module 'sre_compile' is deprecated
3>  import sre_compile
5>------ Build started: Project: SQLiteCpp, Configuration: Debug Win32 ------
4>cppcheck: Failed to load library configuration file 'std.cfg'. File not found
4>Failed to load std.cfg. Your Cppcheck installation is broken, please re-install. The Cppcheck binary was compiled with FILESDIR set to "R:/winlibs64ucrt_stage/inst_cppcheck-2.14.0/share/Cppcheck" and will therefore search for std.cfg in R:/winlibs64ucrt_stage/inst_cppcheck-2.14.0/share/Cppcheck/cfg.
4>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\BUILD\CMakeFiles\681c181c72f8a6061dc1a1ef17a91c93\SQLiteCpp_cppcheck.rule;X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\CMakeLists.txt' exited with code 1.
4>Done building project "SQLiteCpp_cppcheck.vcxproj" -- FAILED.
5>Building Custom Rule X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/CMakeLists.txt
5>Backup.cpp
5>Column.cpp
5>Database.cpp
5>Exception.cpp
3>Building Custom Rule X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/CMakeLists.txt
5>Savepoint.cpp
5>Statement.cpp
5>Transaction.cpp
5>Generating Code...
5>SQLiteCpp.vcxproj -> X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\BUILD\Debug\SQLiteCpp.lib
6>------ Build started: Project: ALL_BUILD, Configuration: Debug Win32 ------
6>Building Custom Rule X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/CMakeLists.txt
========== Build: 5 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 12:03 AM and took 04.403 seconds ==========

I do have python in my PATH env variable, Perl, and the Sqlite's source code is in SQLiteCpp-3.3.2\sqlite3

UnixY2K commented 4 weeks ago

disabling cpplint in cmake with -SQLITECPP_RUN_CPPLINT=OFF should fix this issue

487 should fix this for end users by default, you can check a similar issue here https://github.com/SRombauts/SQLiteCpp/issues/452#issuecomment-1741807188

AlexanderBarnt commented 4 weeks ago

disabling cpplint in cmake with -SQLITECPP_RUN_CPPLINT=OFF should fix this issue

487 should fix this for end users by default, you can check a similar issue here #452 (comment)

Thank you very much, the building was almost successful, only got 1 error:


Build started at 2:52 PM...
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>1>Checking Build System
2>------ Build started: Project: sqlite3, Configuration: Debug x64 ------
3>------ Build started: Project: SQLiteCpp_cppcheck, Configuration: Debug x64 ------
2>Building Custom Rule X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/sqlite3/CMakeLists.txt
2>sqlite3.c
2>   Creating library X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/BUILD/sqlite3/Debug/sqlite3.lib and object X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/BUILD/sqlite3/Debug/sqlite3.exp
3>cppcheck: Failed to load library configuration file 'std.cfg'. File not found
3>Failed to load std.cfg. Your Cppcheck installation is broken, please re-install. The Cppcheck binary was compiled with FILESDIR set to "R:/winlibs64ucrt_stage/inst_cppcheck-2.14.0/share/Cppcheck" and will therefore search for std.cfg in R:/winlibs64ucrt_stage/inst_cppcheck-2.14.0/share/Cppcheck/cfg.
2>sqlite3.vcxproj -> X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\BUILD\bin\Debug\sqlite3.dll
3>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\BUILD\CMakeFiles\681c181c72f8a6061dc1a1ef17a91c93\SQLiteCpp_cppcheck.rule;X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\CMakeLists.txt' exited with code 1.
3>Done building project "SQLiteCpp_cppcheck.vcxproj" -- FAILED.
4>------ Build started: Project: SQLiteCpp, Configuration: Debug x64 ------
4>Building Custom Rule X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/CMakeLists.txt
4>Backup.cpp
4>Column.cpp
4>Database.cpp
4>Exception.cpp
4>Savepoint.cpp
4>Statement.cpp
4>Transaction.cpp
4>Generating Code...
4>   Creating library X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/BUILD/Debug/SQLiteCpp.lib and object X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/BUILD/Debug/SQLiteCpp.exp
4>SQLiteCpp.vcxproj -> X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\BUILD\bin\Debug\SQLiteCpp.dll
5>------ Build started: Project: SQLiteCpp_example1, Configuration: Debug x64 ------
5>Building Custom Rule X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/CMakeLists.txt
5>main.cpp
5>SQLiteCpp_example1.vcxproj -> X:\SQLiteCpp\3.3.2\SQLiteCpp-3.3.2\BUILD\bin\Debug\SQLiteCpp_example1.exe
6>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
6>Building Custom Rule X:/SQLiteCpp/3.3.2/SQLiteCpp-3.3.2/CMakeLists.txt
========== Build: 5 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 2:52 PM and took 10.086 seconds ==========

Should I ignore it?

UnixY2K commented 4 weeks ago

almost forgot, you should disable cppcheck too: -DSQLITECPP_RUN_CPPCHECK=OFF

AlexanderBarnt commented 4 weeks ago

Thank you very much, everything went fine.