From 3cd93a0b67ccd688864782c2a2148d987f1c3001 Mon Sep 17 00:00:00 2001 From: stephan Date: Tue, 19 Nov 2024 17:41:13 +0000 Subject: [PATCH] Revert linking the shell to the dll for reasons explained in new makefile comments. Move the --with-debug configure flag into the developer options set and add commentary about why it should never be used for production builds. FossilOrigin-Name: 7b14309be42be4204c4d30e9741d56d75ab8ec34686791d032612337fe1c4dcf --- auto.def | 9 +++++++-- autosetup/proj.tcl | 10 +++++----- main.mk | 44 ++++++++++++++++++++++---------------------- manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 43 insertions(+), 38 deletions(-) diff --git a/auto.def b/auto.def index 1e388ac20e..eee8c5aeff 100644 --- a/auto.def +++ b/auto.def @@ -123,7 +123,6 @@ set DUMP_DEFINES_JSON ""; #./config.defines.json ######################################################################## set flags { # - with-debug:=1 => {Enable debug build flags} shared=1 => {Disable build of shared libary} static=1 => {Disable build of static library (mostly)} amalgamation=1 => {Disable the amalgamation and instead build all files separately.} @@ -193,10 +192,16 @@ set flags { with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.} # # + + # --with-debug does more than simply builds with a -g compilation + # flag and will impact performance by as much as 4x, as it includes + # large numbers of assert()s in performance-critical loops. Never + # use --with-debug for production builds. + with-debug:=1 => {Enable debug build flags} + dev => {Enable dev-mode build: automatically enables certain other flags} test-status => {Enable status of tests} gcov=0 => {Enable coverage testing using gcov} linemacros => {Enable #line macros in the amalgamation} - dev => {Enable dev-mode build: automatically enables certain other flags} dump-defines=0 => {Dump autosetup defines to $DUMP_DEFINES_TXT (for build debugging)} link-tools-dynamically => {Dynamically link libsqlite3 to certain tools which normally statically embed it.} soname:=legacy => {SONAME for libsqlite3.so. Must be one of: none, auto, legacy} diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 863962c2f8..7da0b0fa35 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -311,11 +311,11 @@ proc proj-first-bin-of {args} { ######################################################################## # @proj-opt-was-provided key # -# Returns 1 if the user specifically provided the given configure -# flag, else 0. This can be used to distinguish between options which -# have a default value and those which were explicitly provided by the -# user, even if the latter is done in a way which uses the default -# value. +# Returns 1 if the user specifically provided the given configure flag +# or if it was specifically set using proj-opt-set, else 0. This can +# be used to distinguish between options which have a default value +# and those which were explicitly provided by the user, even if the +# latter is done in a way which uses the default value. # # For example, with a configure flag defined like: # diff --git a/main.mk b/main.mk index af616086be..3193e531d1 100644 --- a/main.mk +++ b/main.mk @@ -901,6 +901,9 @@ TESTOPTS = --verbose=file --output=test-out.txt # # Extra compiler options for various shell tools # +# Note that some of these will only apply when embedding sqlite3.c +# into the shell, as these flags are not otherwise passed on to the +# library. SHELL_OPT += -DSQLITE_DQS=0 SHELL_OPT += -DSQLITE_ENABLE_FTS4 #SHELL_OPT += -DSQLITE_ENABLE_FTS5 @@ -1926,30 +1929,27 @@ threadtest5: sqlite3.c $(TOP)/test/threadtest5.c $(T.link) $(TOP)/test/threadtest5.c sqlite3.c -o $@ $(LDFLAGS.libsqlite3) xbin: threadtest5 -# The standard CLI is built using the amalgamation since it uses -# special compile-time options that are interpreted by individual -# source files within the amalgamation. # -# How/whether we build sqlite3$(T.exe) depends on both -# $(HAVE_WASI_SDK) and $(LINK_TOOLS_DYNAMICALLY), thus there are -# several targets here, only one of which the sqlite3$(T.exe) target -# indirectly resolves to. +# When building sqlite3$(T.exe) we specifically embed a copy of +# sqlite3.c, and not link to libsqlite3.so or libsqlite3.a, because +# the shell needs to be able to enable arbitrary library features, +# some of which have significant performance impacts. For example,, +# SQLITE_ENABLE_EXPLAIN_COMMENTS has been measured as having a 5.2% +# runtime performance hit, which is fine for use in the shell but is +# not appropriate for the canonical library build. # -sqlite3-shell.0.0.deps = shell.c sqlite3.c -sqlite3-shell.0.0.rules = \ - $(T.link) -o $@ \ - shell.c sqlite3.c \ - $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ - $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) -sqlite3-shell.0.1.deps = shell.c $(libsqlite3.SO) -sqlite3-shell.0.1.rules = \ - $(T.link) -o $@ \ - shell.c -L. -lsqlite3 \ - $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ - $(LDFLAGS.configure) $(LDFLAGS.readline) $(LDFLAGS.zlib) -sqlite3$(T.exe): $(sqlite3-shell.$(HAVE_WASI_SDK).$(LINK_TOOLS_DYNAMICALLY).deps) - $(sqlite3-shell.$(HAVE_WASI_SDK).$(LINK_TOOLS_DYNAMICALLY).rules) -all: sqlite3$(T.exe) +sqlite3$(T.exe): shell.c sqlite3.c + $(T.link) -o $@ \ + shell.c sqlite3.c \ + $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ + $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) +# +# Build sqlite3$(T.exe) by default except in wasi-sdk builds. Yes, the +# semantics of 0 and 1 are confusingly swapped here. +# +sqlite3$(T.exe)-1: +sqlite3$(T.exe)-0: sqlite3$(T.exe) +all: sqlite3$(T.exe)-$(HAVE_WASI_SDK) # The "sqlite3d" CLI is build using separate source files. This # is useful during development and debugging. diff --git a/manifest b/manifest index 3cfb99819a..e7c415ad2b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reformulate\ssqldiff\sdeps\sand\srules\sso\sthat\sthe\starget\smatches\sthe\sresulting\sfile\sname,\sto\savoid\srebuilding\sit\son\severy\smake\sinvocation.\sApply\sthe\ssame\streatment\sto\sthe\ssqlite3\sCLI\sshell. -D 2024-11-19T16:40:49.154 +C Revert\slinking\sthe\sshell\sto\sthe\sdll\sfor\sreasons\sexplained\sin\snew\smakefile\scomments.\sMove\sthe\s--with-debug\sconfigure\sflag\sinto\sthe\sdeveloper\soptions\sset\sand\sadd\scommentary\sabout\swhy\sit\sshould\snever\sbe\sused\sfor\sproduction\sbuilds. +D 2024-11-19T17:41:13.115 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def b6fc55bf238320b58d06d6e5364374722aae3b8320c4f928e0e6c208405f2cfd +F auto.def 4f5ae3ed11bb110b1eda2a6b7ee46489b7371bc8f7c19f0ed944613c170e4951 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -49,7 +49,7 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c d40e381ea4526a067590e7b91bd4b2efa6d4980d286f908054c647b3df4aee14 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 96fe16b87c9feb9c1cf2682280f678c659bc52c09fca5de02afc2f7ec5bfb154 +F autosetup/proj.tcl 22556a325c964aa5377d4d881722385f41fcd7c1b60102ba8965f7814c83e9ce F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -696,7 +696,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 8ef1c08eb0e644df88978d2b1db4e2af9efc430a0fe3dd152d00fa21593fee41 +F main.mk 7cb02ba61e74ccab3ad6775b9207b12c6a26bbe3b2dd280039bc0cd532a52ceb F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2198,8 +2198,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9192c146e2898456a6b8ea43a6f02c0227ddce5b584374fbeb2d63bd2ecd5d8c -R 9e3125f578c182d0fd3f116bcadb353b +P 9a17b83f859ef14629cb78d8c9af1b3f2493b0c8756bc2ebcf92f0872fb507c3 +R 0effbfea81177717d860b06a74ce79d8 U stephan -Z c9c941efe50c477f477a1622a4a0493c +Z aa386346708361b0b61a6d6560bd2986 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5cd2262fb1..2cf57950de 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9a17b83f859ef14629cb78d8c9af1b3f2493b0c8756bc2ebcf92f0872fb507c3 +7b14309be42be4204c4d30e9741d56d75ab8ec34686791d032612337fe1c4dcf