Skip to content

Conversation

tdrz
Copy link
Collaborator

@tdrz tdrz commented Sep 16, 2025

No description provided.

tdrz added 30 commits August 17, 2025 11:52
…ted from the *.o files of plpgsql + the already predefined ones;

-sDYLINK_DEBUG=2 flag is very useful in debugging emscripten's dynamic linking;

generating the EXPORTED_FUNCTIONS needs to be automated
automate creation of EXPORTED_FUNCTIONS emscripten parameter;
config.site Outdated
@@ -0,0 +1 @@
ac_cv_exeext=.cjs No newline at end of file
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this entire file can be removed, since we're passing it to configure in build-pglite.sh emconfigure ./configure ac_cv_exeext=.cjs

Comment on lines +489 to +490
// tdrz: I've commented this out!!!
// stdin = fdopen(saved_stdin, "r");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why was this even needed?

Comment on lines +6 to +7
CONTRIB_BUILD_ROOT := /tmp/extensions/build
ARCHIVE_DIR := /install/pglite/extensions
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hard coded final paths ... not great!


COPY ./extern .

# ENV EMCC_COMMON_FLAGS="-fPIC -sWASM_BIGINT -sMIN_SAFARI_VERSION=150000 -D__PYDK__=1 -O2 -m32 -D_FILE_OFFSET_BITS=64 -sSUPPORT_LONGJMP=emscripten -mno-bulk-memory -mnontrapping-fptoint -mno-reference-types -mno-sign-ext -mno-extended-const -mno-atomics -mno-tail-call -mno-multivalue -mno-relaxed-simd -mno-simd128 -mno-multimemory -mno-exception-handling -Wno-unused-command-line-argument -Wno-unreachable-code-fallthrough -Wno-unused-function -Wno-invalid-noreturn -Wno-declaration-after-statement -Wno-invalid-noreturn"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess I wanted to look more into each of these flags to see if it makes sense to add them to libs and/or pglite.

Comment on lines +109 to +121
$(CC) $(CFLAGS) $(LDFLAGS) -DPG_PREFIX=/tmp/pglite -DCMA_MB=12 -I$(top_builddir)/src/include -I$(top_builddir)/src/ -I$(top_builddir)/src/interfaces/libpq -o pglite.o -c $(top_builddir)/$(PGLITE_MAIN) -Wno-incompatible-pointer-types-discards-qualifiers
$(CC) \
$(PGLITE_CFLAGS) \
-fPIC -sWASM_BIGINT -sMIN_SAFARI_VERSION=150000 -D__PYDK__=1 -m32 -D_FILE_OFFSET_BITS=64 -sSUPPORT_LONGJMP=emscripten -mno-bulk-memory -mnontrapping-fptoint -mno-reference-types -mno-sign-ext -mno-extended-const -mno-atomics -mno-tail-call -mno-multivalue -mno-relaxed-simd -mno-simd128 -mno-multimemory -mno-exception-handling -Wno-unused-command-line-argument -Wno-unreachable-code-fallthrough -Wno-unused-function -Wno-invalid-noreturn -Wno-declaration-after-statement -Wno-invalid-noreturn \
-DPYDK=1 -DPG_PREFIX=/tmp/pglite -DCMA_MB=12 -o pglite.html --shell-file $(top_builddir)/pglite-wasm/repl.html \
$(PGPRELOAD) \
-sGLOBAL_BASE=12MB -ferror-limit=1 \
-sFORCE_FILESYSTEM=1 -sNO_EXIT_RUNTIME=1 -sENVIRONMENT=node,web,worker \
-sMAIN_MODULE=2 \
-sEXPORTED_FUNCTIONS=@$(emscripten_imports_dir)/exported_functions.txt \
-sMODULARIZE=1 -sEXPORT_ES6=1 -sEXPORT_NAME=Module \
-sALLOW_TABLE_GROWTH -sALLOW_MEMORY_GROWTH -sERROR_ON_UNDEFINED_SYMBOLS=0 \
-sEXPORTED_RUNTIME_METHODS=$(EXPORTED_RUNTIME_METHODS) \
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

emscripten specific flags should be moved out of Makefiles (if at all possible)

-lnodefs.js -lidbfs.js -lxml2 -lz
endif

ifeq ($(PORTNAME), wasi)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should probably cleanup WASI stuff.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is postgres.wasm target even needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A good candidate for refactoring/removal

@tdrz tdrz merged commit c026976 into REL_17_5_WASM-pglite-builder Sep 17, 2025
@tdrz tdrz deleted the tdrz/tryVanillaSdk branch September 17, 2025 13:46
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.

1 participant