lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Valerio,

I use the Emscripten SDK and Conan to manage dependencies. With emsdk, I can perform cross-compiling for all dependencies and my project to WebAssembly. The same code, without any modifications, runs on macOS, Linux, Windows, and the web (Firefox and Chrome).

Best regards,


On 10 Nov 2023, at 12:39, Valerio Schiavoni <valerio.schiavoni@gmail.com> wrote:

Hello Rodrigo,
out of curiosity, how do you jump from Lua to WASM ?  Is it just transparently done by Firefox/Chrome ?

Cheers,
--
Valerio



On Fri, Nov 10, 2023 at 12:57 PM Rodrigo Delduca <rodrigodelduca@gmail.com> wrote:

Hello everyone,

I'm using Lua in a side project, and it works perfectly well on Linux, macOS, Windows, Chrome (WebAssembly), and Firefox (WebAssembly).

However, in Safari, after days of investigation, I discovered a memory alignment issue (stack below) that points to Lua. I want to mention beforehand that it may not be a problem with Lua; it could be the library I use to abstract the Lua API to C++ (sol2), or it might be, and probably is, an error on my part.

/Users/skhaz/.conan2/p/b/lua77b51c1b87f61/b/src/src/lstate.c:372:14: runtime error: member access within misaligned address 0x16b03c84 for type 'union GCUnion', which requires 8 byte alignment

0x16b03c84: note: pointer points here

be be be be be be be be 08 08 00 01 00 00 be be be be be be f8 3c b0 16 00 00 00 00 be be be be

[Error] SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Users/skhaz/.conan2/p/b/lua77b51c1b87f61/b/src/src/lstate.c:372:14 in put_char (carimbo.js:1:44818) write (carimbo.js:1:44031) write (carimbo.js:1:73767) doWritev (carimbo.js:1:242441) _fd_write (carimbo.js:1:242657) <?>.wasm-function[__sanitizer::internal_write(int, void const*, unsigned long)] <?>.wasm-function[__sanitizer::RawWrite(char const*)] <?>.wasm-function[__sanitizer::SharedPrintfCode(bool, char const*, void*)] <?>.wasm-function[__sanitizer::Printf(char const*, ...)] <?>.wasm-function[__sanitizer::ReportErrorSummary(char const*, char const*)] <?>.wasm-function[__sanitizer::ReportErrorSummary(char const*, __sanitizer::AddressInfo const&, char const*)] <?>.wasm-function[__ubsan::ScopedReport::~ScopedReport()] <?>.wasm-function[__ubsan_handle_type_mismatch_v1] <?>.wasm-function[lua_newstate] <?>.wasm-function[scriptengine::run()] <?>.wasm-function[application::run()] <?>.wasm-function[main] 16388 (anonymous function) (carimbo.js:1:15244) callMain (carimbo.js:1:292520) doRun (carimbo.js:1:293110) run (carimbo.js:1:293279) runCaller (carimbo.js:1:291977) removeRunDependency (carimbo.js:1:14487) receiveInstance (carimbo.js:1:20344) receiveInstantiationResult (carimbo.js:1:20657) (anonymous function) (carimbo.js:1:19571)

Lua version: 5.4.6 / sha256: 7d5ea1b9cb6aa0b59ca3dde1c6adcb57ef83a1ba8e5432c0ecd06bf439b3ad8 / https://www.lua.org/ftp/lua-5.4.6.tar.gz

Project source: https://github.com/carimbolabs/carimbo

Thank you.