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

Support building sqlite3 from amalgamation #444

Merged
merged 1 commit into from
Jan 10, 2023

Conversation

cole-miller
Copy link
Contributor

@cole-miller cole-miller commented Dec 5, 2022

This adds a --enable-build-sqlite option to our configure.ac. In this mode, the build will look for sqlite3.c in the build root and just add that to libdqlite_la_SOURCES, instead of linking with -lsqlite3.

The build system doesn't take care of fetching the SQLite amalgamation -- the idea is to obtain an SQLite source archive/checkout and do make sqlite3.c, or download the amalgamation from sqlite.org. It's important to use a version of the amalgamation that matches the version of sqlite.h that's on your include path.

Our build turns on a bunch of warnings that fire on the SQLite source code; I had to modify the amalgamation by adding

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"

at the top and

#pragma GCC diagnostic pop

at the bottom.

The point is to be able to easily add printfs in SQLite code, turn on SQLITE_DEBUG, etc., to support debugging issues like #432 that arise from the interaction between SQLite and our VFS.

Signed-off-by: Cole Miller cole.miller@canonical.com

@codecov
Copy link

codecov bot commented Dec 5, 2022

Codecov Report

Merging #444 (0da0e65) into master (89ca093) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #444   +/-   ##
=======================================
  Coverage   74.47%   74.47%           
=======================================
  Files          32       32           
  Lines        5382     5382           
  Branches     1682     1682           
=======================================
  Hits         4008     4008           
- Misses        817      818    +1     
+ Partials      557      556    -1     
Impacted Files Coverage Δ
src/gateway.c 60.41% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@cole-miller
Copy link
Contributor Author

cole-miller commented Dec 5, 2022

Oh, if you -DSQLITE_DEBUG there are more warnings to disable.

#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"

Copy link
Contributor

@MathieuBordere MathieuBordere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, should come in handy

@MathieuBordere
Copy link
Contributor

can you fix the merge conflict please @cole-miller ?

Signed-off-by: Cole Miller <cole.miller@canonical.com>
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

Successfully merging this pull request may close these issues.

None yet

2 participants