Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake - Shell build fails when using miniz #110

Closed
jammerxd opened this issue Apr 8, 2023 · 4 comments
Closed

CMake - Shell build fails when using miniz #110

jammerxd opened this issue Apr 8, 2023 · 4 comments

Comments

@jammerxd
Copy link
Contributor

jammerxd commented Apr 8, 2023

When using the CMake build system, the shell fails to build with the following errors when enabling miniz:

shell.obj : error LNK2019: unresolved external symbol mz_crc32 referenced in function zipfileRemoveEntryFromList [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_version referenced in function do_meta_command [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_deflateInit2 referenced in function zipfileDeflate [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_deflate referenced in function zipfileDeflate [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_deflateEnd referenced in function zipfileDeflate [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_deflateBound referenced in function zipfileDeflate [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_compress referenced in function sqlarCompressFunc [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_compressBound referenced in function sqlarCompressFunc [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_inflateInit2 referenced in function zipfileInflate [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_inflate referenced in function zipfileInflate [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_inflateEnd referenced in function zipfileInflate [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
shell.obj : error LNK2019: unresolved external symbol mz_uncompress referenced in function sqlarUncompressFunc [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\Debug\sqlite3mc_shell.exe : fatal error LNK1120: 12 unresolved externals [D:\3rdparty\sqlite3multipleciphers\SQLite3MultipleCiphers\sqlite3mc_shell.vcxproj]
@utelle
Copy link
Owner

utelle commented Apr 8, 2023

Thanks for reporting.

First, I was not able to reproduce the problem, but then I discovered that the issue results from an unfortunate combination of circumstances.

  1. The patch of shell.c that should include the source file miniz.c (if symbol SQLITE3MC_USE_MINIZ is defined) is wrong.
  2. If the flag SQLITE_ENABLE_COMPRESS is defined (and that was the case in my first test), compilation succeeds without error, because miniz.c is already included in the main library source file sqlite3mc.c.
  3. If the flag SQLITE_ENABLE_COMPRESS is not defined (as in your experiment), one gets those unresolved references due to missing inclusion of miniz.c (resulting from (1)).

I will fix the issue.

utelle added a commit that referenced this issue Apr 8, 2023
A wrong patch of the SQLite shell source could lead to either not or doubly including the miniz sources depending on whether the flag SQLITE_ENABLE_COMPRESS is defined or not.
@utelle
Copy link
Owner

utelle commented Apr 8, 2023

Commit 473ff0e fixes the issue.

@jammerxd
Copy link
Contributor Author

jammerxd commented Apr 8, 2023

Aha! Gotcha. Thanks. That 100% makes sense. I was only using SQLITE3MC_USE_MINIZ=ON without SQLITE_ENABLE_COMPRESS.

@utelle
Copy link
Owner

utelle commented May 18, 2023

Release SQLite3 Multiple Ciphers 1.6.3 now contains this fix. Therefore this issue can be closed.

@utelle utelle closed this as completed May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants