Compile the module against the installed MEOS umbrella header - #12
Open
estebanzimanyi wants to merge 1 commit into
Open
Compile the module against the installed MEOS umbrella header#12estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
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.
estebanzimanyi
force-pushed
the
fix/compile-against-installed-meos-header
branch
from
August 15, 2026 15:52
3a39dc9 to
577284e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The C wrappers compile against an installed MEOS prefix rather than the MobilityDB source tree, which is the header MEOS actually publishes.
MEOS assembles the installed
<meos.h>: it splices its PostgreSQL-compat definitions into it under#ifndef POSTGRES_H, and that block suppliesDatum,DateADT,TimestampTz,Intervaland the de-prefixed base I/O —interval_in,date_in,timestamptz_inand siblings, named without ameos_prefix so they do not collide with a real PostgreSQL. None of it appears in the source copy, so calls to those functions are implicitly declared and C99 rejects them.<postgres.h>, which definesPOSTGRES_Hfirst and makes<meos.h>skip the entire spliced block, leaving evenDateADTundefined, and takes<string.h>directly rather than through it;USE_FLOAT8_BYVALonSIZEOF_VOID_P >= 8.That last point decides behaviour, not just compilation. With
-sMEMORY64=1aDatumis 8 bytes, so aTimestampTzor anint64span bound rides inside the Datum rather than behind a pointer. Reading one through a pointer returns whatever the value addresses, which makesBigIntSpan [1,5)and[6,10)report as adjacent. Keying on the width keeps both models correct.docker build --target wasmexits 0 with no errors.Under Node 24 the suite runs and fails 13 tests, the same 13 as a module built from the commit before this branch. Node 22 raises
CompileError: invalid table elements limits flagsbefore any test runs, since V8 12.4 does not accept the 64-bit tables-sMEMORY64=1emits and V8 13.6 does.