-
Notifications
You must be signed in to change notification settings - Fork 37.8k
depends: Do not override CFLAGS
when building SQLite with DEBUG=1
#29287
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
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
concept ACK 4658c83 |
Could this be the root cause for #27222? |
depends/packages/sqlite.mk
Outdated
@@ -11,7 +11,8 @@ $(package)_config_opts_linux=--with-pic | |||
$(package)_config_opts_freebsd=--with-pic | |||
$(package)_config_opts_netbsd=--with-pic | |||
$(package)_config_opts_openbsd=--with-pic | |||
$(package)_config_opts_debug=--enable-debug | |||
# We avoid using `--enable-debug` because it overrides CFLAGS, a behavior we want to prevent. | |||
$(package)_cppflags_debug += -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would the latter two be needed? Using only runtime checks/asserts would be more in line with the documentation. See: DEBUG: Disable some optimizations and enable more runtime checking
. Also they are not supported for third-party code, see https://sqlite.org/debugging.html
Would be better to only use SQLITE_DEBUG? https://sqlite.org/compile.html#debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to only use SQLITE_DEBUG?
Thanks! Done.
4658c83
to
19fbbb1
Compare
lgtm ACK 19fbbb1 |
ACK 19fbbb1 |
I think it'd be easiest to make (any) additional changes together here, so we don't have to go over the flags twice. Can you combine any relevant changes and close the other PR.
I think so. Rebased #27495 on top. Related, I guess |
The SQLite build system overrides the `CFLAGS` when is configured with the `--enable-debug` option.
The `--enable-debug` configure option for the SQLite package does two things. It adds three preprocessor definitions and overrides CFLAGS with "-g -O0". The latter breaks the user's ability to provide sanitizer and LTO flags.
19fbbb1
to
5fb8f0f
Compare
@fanquake Thank you for your review!
#29282 has been integrated into this PR.
Added |
oss-fuzz PR: google/oss-fuzz#11540 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 5fb8f0f - downstream is also green, so i'll fixup the PR there.
$(package)_cflags+=-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_JSON -DSQLITE_LIKE_DOESNT_MATCH_BLOBS | ||
$(package)_cflags+=-DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_AUTOINIT | ||
# We avoid using `--enable-debug` because it overrides CFLAGS, a behavior we want to prevent. | ||
$(package)_cflags_debug += -g |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really be done globally, but I can follow up, as I have another global change to make at the same time.
$(package)_cflags+=-DSQLITE_DQS=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DEPRECATED | ||
$(package)_cflags+=-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_JSON -DSQLITE_LIKE_DOESNT_MATCH_BLOBS | ||
$(package)_cflags+=-DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_AUTOINIT | ||
# We avoid using `--enable-debug` because it overrides CFLAGS, a behavior we want to prevent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment could be a bit confusing, because it says we don't want to use --enable-debug
, because it overrides cflags, but then we override cflags in the next line. Not a blocker though.
Should be removed after bitcoin/bitcoin#29287 upstream.
Should be removed after bitcoin/bitcoin#29287 upstream.
…SQLite with `DEBUG=1` 5fb8f0f depends: Do not override CFLAGS when building SQLite with DEBUG=1 (Hennadii Stepanov) 2b0dd88 depends: Ensure definitions are passed when building SQLite with DEBUG=1 (Hennadii Stepanov) Pull request description: The `--enable-debug` configure option for the SQLite package does two things: ```autoconf #----------------------------------------------------------------------- # --enable-debug # AC_ARG_ENABLE(debug, [AS_HELP_STRING( [--enable-debug], [build with debugging features enabled [default=no]])], [], []) AC_MSG_CHECKING([Build type]) if test x"$enable_debug" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE" CFLAGS="-g -O0" AC_MSG_RESULT([debug]) else AC_MSG_RESULT([release]) fi #----------------------------------------------------------------------- ``` It adds three preprocessor definitions and overrides `CFLAGS` with `"-g -O0"`. The latter breaks the user's ability to provide sanitizer and LTO flags. This PR might be especially useful for OSS-Fuzz where `DEBUG=1` has been used since google/oss-fuzz#10503. Also it makes a workaround for building SQLite for 32-bit unneeded. For details, please refer to https://github.com/hebasto/oss-fuzz/tree/240120-sqlite. Changes in bitcoin#29282 might not be strictly required now. However, I consider them an improvement. ACKs for top commit: fanquake: ACK 5fb8f0f - downstream is also green, so i'll fixup the PR there. Tree-SHA512: 8593d8a0237ebb270d5da763fb65ed642ab8ed0d44e57704a34154621f49e3d5c58b462cc0070251fa1ba556c58a3c7d3620530d6839dc6dc9e0887010330eca
…SQLite with `DEBUG=1` 5fb8f0f depends: Do not override CFLAGS when building SQLite with DEBUG=1 (Hennadii Stepanov) 2b0dd88 depends: Ensure definitions are passed when building SQLite with DEBUG=1 (Hennadii Stepanov) Pull request description: The `--enable-debug` configure option for the SQLite package does two things: ```autoconf #----------------------------------------------------------------------- # --enable-debug # AC_ARG_ENABLE(debug, [AS_HELP_STRING( [--enable-debug], [build with debugging features enabled [default=no]])], [], []) AC_MSG_CHECKING([Build type]) if test x"$enable_debug" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE" CFLAGS="-g -O0" AC_MSG_RESULT([debug]) else AC_MSG_RESULT([release]) fi #----------------------------------------------------------------------- ``` It adds three preprocessor definitions and overrides `CFLAGS` with `"-g -O0"`. The latter breaks the user's ability to provide sanitizer and LTO flags. This PR might be especially useful for OSS-Fuzz where `DEBUG=1` has been used since google/oss-fuzz#10503. Also it makes a workaround for building SQLite for 32-bit unneeded. For details, please refer to https://github.com/hebasto/oss-fuzz/tree/240120-sqlite. Changes in bitcoin#29282 might not be strictly required now. However, I consider them an improvement. ACKs for top commit: fanquake: ACK 5fb8f0f - downstream is also green, so i'll fixup the PR there. Tree-SHA512: 8593d8a0237ebb270d5da763fb65ed642ab8ed0d44e57704a34154621f49e3d5c58b462cc0070251fa1ba556c58a3c7d3620530d6839dc6dc9e0887010330eca
801c4fc build: followup to 29488 applied to gmp (pasta) 4b704a6 Merge bitcoin#28627: depends: zeromq 4.3.5 (fanquake) 0e6cb98 Merge bitcoin#26421: build: copy config.{guess,sub} post autogen in zmq package (fanquake) cd33b69 Merge bitcoin#29488: depends: always configure with `--with-pic` (fanquake) 1b88674 Merge bitcoin#29287: depends: Do not override `CFLAGS` when building SQLite with `DEBUG=1` (fanquake) f50fb6e Merge bitcoin#26998: depends: ensure we are appending to sqlite cflags (Andrew Chow) 25a594f Merge bitcoin#25987: build: compile depends sqlite with more recommended options (Andrew Chow) d725c58 Merge bitcoin#27312: depends: qrencode 4.1.1 (fanquake) 482e5bb Merge bitcoin#27462: depends: fix compiling bdb with clang-16 on aarch64 (fanquake) f0a53c9 Merge bitcoin#26994: depends: define `__BSD_VISIBLE` for FreeBSD bdb build (merge-script) b1ac992 Merge bitcoin#26073: build: fix depends bdb compilation for BSDs (fanquake) 45e0f6e Merge bitcoin#25763: bdb: disable Werror for format-security (fanquake) Pull request description: ## Issue being fixed or feature implemented First batch of PRs which lead towards cmake, focusing on having nothing or very little done out of order / with significant conflicts ## What was done? batch of 11 backports which lead towards cmake ## How Has This Been Tested? Built locally, seems to work, let's see CI ## Breaking Changes ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 801c4fc knst: utACK 801c4fc Tree-SHA512: b8b5299da9d82ab485ba5141ea12ba5c606f1a783b34c957d61e0a68d45865754fbc8bcbb0c5eabe3d410ff6262ce26789cf4a3af696905f7b7908e523c97816
…SQLite with `DEBUG=1` 5fb8f0f depends: Do not override CFLAGS when building SQLite with DEBUG=1 (Hennadii Stepanov) 2b0dd88 depends: Ensure definitions are passed when building SQLite with DEBUG=1 (Hennadii Stepanov) Pull request description: The `--enable-debug` configure option for the SQLite package does two things: ```autoconf #----------------------------------------------------------------------- # --enable-debug # AC_ARG_ENABLE(debug, [AS_HELP_STRING( [--enable-debug], [build with debugging features enabled [default=no]])], [], []) AC_MSG_CHECKING([Build type]) if test x"$enable_debug" = "xyes"; then BUILD_CFLAGS="$BUILD_CFLAGS -DSQLITE_DEBUG -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE" CFLAGS="-g -O0" AC_MSG_RESULT([debug]) else AC_MSG_RESULT([release]) fi #----------------------------------------------------------------------- ``` It adds three preprocessor definitions and overrides `CFLAGS` with `"-g -O0"`. The latter breaks the user's ability to provide sanitizer and LTO flags. This PR might be especially useful for OSS-Fuzz where `DEBUG=1` has been used since google/oss-fuzz#10503. Also it makes a workaround for building SQLite for 32-bit unneeded. For details, please refer to https://github.com/hebasto/oss-fuzz/tree/240120-sqlite. Changes in bitcoin#29282 might not be strictly required now. However, I consider them an improvement. ACKs for top commit: fanquake: ACK 5fb8f0f - downstream is also green, so i'll fixup the PR there. Tree-SHA512: 8593d8a0237ebb270d5da763fb65ed642ab8ed0d44e57704a34154621f49e3d5c58b462cc0070251fa1ba556c58a3c7d3620530d6839dc6dc9e0887010330eca
The
--enable-debug
configure option for the SQLite package does two things:It adds three preprocessor definitions and overrides
CFLAGS
with"-g -O0"
. The latter breaks the user's ability to provide sanitizer and LTO flags.This PR might be especially useful for OSS-Fuzz where
DEBUG=1
has been used since google/oss-fuzz#10503.Also it makes a workaround for building SQLite for 32-bit unneeded. For details, please refer to https://github.com/hebasto/oss-fuzz/tree/240120-sqlite.
Changes in #29282 might not be strictly required now. However, I consider them an improvement.