Skip to content

Build the WebAssembly module in CI - #13

Open
estebanzimanyi wants to merge 2 commits into
MobilityDB:mainfrom
estebanzimanyi:ci/wasm-build-and-test
Open

Build the WebAssembly module in CI#13
estebanzimanyi wants to merge 2 commits into
MobilityDB:mainfrom
estebanzimanyi:ci/wasm-build-and-test

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

The branch carries the installed-header fix beneath it; the second commit is the one to review.

A job builds the WebAssembly module through the Dockerfile target, so the C wrappers are compiled on every push and pull request.

Regenerating and type-checking leaves those wrappers unbuilt: a wrapper calling a function no header declares passes both steps and fails only in the Docker emscripten build, which nothing runs.

The MobilityDB clone layer is excluded from the cache. It clones master, so a cached copy freezes MEOS at whatever commit first populated the cache and the job stops testing what it claims to. The dependency stages build pinned releases and cache safely, which is what keeps the job affordable.

The job stops at the build and runs no tests. Instantiating the module under Node raises CompileError: invalid table elements limits flags, which belongs to the -sMEMORY64=1 build rather than to anything the job compiles — a module built from the commit before this branch fails identically. A test step therefore reports that runtime gap as a build failure on every pull request, and closing the gap comes first.

The module compiled against MobilityDB's source tree, where meos.h is not the
header MEOS publishes. MEOS assembles the installed <meos.h>: it splices its
PostgreSQL-compat definitions into it under #ifndef POSTGRES_H, which supplies
Datum, DateADT, TimestampTz, Interval and the de-prefixed base I/O --
interval_in, date_in, timestamptz_in and their siblings, named without a meos_
prefix so they do not collide with a real PostgreSQL. None of that is in the
source copy, so calls to those functions were implicitly declared and C99
rejects them.

The build installs MEOS and compiles against that prefix. The preamble stops
including the vendored <postgres.h>, which defined POSTGRES_H first and made
<meos.h> skip the whole spliced block, and takes <string.h> directly rather
than through it.

The Datum accessors the spliced block leaves out are defined here, keyed on the
pointer width exactly as PostgreSQL keys USE_FLOAT8_BYVAL on SIZEOF_VOID_P >= 8.
With -sMEMORY64=1 a Datum is 8 bytes, so a TimestampTz or an int64 span bound
rides inside it rather than behind a pointer; reading one through a pointer
returns whatever the value addresses, which makes a bigint span report a
neighbour it does not touch as adjacent. Both widths stay correct.
The workflow regenerates and type-checks, which leaves the C wrappers unbuilt:
a wrapper calling a function no header declares passes both steps and fails
only in the Docker emscripten build nobody runs.

The job builds the module through that Dockerfile target. The MobilityDB clone
layer is excluded from the cache, since it clones master and a cached copy
would freeze MEOS at whatever commit first populated the cache; the dependency
stages build pinned releases and cache safely, which is what makes the job
affordable.
@estebanzimanyi
estebanzimanyi force-pushed the ci/wasm-build-and-test branch from 8368086 to 153b4dc Compare August 15, 2026 15:53
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