bnoordhuis / v8-cmake

The V8 JavaScript engine, but built with CMake instead of GN - WIP
BSD 3-Clause "New" or "Revised" License
189 stars 54 forks source link

V8 11.6 built on Alpine Linux: symbol not found #88

Open alexeyfadeev opened 2 months ago

alexeyfadeev commented 2 months ago

We use build of V8 (via v8-cmake) for building PLV8 (extension for PostgreSQL, V8 binary is linked on PLV8 building). After upgrade v8-cmake to V8 11.6 we faced with a problem: binaries are built well, but on running error message appeared:

_ZN2v88internal25IteratorBuiltinsAssembler18FastIterableToListENS0_5TNodeINS0_7ContextEEENS2_INS0_6ObjectEEEPNS0_8compiler18CodeAssemblerLabelE: symbol not found

Dockerfile reproduces the problem. Run PostgreSQL from this image: docker run -d --name plv8-test -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 --restart unless-stopped [image name] Connect using any PostgreSQL client and run the query: CREATE EXTENSION plv8; Command running returns error.

The problem appears only in Alpine Linux (with Debian PLV8 works fine). We temporarily added checkout to beb327f02f4a7e200b9ec to build Alpine-based PLV8 with V8 11.5 and the problem disappeared.

but we hope to find a solution with actual V8 version for Alpine.

bnoordhuis commented 2 months ago

That symbol comes from v8/src/builtins/builtins-iterator-gen.cc. Sounds like that file is not being picked up during linking.

plv8's Makefile links manually against the archive files (here) so it's probably an ordering issue.

builtins-iterator-gen.o belongs to libv8_base_without_compiler.a (and libv8_initializers.a, but that's only for mksnapshot). plv8 links it twice. Maybe that's the issue.


Link order problems are a category of bugs that should go away completely once #14 is fixed because then you only link to libv8_monolith.a.