Resolve a parallel build timing issue when building sqlite3.c/h from ext/wasm. For the time being, do not add sqlite3_wasm_extra_init.c to fiddle.wasm because it can cause duplicate definitions of extensions which are already built into the shell (a better resolution for this conflict is pending). No longer add sqlite3_wasm_extra_init.c to speedtest1.wasm because it's useless there.

FossilOrigin-Name: 75fdd5b83b4c527d25649b0d08841e3dc7d4d8109c1c97b2195b303538ced73d
This commit is contained in:
stephan 2023-03-02 06:58:55 +00:00
parent c3d84b4cbd
commit c355f6c839
4 changed files with 21 additions and 18 deletions

View File

@ -171,8 +171,10 @@ SQLITE_OPT = \
-DSQLITE_USE_URI=1 \
-DSQLITE_WASM_ENABLE_C_TESTS
$(sqlite3.c) $(sqlite3.h):
.NOTPARALLEL: $(sqlite3.h)
$(sqlite3.h):
$(MAKE) -C $(dir.top) sqlite3.c
$(sqlite3.c): $(sqlite3.h)
.PHONY: clean distclean
clean:
@ -212,9 +214,10 @@ endif
# See example_extra_init.c for an example implementation.
########################################################################
sqlite3_wasm_extra_init.c ?= $(wildcard sqlite3_wasm_extra_init.c)
cflags.wasm_extra_init :=
ifneq (,$(sqlite3_wasm_extra_init.c))
$(info Enabling SQLITE_EXTRA_INIT via $(sqlite3_wasm_extra_init.c).)
SQLITE_OPT += -I. -DSQLITE_WASM_EXTRA_INIT
cflags.wasm_extra_init := -DSQLITE_WASM_EXTRA_INIT
endif
# bin.version-info = binary to output various sqlite3 version info for
@ -684,7 +687,7 @@ $(4): $(3) $$(MAKEFILE) $$(sqlite3-wasm.cses) $$(EXPORTED_FUNCTIONS.api) $$(pre-
$$(emcc.bin) -o $$@ $$(emcc_opt_full) $$(emcc.flags) \
$$(emcc.jsflags) \
$$(pre-post-sqlite3.flags.$(1)) $$(emcc.flags.sqlite3.$(1)) \
$$(cflags.common) $$(SQLITE_OPT) $$(sqlite3-wasm.cses)
$$(cflags.common) $$(SQLITE_OPT) $$(cflags.wasm_extra_init) $$(sqlite3-wasm.cses)
@$$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,$(2))
@if [ bundler-friendly = $(1) ]; then \
echo "Patching $(3) for sqlite3.wasm..."; \
@ -727,11 +730,11 @@ $(eval $(call SETUP_LIB_BUILD_MODE,bundler-friendly,1,\
#
########################################################################
########################################################################
# We have to ensure that we do not build both $(sqlite3*.*js) in
# parallel because both result in the creation of $(sqlite3.wasm). We
# have no way to build just the .mjs file without also building the
# .wasm file because the generated .mjs file has to include info about
# the imports needed by the wasm file, so they have to be built
# We have to ensure that we do not build $(sqlite3*.*js) in parallel
# because they all result in the creation of $(sqlite3.wasm). We have
# no way to build just a .[m]js file without also building the .wasm
# file because the generated .[m]js file has to include info about the
# imports needed by the wasm file, so they have to be built
# together. i.e. we're building $(sqlite3.wasm) multiple times, but
# that's unavoidable (and harmless, just a waste of build time).
$(sqlite3.wasm): $(sqlite3.js)
@ -835,7 +838,7 @@ $(EXPORTED_FUNCTIONS.speedtest1): $(EXPORTED_FUNCTIONS.api)
speedtest1.js := $(dir.dout)/speedtest1.js
speedtest1.wasm := $(dir.dout)/speedtest1.wasm
cflags.speedtest1 := $(cflags.common) -DSQLITE_SPEEDTEST1_WASM
speedtest1.cses := $(speedtest1.c) $(sqlite3-wasm.cses)
speedtest1.cses := $(speedtest1.c) $(sqlite3-wasm.c)
$(eval $(call call-make-pre-post,speedtest1,vanilla))
$(speedtest1.js): $(MAKEFILE) $(speedtest1.cses) \
$(pre-post-speedtest1.deps.vanilla) \

View File

@ -52,7 +52,7 @@ $(EXPORTED_FUNCTIONS.fiddle): $(fiddle.EXPORTED_FUNCTIONS.in) $(MAKEFILE.fiddle)
fiddle-module.js := $(dir.fiddle)/fiddle-module.js
fiddle-module.wasm := $(subst .js,.wasm,$(fiddle-module.js))
fiddle.cses := $(dir.top)/shell.c $(sqlite3-wasm.cses)
fiddle.cses := $(dir.top)/shell.c $(sqlite3-wasm.c)
fiddle.SOAP.js := $(dir.fiddle)/$(notdir $(SOAP.js))
$(fiddle.SOAP.js): $(SOAP.js)

View File

@ -1,5 +1,5 @@
C Rename\ssome\svars\sin\sthe\sext/wasm\smakefiles\sfor\sconsistency's\ssake.
D 2023-03-02T05:51:03.913
C Resolve\sa\sparallel\sbuild\stiming\sissue\swhen\sbuilding\ssqlite3.c/h\sfrom\sext/wasm.\sFor\sthe\stime\sbeing,\sdo\snot\sadd\ssqlite3_wasm_extra_init.c\sto\sfiddle.wasm\sbecause\sit\scan\scause\sduplicate\sdefinitions\sof\sextensions\swhich\sare\salready\sbuilt\sinto\sthe\sshell\s(a\sbetter\sresolution\sfor\sthis\sconflict\sis\spending).\sNo\slonger\sadd\ssqlite3_wasm_extra_init.c\sto\sspeedtest1.wasm\sbecause\sit's\suseless\sthere.
D 2023-03-02T06:58:55.482
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -468,7 +468,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile d5f0eac7de53614381de422053e3fdb20d4315f7a821276359c26771ac0f8ea0
F ext/wasm/GNUmakefile 08fb7a6892acfe8801b547920edf3b914c7045a6bc8bfd4b46c0f2d6c0b6ecbc
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
@ -510,7 +510,7 @@ F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2
F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa
F ext/wasm/dist.make f55f9c9e1980ea11a59964e59535c66175a17f004d1c2e274522c3366b3a084a
F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f
F ext/wasm/fiddle.make 6f8bfd2e8c4f911b01a0edc26b4d7f6670253003a71b84d1f288482226dccbbd
F ext/wasm/fiddle.make dbe36b90b8907ae28ecb9c0e9fd8389dbdaecf117ea4fb2ea33864bdfa498a94
F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/wasm/fiddle/fiddle-worker.js 163d6139a93fab4bcb72064923df050d4e7c0ff0d8aa061ce8776a6e75da8a10
F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715
@ -2048,8 +2048,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 198b3e33dcfd74c7ba6abcf789ee81dfed464a50ebf15c8edeff349d36789fca
R d3512c3ac02aab42fe267e18e5b38131
P c23589d92cd16b67266d97f4a3d8c0991864dbea30ec074173e1a67466532d21
R 5ee5dda65b1a5bf82b60b07edf018dd9
U stephan
Z 8800c626ace8a11c90d3b1467c2d3267
Z a83a6cf6b033e8a3c3dc80f4ea680e3d
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
c23589d92cd16b67266d97f4a3d8c0991864dbea30ec074173e1a67466532d21
75fdd5b83b4c527d25649b0d08841e3dc7d4d8109c1c97b2195b303538ced73d