Cross compile QuickJS interpreter & compiler statically. Resulting QuickJS compiler also generates static binaries based on musl libc Cross compil

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-10-11 19:30:05

Cross compile QuickJS interpreter & compiler statically. Resulting QuickJS compiler also generates static binaries based on musl libc

Cross compilation is performed using musl.cc static compilers (which means you should be able to generate a portable package of QuickJS from any recent x86_64 Linux distribution with gcc)

Starting from release 2020-11-08_2, any javascript file placed alongside qjs & qjsc binaries can be referenced relatively from your main script. This allows to bundle adhoc packages containing javascript modules (argument parsing, ...) which can be shared across various scripts

For a package containing an ext directory alongside qjs & qjsc binaries, file ext/myExt.js can be imported from any script using import * as myExt from 'ext/myExt.js';

Both interpreter & compiler will first try to resolve import relatively to current directory and fallback to the directory containing qjs & qjsc binaries (or the directory defined using QJS_LIB_DIR environment variable)

Leave a Comment