You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note that some languages (e.g. Python, Ruby) need their language home directories to work without limitations.
392
392
If the polyglot application runs on a JVM (e.g. [here](#compile-and-run-a-polyglot-application)), the language homes are discovered automatically.
393
-
However, for native images, the language homes have to be specified. We are currently working on a feature that will enable the `native-image` builder to automatically bundle
394
-
the necessary language homes to the same directory as the produced executable/library. Until that feature is available, we recommend specifying
395
-
a GraalVM home at runtime using the option `-Dorg.graalvm.home=$GRAALVM_HOME`, assuming the environment variable `GRAALVM_HOME` is populated with an absolute path to a GraalVM home directory.
396
-
Language homes are automatically discovered in the specified directory. For example:
393
+
However, for native images, paths to language homes have to be stored in the image or specified at runtime.
394
+
395
+
By default, the `native-image` builder copies the necessary language homes to the `resources` directory located in the same directory as the produced image.
396
+
The paths to the copied homes are written to the image's build artifacts file and also stored in the image itself so that the homes are automatically discovered as long as their relative paths with respect to the image file stay the same.
397
+
That means that the `resources` directory should be always distributed together with the image file.
In case an installed GraalVM is available, it is possible to use language homes from the GraalVM home directory. A GraalVM home can be specified at runtime using the option `-Dorg.graalvm.home=$GRAALVM_HOME`, assuming the environment variable `GRAALVM_HOME` is populated with an absolute path to the GraalVM home directory.
405
+
Language homes are automatically discovered in the specified directory. For example:
406
+
407
+
```shell
400
408
./hellopolyglot -Dorg.graalvm.home=$GRAALVM_HOME
401
409
```
410
+
411
+
> Note: The `-Dorg.graalvm.home` option has precedence over any relative language home paths stored in the image.
412
+
402
413
> Note: The version of GraalVM the home of which is specified at runtime must match the version of GraalVM used to build the native executable/library.
Copy file name to clipboardExpand all lines: sdk/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ This changelog summarizes major changes between GraalVM SDK versions. The main f
8
8
* (GR-25849) (GR-41634) Added a new way to configure the IO access using the new class `IOAccess`. The IO access configuration determines how a guest language can access the host IO. The `IOAccess` class provides a predefined configuration to [disable](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/io/IOAccess.html#NONE) host IO access, or to [enable](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/io/IOAccess.html#ALL) full host IO access. A custom configuration can be created using an IOAccess [builder](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/io/IOAccess.html#newBuilder--).
9
9
* Deprecated `Context.Builder#allowIO(boolean)` To migrate, use `builder.allowIO(IOAccess.ALL)` to enable unrestricted IO operations on the host system, or `builder.allowIO(IOAccess.NONE)` to disable IO operations.
10
10
* Deprecated `Context.Builder#fileSystem(FileSystem)`. To migrate, use `builder.allowIO(IOAccess.newBuilder().fileSystem(fileSystem).build())`.
11
+
* Added automatic copying of language resources for embedding Truffle languages in native image. Documentation available [here](https://www.graalvm.org/reference-manual/embed-languages/#build-native-executables-from-polyglot-applications).
11
12
12
13
## Version 22.3.0
13
14
* (GR-39852) Native Image API: Added FieldValueTransformer API
:param support_distributions: distributions the contents of which is added to the language's home directory.
404
+
The contents of support distributions setting the `fileListPurpose` attribute to `native-image-resources` will end up as file list in the `native-image-resources.filelist` file in this language's home directory.
405
+
As a part of a native image build that includes this language, the files in the merged file list will be copied as resources to a directory named `resources` next to the produced image.
# A support distribution of a GraalVmLanguage component might have the `fileListPurpose` attribute with value 'native-image-resources' specifying that all the files from the distribution should
592
+
# be used as native image resources. Any value of the attribute other than 'native-image-resources' or None for a support distribution of a GraalVmLanguage is invalid. If the attribute is specified,
593
+
# there is a '<distribution archive file path>.filename' file containing a file list of all the files from the distribution. The support distributions specifying the attribute together specify
594
+
# a subset of files from this component's home directory. The file lists will be merged by the NativeImageResourcesFileList project into a single file `native-image-resources.filelist` that will be
595
+
# written into this component's home directory. As a part of a native image build that includes this component, the files in the merged file list will be copied as resources to a directory named
596
+
# `resources` next to the produced image. This impacts only the native images built by GraalVM that are not a part of the GraalVM itself.
mx.abort("Since distribution {} is a GraalVmLanguage support distribution, the only allowed value of its fileListPurpose attribute is 'native-image-resources', but was {}.".format(d.name, d.fileListPurpose))
0 commit comments