Skip to content

[codex] Hide vendored C symbols in NIF#11

Open
Valian wants to merge 1 commit intoelixir-volt:masterfrom
Valian:codex/hide-vendored-c-symbols
Open

[codex] Hide vendored C symbols in NIF#11
Valian wants to merge 1 commit intoelixir-volt:masterfrom
Valian:codex/hide-vendored-c-symbols

Conversation

@Valian
Copy link
Copy Markdown

@Valian Valian commented Apr 27, 2026

Summary

  • build vendored Lexbor, QuickJS, and WAMR C code with hidden default symbol visibility
  • stop patched QuickJS-NG headers from forcing default visibility unless QuickJS is explicitly built as a shared library/module
  • keep the intended NIF and N-API exports visible for BEAM loading and native addon support

Root Cause

On macOS ARM64, the precompiled QuickBEAM NIF exported vendored parser/runtime symbols such as Lexbor CSS selector symbols into the process. If QuickBEAM loaded before LazyHTML, LazyHTML could bind against QuickBEAM's already-loaded Lexbor symbols and its CSS selector parser failed permanently.

Fixes #10

Validation

  • git diff --check -- lib/quickbeam/native.ex priv/c_src/quickjs.h
  • rebuilt with QUICKBEAM_BUILD=1 mix compile --force
  • verified nm -gU no longer exposes lexbor_*, lxb_*, JS_*, js_*, wasm_*, or bh_* vendored C symbols
  • reproduced load order in a temporary project with QuickBEAM loaded before LazyHTML; LazyHTML.query("[class=x]") now returns one node
  • QUICKBEAM_BUILD=1 mix test test/quickbeam_test.exs

@Valian Valian marked this pull request as ready for review April 27, 2026 10:56
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.

NIF symbol collision: loading QuickBEAM.Native before LazyHTML breaks CSS selector parsing on macOS ARM64

1 participant