depends: Propagate native C compiler to `sqlite` package
What changed, and why it matters
This commit fixes a build-system issue in Bitcoin Core's dependency packaging for SQLite. It ensures the correct native C compiler is passed through when SQLite's build tool (autosetup) needs to compile a small local helper program called jimsh0. It also quotes that compiler variable so paths with spaces or multiple flags don't get split incorrectly. This is a build reliability fix, not a vulnerability in Bitcoin's network code or wallet cryptography.
Treat as a normal build-system fix. No urgent security response is warranted. Reviewers may want to verify the patch matches upstream autosetup PR #81 and that quoting CC_FOR_BUILD does not break non-Guix build environments.
Security signals we found
Build-system hardening: quoting of compiler variable prevents word-splitting
Supply-chain adjacent: affects dependency build configuration, not runtime
No direct memory safety, cryptographic, or network security signals present
Evidence from the diff
The change modifies depends/packages/sqlite.mk to set CC_FOR_BUILD to the build system’s native compiler and applies a patch to autosetup-find-tclsh that quotes ${CC_FOR_BUILD} in the shell loop. Without the quoting, a CC_FOR_BUILD value containing spaces (e.g., a compiler path plus -isystem flags, as seen in Guix) would be word-split, causing the bootstrap jimsh0 build to fail. The patch is a build-system hardening/reliability fix; it does not change runtime behavior, consensus code, or cryptographic handling.
Changed components
depends/packages/sqlite.mkdepends/patches/sqlite/autosetup-fixup.patchSQLite dependency build in Bitcoin Core's depends systemInspect captured patch +26 / −0
diff --git a/depends/packages/sqlite.mk b/depends/packages/sqlite.mk
index 7bb39b26..632ead74 100644
--- a/depends/packages/sqlite.mk
+++ b/depends/packages/sqlite.mk
@@ -3,8 +3,10 @@ $(package)_version=3500400
$(package)_download_path=https://sqlite.org/2025/
$(package)_file_name=sqlite-autoconf-$($(package)_version).tar.gz
$(package)_sha256_hash=a3db587a1b92ee5ddac2f66b3edb41b26f9c867275782d46c3a088977d6a5b18
+$(package)_patches = autosetup-fixup.patch
define $(package)_set_vars
+$(package)_config_env := CC_FOR_BUILD="$$(build_CC)"
$(package)_config_opts = --disable-shared --disable-readline --disable-rtree
$(package)_config_opts += --disable-fts4 --disable-fts5
$(package)_config_opts_debug += --debug
@@ -14,6 +16,10 @@ $(package)_cppflags += -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_PROGRESS_CALLBACK -D
$(package)_cppflags += -DSQLITE_OMIT_LOAD_EXTENSION
endef
+define $(package)_preprocess_cmds
+ patch -p1 < $($(package)_patch_dir)/autosetup-fixup.patch
+endef
+
# Remove --with-pic, which is applied globally to configure
# invocations but is incompatible with Autosetup
define $(package)_config_cmds
diff --git a/depends/patches/sqlite/autosetup-fixup.patch b/depends/patches/sqlite/autosetup-fixup.patch
new file mode 100644
index 00000000..46fe5fd9
--- /dev/null
+++ b/depends/patches/sqlite/autosetup-fixup.patch
@@ -0,0 +1,20 @@
+autosetup-find-tclsh: Quote CC_FOR_BUILD to prevent word splitting
+
+In some build environments, CC_FOR_BUILD can include essential compiler
+flags. For example, in Guix it may have a value such as:
+`/gnu/store/10krix03rl5hqjv2c0qmj44ic9bgd8rc-gcc-toolchain-13.3.0/bin/gcc -isystem /gnu/store/10krix03rl5hqjv2c0qmj44ic9bgd8rc-gcc-toolchain-13.3.0/include`
+
+See upstream: https://github.com/msteveb/autosetup/pull/81.
+
+
+--- a/autosetup/autosetup-find-tclsh
++++ b/autosetup/autosetup-find-tclsh
+@@ -8,7 +8,7 @@
+ { $tclsh "$d/${1-autosetup-test-tclsh}"; } 2>/dev/null && exit 0
+ done
+ echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
+-for cc in ${CC_FOR_BUILD:-cc} gcc; do
++for cc in "${CC_FOR_BUILD:-cc}" gcc; do
+ { $cc -o jimsh0 "$d/jimsh0.c"; } 2>/dev/null >/dev/null || continue
+ ./jimsh0 "$d/${1-autosetup-test-tclsh}" && exit 0
+ done
Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.