Building from Source
QuickJS uses CMake as its primary build system, with a convenient Makefile wrapper for Unix-like systems.Windows users need to run CMake commands manually. See the Windows build instructions below.
Prerequisites
1
Install build tools
2
Clone the repository
Standard Build
1
Build with Makefile (Linux/macOS)
The simplest way to build QuickJS:This creates:
build/qjs- The QuickJS interpreterbuild/qjsc- The QuickJS compilerbuild/libquickjs.a- Static library- Additional test tools
2
Install system-wide
/usr/local. To customize:Build Types
Debug Build
For development work with debug symbols and no optimizations:Release Build
Optimized build for production (default):Shared Library Build
Build QuickJS as a shared library:CMake Build Options
QuickJS supports several CMake options for customization:Example: Build with Options
Platform-Specific Builds
Windows
1
Generate Visual Studio project
2
Build the project
3
Run the binaries
MinGW on Windows
Cross-Compilation
For ARM or other architectures, use a CMake toolchain file:Amalgamated Build
The amalgamated build combines all QuickJS source files into a singlequickjs-amalgam.c file. This is ideal for embedding in projects without CMake.
1
Build QuickJS first
2
Generate amalgamated source
build/quickjs-amalgam.zip containing:quickjs-amalgam.cquickjs.hquickjs-libc.h
3
Use in your project
Testing
Run Test262 Suite
Test QuickJS against the official ECMAScript test suite:Update Test Results
After implementing new features, update the test results:Advanced Build Options
Parallel Builds
Speed up compilation by using multiple CPU cores:Custom Installation Prefix
Static REPL Executable
Build a fully staticqjs binary:
Build with mimalloc
Use the mimalloc allocator for better performance:Cleaning Build Artifacts
Verifying the Build
After building, verify everything works:1
Test the interpreter
2
Test the compiler
3
Check statistics
Troubleshooting
Build Fails with Missing Dependencies
Make sure you have all required tools:Linker Errors
Ensure you’re linking all required libraries:Permission Errors During Install
Usesudo for system-wide installation:
Next Steps
Quick Start
Start using your QuickJS build
API Reference
Learn the QuickJS C API
Examples
Explore code examples
Contributing
Contribute to QuickJS development