Currently, only Ubuntu 18.04+ is officially supported as primary development environment.
There are several dependencies, that should be installed manually. The following list is the absolute minimum for building:
gccor any C99-compliant compiler (native or cross, e.g., arm-none-eabi)cmake>=3.10
Several scripts and tools help the building and development process, thus it is recommended to have the following installed as well:
bash>=4.3.11cppcheck>=2.7clang-format-15python>=3.10
sudo apt-get install gcc gcc-arm-none-eabi cmake cppcheck clang-format-15 pythonTo make our scripts run correctly, several shell utilities should be available on the system:
awkbcfindsed
To build debug version for Linux
python tools/build.py --debugTo build debug version for Linux without LTO (Link Time Optimization)
python tools/build.py --debug --lto=offTo enable more verbose outputs for debugging
tools/build.py --debug --logging=on --error-messages=on --line-info=onAdd custom arguments to CMake
python tools/build.py --cmake-param=CMAKE_PARAMSet a profile mode (es.next, minimal)
python tools/build.py --profile=es.next|minimalSee also the related README.md.
Use (compiler-default, external) libc
The default libc is the compiler-default libc but you can use an external libc as well:
- compiler-default libc:
python tools/build.py- external libc:
python tools/build.py --compile-flag="-nostdlib -I/path/to/ext-libc/include" --link-lib="ext-c"Add toolchain file
The cmake dir already contains some usable toolchain files, which you can use in the following format:
python tools/build.py --toolchain=TOOLCHAINFor example the cross-compile to RaspberryPi 2 is something like this:
python tools/build.py --toolchain=cmake/toolchain_linux_armv7l.cmakeUse system memory allocator
python tools/build.py --system-allocator=onNote: System allocator is only supported on 32 bit systems.
Enable 32bit compressed pointers
python tools/build.py --cpointer-32bit=onNote: There is no compression/decompression on 32 bit systems, if enabled.
Change default heap size (512K)
python tools/build.py --mem-heap=256If you would like to use more than 512K, then you must enable the 32 bit compressed pointers.
python tools/build.py --cpointer-32bit=on --mem-heap=1024Note: The heap size will be allocated statically at compile time, when JerryScript memory allocator is used.
To build with libfuzzer support
CC=clang python tools/build.py --libfuzzer=on --compile-flag=-fsanitize=address --lto=offCheck the documentation of libfuzzer to get the runtime settings of the created fuzzer binary: https://llvm.org/docs/LibFuzzer.html.
To get a list of all the available buildoptions for Linux
python tools/build.py --helppython tools/run-tests.py --precommitTo run build option tests
python tools/run-tests.py --buildoption-testTo run unittests
python tools/run-tests.py --unittestsTo run jerry-tests
python tools/run-tests.py --jerry-testsTo run signed-off check
python tools/run-tests.py --check-signed-offTo run cppcheck
python tools/run-tests.py --check-cppcheckTo run format check
python tools/run-tests.py --check-formatTo get a list of all the available test options
python tools/run-tests.py --help