The VM suite allows you to build custom GraalVM distributions, as well as installable components. It defines a base GraalVM distribution that contains the JVMCI-enabled JDK, the GraalVM SDK, Truffle, and the GraalVM component installer. More components are added by dynamically importing additional suites. This can be done either by:
mx --dynamicimports <suite...> build
DEFAULT_DYNAMIC_IMPORTS
or DYNAMIC_IMPORTS
environment variables before running mx build
mx --env <env file> build
After the compilation:
latest_graalvm
symbolic link points to the latest built GraalVMmx [build-time arguments] graalvm-home
prints the path to the GraalVM home directoryNote that the build dependencies of each component are specified in the README file of the corresponding repository.
A common requirement is that the JAVA_HOME
environment variable must point to the latest JVMCI-enabled JDK8 (pre-built archives; build instructions).
In any of the build commands, replace build
with graalvm-show
:
$ mx ... graalvm-show
This will show a list of components, launchers and libraries to be built.
It is recommended to verify this output before running build
.
The base GraalVM CE image includes:
native-image
tool)substratevm
)graal-nodejs
)polyglot
launcherlibpolyglot
shared libraryIn our CI, we build it using:
JAVA_HOME
environment variable must point to it.gcc
: 4.9.2
make
: 3.83
cmake
: 3.15.2
Newer versions might also work. For more details, please check the README file of each component.
To start the build, you can either run:
$ mx --env ce build
Which uses the settings in the env file in mx.vm/ce
. Note that you can add custom env files to your mx.vm
directory, and call mx --env <env file name> build
.
$ mx --dynamicimports /substratevm,/tools,/sulong,/graal-nodejs --exclude-components=nju,nic,ni,nil,llp --force-bash-launchers=polyglot build
$ export DEFAULT_DYNAMIC_IMPORTS=/substratevm,/tools,/sulong,/graal-nodejs
$ export EXCLUDE_COMPONENTS=nju,nic,ni,nil,llp
$ export FORCE_BASH_LAUNCHERS=polyglot
$ mx build
or:
$ export DYNAMIC_IMPORTS=/substratevm,/tools,/sulong,/graal-nodejs
$ export EXCLUDE_COMPONENTS=nju,nic,ni,nil,llp
$ export FORCE_BASH_LAUNCHERS=polyglot
$ mx build
Note that the suites listed in:
DYNAMIC_IMPORTS
are always importedDEFAULT_DYNAMIC_IMPORTS
are imported only if no other dynamic import is specified (via command line, env file, or environment variable)Installable components for the Graal Updater (gu
) are built alongside the GraalVM for languages other than JS.
For example:
$ env FASTR_RELEASE=true mx --dynamicimports fastr,truffleruby,graalpython,/substratevm build
creates:
When substratevm
is imported, the build system creates native launchers for the supported languages and for polyglot
, plus the shared polyglot library (libpolyglot
).
Otherwise, it creates bash launchers for the languages and for polyglot
, and does not create the shared polyglot library.
To override the default behavior, the vm
suite defines the following mx
arguments:
--native-images=... Comma-separated list of launchers and libraries (syntax: lib:polyglot) to build with Native Image.
--disable-libpolyglot Disable the 'polyglot' library project
--disable-polyglot Disable the 'polyglot' launcher project
--force-bash-launchers=... Force the use of bash launchers instead of native images.
This can be a comma-separated list of disabled launchers or `true` to disable all native launchers.
And the following environment variables:
NATIVE_IMAGES Same as '--native-images'
DISABLE_LIBPOLYGLOT Same as '--disable-libpolyglot'
DISABLE_POLYGLOT Same as '--disable-polyglot'
FORCE_BASH_LAUNCHERS Same as '--force-bash-launchers'
Note that when the shared polyglot library is not built, Graal.nodejs can only work in JVM-mode (node --jvm [args]
).
$ mx --disable-polyglot --disable-libpolyglot --dynamicimports /substratevm,/tools,/sulong,/graal-js build
builds the native SubstrateVM launchers for native-image, Graal.js, and Sulong, but no polyglot launcher and polyglot library.
$ mx --force-bash-launchers=true --dynamicimports /substratevm,/tools,/sulong,/graal-nodejs build
builds the native SubstrateVM launcher for native-image, and creates bash launchers for Sulong, Graal.js, and polyglot
$ mx --dy truffleruby --components='TruffleRuby' build
$ mx --dy truffleruby,/substratevm,/tools --components='TruffleRuby,Native Image,suite:tools' --native-images=lib:rubyvm build
or as env file (e.g., in mx.vm/ruby
):
DYNAMIC_IMPORTS=truffleruby,/substratevm,/tools
COMPONENTS=TruffleRuby,Native Image,suite:tools
NATIVE_IMAGES=lib:rubyvm
$ mx --env ruby build
This also include all tools, which is of course optional.
Dynamic imports typically require the user to locate and clone the dynamically imported suites.
There is also no indication of which version of those suites would work.
To avoid this issue, the vm
suite uses "versioned dynamic imports".
The mx.vm/suite.py
file contains references to all the suites that might be imported to compose a GraalVM.
Unlike usual suite imports, they are marked as dynamic
, which means they are only considered if they are part of the dynamically imported suites.
However, when they are included, they have URLs and versions which allow mx to automatically clone the correct version.
More details can be found in docs/dynamic-imports.md
in the mx
repository.
$ mx --env ce sforceimports
$ mx --env ce build
Suites can register new, custom components callingmx_sdk.register_graalvm_component()
.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。