Skip to content

Commit

Permalink
[GR-44216] Include native-image in GraalVM JDK.
Browse files Browse the repository at this point in the history
PullRequest: graal/13772
  • Loading branch information
fniephaus committed Feb 15, 2023
2 parents c3f369a + 82331c1 commit 886d817
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 95 deletions.
7 changes: 1 addition & 6 deletions docs/examples/java-kotlin-aot.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ This example demonstrates how to compile a Java and Kotlin application ahead-of-
```
Note that your paths are likely to be different depending on the download location.

3. [Install Native Image](../reference-manual/native-image/README.md/#install-native-image) by running.
```bash
gu install native-image
```

4. Then execute:
3. Then execute:
```shell
./build.sh
```
Expand Down
7 changes: 1 addition & 6 deletions docs/examples/native-image-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@ Here you will also find a more sophisticated example displaying GraalVM's abilit
```
Note that your paths are likely to be different depending on the download location.

3. Install [Native Image](../reference-manual/native-image/README.md/#install-native-image) support by running:
```bash
gu install native-image
```

4. Then execute:
3. Then execute:
```shell
./build.sh
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,7 @@ For more information on running polyglot applications, see [Polyglot Programming

## Native Image

With GraalVM you can compile Java bytecode into a platform-specific, self-contained, native executable to achieve faster startup and smaller footprint for your application.
The [Native Image](../../reference-manual/native-image/README.md) functionality is not available by default, but can be easily installed with the [GraalVM Updater](../../reference-manual/graalvm-updater.md) tool:
```shell
gu install native-image
```
With [Native Image](../../reference-manual/native-image/README.md) you can compile Java bytecode into a platform-specific, self-contained, native executable to achieve faster startup and smaller footprint for your application.

The `HelloWorld` example from above is used here to demonstrate how to generate a native executable:
```java
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/graalvm-community/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ To run GraalVM Community Edition based on OpenJDK 8u292 on a Windows platform, t
## Supported Functionalities

The GraalVM Community distribution for Windows platforms includes OpenJDK with the GraalVM compiler enabled, the [GraalVM Updater](../../reference-manual/graalvm-updater.md) tool to install additional functionalities and the developer tools (e.g., Chrome inspector based debugger, Profiler, etc.).
Currently, the GraalVM environment on Windows can be extended with [Native Image](../../reference-manual/native-image/README.md), [Java on Truffle](../../reference-manual/java-on-truffle/README.md), [LLVM runtime](../../reference-manual/llvm/README.md), WebAssembly, JavaScript and Node.js support.
Currently, the GraalVM environment on Windows can be extended with [Java on Truffle](../../reference-manual/java-on-truffle/README.md), [LLVM runtime](../../reference-manual/llvm/README.md), WebAssembly, JavaScript, and Node.js support.

## Prerequisites for Using Native Image on Windows
On Windows, Native Image requires Visual Studio and Microsoft Visual C++(MSVC).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,7 @@ More details can be found in the [WebAssembly reference manual](../../reference-

## Native Image

With GraalVM Enterprise you can compile Java bytecode into a platform-specific, self-contained, native executable to achieve faster startup and a smaller footprint for your application.

The [Native Image](../../reference-manual/native-image/README.md) functionality is not available by default, but can be easily installed with the [GraalVM Updater](../../reference-manual/graalvm-updater.md) tool:
```shell
gu install native-image
```
With [Native Image](../../reference-manual/native-image/README.md) Enterprise you can compile Java bytecode into a platform-specific, self-contained, native executable to achieve faster startup and a smaller footprint for your application.

The `HelloWorld` example from above is used here to demonstrate how to generate a native executable:
```java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Repeat the same for the `PATH` environment variable.
## Supported Functionalities

The GraalVM Enterprise distribution for Windows platforms includes Oracle JDK with the GraalVM compiler enabled, the [GraalVM Updater](../../reference-manual/graalvm-updater.md) tool to install additional functionalities and the developer tools (e.g., Chrome inspector based debugger, Profiler, etc.).
Currently, the GraalVM environment on Windows can be extended with [Native Image](../../reference-manual/native-image/README.md), [Java on Truffle](../../reference-manual/java-on-truffle/README.md), [LLVM runtime](../../reference-manual/llvm/README.md), WebAssembly, JavaScript and Node.js support.
Currently, the GraalVM environment on Windows can be extended with [Java on Truffle](../../reference-manual/java-on-truffle/README.md), [LLVM runtime](../../reference-manual/llvm/README.md), WebAssembly, JavaScript, and Node.js support.

## Prerequisites for Using Native Image on Windows
On Windows, Native Image requires Visual Studio and Microsoft Visual C++(MSVC).
Expand Down
2 changes: 1 addition & 1 deletion docs/graalvm-as-a-platform/implement-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For macOS, use:
export JAVA_HOME=/path/to/graalvm/Contents/Home
export PATH=/path/to/graalvm/Contents/Home/bin:$PATH
```
4. Execute `mvn package` from the SimpleLanguage folder to build the language. The command also builds a `slnative` executable in the `simplelanguage/native` directory and a `sl-component.jar` language component which later can be installed into GraalVM using the [GraalVM Updater](../reference-manual/graalvm-updater.md) tool. Please verify ithat the `native-image` plugin is available in your GraalVM distribution to avoid build failure:
4. Execute `mvn package` from the SimpleLanguage folder to build the language. The command also builds a `slnative` executable in the `simplelanguage/native` directory and a `sl-component.jar` language component which later can be installed into GraalVM using the [GraalVM Updater](../reference-manual/graalvm-updater.md) tool. Please verify that the `native-image` plugin is available in your GraalVM distribution to avoid build failure:
```shell
gu list
gu install native-image
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-manual/graalvm-updater.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Follow these steps to install a component to GraalVM Enterprise, for example, Na
2. Install a component using the `ComponentId` value:
```shell
gu install native-image
gu install nodejs
```
You will see a message to provide your valid email address or input your download token and press `ENTER`.
Supposedly, this is your first installation and you have not accepted the license yet. So press `ENTER`.
Expand Down
1 change: 0 additions & 1 deletion docs/reference-manual/java-on-truffle/Demos.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ This design naturally fits the point we are trying to illustrate. We can build a

Prerequisites:
* [Latest GraalVM](https://www.graalvm.org/downloads/)
* [Native Image](../native-image/README.md#install-native-image)
* [Java on Truffle](README.md#install-java-on-truffle)

1. Clone the [project](https://github.com/graalvm/graalvm-demos) with the demo applications and navigate to the `espresso-jshell` directory:
Expand Down
13 changes: 1 addition & 12 deletions docs/reference-manual/native-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,14 @@ To get used to Native Image terminology and get better understanding of the tech

### Table of Contents

* [Install Native Image](#install-native-image)
* [Build a Native Executable](#build-a-native-executable)
* [Configuring Native Image with Third-Party Libraries](#configuring-native-image-with-third-party-libraries)
* [License](#license)
* [Further Reading](#further-reading)

## Install Native Image

Native Image can be added to GraalVM with the [GraalVM Updater](../graalvm-updater.md) tool.

Run this command to install Native Image:
```shell
gu install native-image
```
The `native-image` tool is installed in the `$JAVA_HOME/bin` directory.

### Prerequisites

The `native-image` tool depends on the local toolchain (header files for the C library, `glibc-devel`, `zlib`, `gcc`, and/or `libstdc++-static`).
The `native-image` tool, available in the `bin` directory of your GraalVM installation, depends on the local toolchain (header files for the C library, `glibc-devel`, `zlib`, `gcc`, and/or `libstdc++-static`).
These dependencies can be installed (if not yet installed) using a package manager on your machine.
Choose your operating system to find instructions to meet the prerequisites.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This guide shows how you can take advantage of Native Image linking options incl
The following prerequisites should be met:

- Linux AMD64 operating system
- GraalVM distribution for Java 11 of higher with [Native Image support](../README.md#install-native-image)
- GraalVM distribution for Java 17 of higher
- A 64-bit `musl` toolchain, `make`, and `configure`
- The latest `zlib` library

Expand Down
2 changes: 0 additions & 2 deletions docs/reference-manual/native-image/guides/guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,3 @@ Here you will learn how to:
- <a href="https://quarkus.io/guides/building-native-image" target="_blank">Build a Native Executable from a Quarkus Application</a>
- <a href="https://helidon.io/docs/v3/#/mp/guides/graalnative" target="_blank">Build a Native Executable from a Helidon MP Application</a>
- <a href="https://helidon.io/docs/v3/#/se/guides/graalnative" target="_blank">Build a Native Executable from a Helidon SP Application</a>

> Note: To follow these guides, a user is expected to have [GraalVM installed with Native Image support](../README.md#install-native-image).
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ The goal is to show users the difference, and prove how using shared metadata ca

We recommend that you follow the instructions and create the application step-by-step. Alternatively, you can go right to the [completed example](https://github.com/graalvm/native-build-tools/tree/master/samples/metadata-repo-integration).

> You must have [GraalVM installed with Native Image support](../README.md#install-native-image).
## Prepare a Demo Application

1. Create a new Java project with **Gradle** in your favorite IDE, called "H2Example", in the `org.graalvm.example` package.
Expand Down
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This changelog summarizes major changes to GraalVM Native Image.
* (GR-43410) Added support for the JFR event `ExecutionSample`.
* (GR-44058) (GR-44087) Red Hat added support for the JFR events `ObjectAllocationInNewTLAB` and `JavaMonitorInflate`.
* (GR-42467) The search path for `System.loadLibrary()` by default includes the directory containing the native image.
* (GR-44216) Native Image is now shipped as part of the GraalVM JDK and thus no longer needs to be installed via `gu install native-image`.

## Version 22.3.0
* (GR-35721) Remove old build output style and the `-H:±BuildOutputUseNewStyle` option.
Expand Down
12 changes: 6 additions & 6 deletions substratevm/mx.substratevm/mx_substratevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ def native_image_context_run(func, func_args=None, config=None, build_if_missing
support_distributions=['substratevm:SVM_GRAALVM_SUPPORT'],
stability="earlyadopter",
jlink=False,
installable=True,
installable=False,
))

mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmLanguage(
Expand All @@ -932,7 +932,7 @@ def native_image_context_run(func, func_args=None, config=None, build_if_missing
truffle_jars=[],
builder_jar_distributions=['substratevm:SVM_LIBFFI'],
support_distributions=['substratevm:SVM_NFI_GRAALVM_SUPPORT'],
installable=True,
installable=False,
))

mx_sdk_vm.register_graalvm_component(mx_sdk_vm.GraalVmJreComponent(
Expand All @@ -944,7 +944,7 @@ def native_image_context_run(func, func_args=None, config=None, build_if_missing
license_files=[],
third_party_license_files=[],
support_distributions=['substratevm:SVM_STATIC_LIBRARIES_SUPPORT'],
installable=True,
installable=False,
))

def _native_image_launcher_main_class():
Expand Down Expand Up @@ -1023,7 +1023,7 @@ def _native_image_launcher_extra_jvm_args():
),
],
provided_executables=['bin/<cmd:rebuild-images>'],
installable=True,
installable=False,
stability="earlyadopter",
jlink=False,
))
Expand All @@ -1038,7 +1038,7 @@ def _native_image_launcher_extra_jvm_args():
third_party_license_files=[],
dependencies=[],
support_distributions=['substratevm:NATIVE_IMAGE_LICENSE_GRAALVM_SUPPORT'],
installable=True,
installable=False,
priority=1,
stability="earlyadopter",
jlink=False,
Expand Down Expand Up @@ -1223,7 +1223,7 @@ def _native_image_configure_extra_jvm_args():
],
jlink=False,
installable_id='native-image',
installable=True,
installable=False,
priority=10,
))

Expand Down
27 changes: 0 additions & 27 deletions vm/ce-release-artifacts.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,33 +169,6 @@
}
]
},
{
"name": "native-image-installable-svm-java19",
"core": false,
"jdk": "jdk_19",
"artifacts": [
{
"os": "linux",
"arch": "amd64"
},
{
"os": "linux",
"arch": "aarch64"
},
{
"os": "darwin",
"arch": "amd64"
},
{
"os": "darwin",
"arch": "aarch64"
},
{
"os": "windows",
"arch": "amd64"
}
]
},
{
"name": "native-image-llvm-backend-installable-ce-java19",
"core": false,
Expand Down
4 changes: 2 additions & 2 deletions vm/mx.vm/ce
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/tools,/truffle
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,poly,polynative,pro,rgx,sdk,tfl,tflm
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-ld,lib:jvmcicompiler
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,rgx,sdk,svm,svmnfi,svmsl,tfl,tflm
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image
DISABLE_INSTALLABLES=False
4 changes: 2 additions & 2 deletions vm/mx.vm/ce-aarch64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/tools,/truffle
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,poly,polynative,pro,rgx,sdk,tfl,tflm
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-ld,lib:jvmcicompiler
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,rgx,sdk,svm,svmnfi,svmsl,tfl,tflm
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image
DISABLE_INSTALLABLES=False
4 changes: 2 additions & 2 deletions vm/mx.vm/ce-darwin
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/tools,/truffle
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,poly,polynative,pro,rgx,sdk,tfl,tflm
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-ld,lib:jvmcicompiler
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,rgx,sdk,svm,svmnfi,svmsl,tfl,tflm
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image
DISABLE_INSTALLABLES=False
4 changes: 2 additions & 2 deletions vm/mx.vm/ce-darwin-aarch64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/tools,/truffle
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,poly,polynative,pro,rgx,sdk,tfl,tflm
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-ld,lib:jvmcicompiler
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,rgx,sdk,svm,svmnfi,svmsl,tfl,tflm
NATIVE_IMAGES=graalvm-native-binutil,graalvm-native-clang,graalvm-native-clang-cl,graalvm-native-clang++,graalvm-native-ld,lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image
DISABLE_INSTALLABLES=False
2 changes: 1 addition & 1 deletion vm/mx.vm/ce-fastr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/sulong,/tools,/truffle,fastr
COMPONENTS=R,cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,poly,polynative,pro,rgx,sdk,tfl,tflm
COMPONENTS=R,cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,llp,llrc,llrl,llrn,lsp,nfi-libffi,ni,nic,poly,polynative,pro,rgx,sdk,tfl,tflm
NATIVE_IMAGES=lib:jvmcicompiler
DISABLE_INSTALLABLES=False
4 changes: 2 additions & 2 deletions vm/mx.vm/ce-win
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DYNAMIC_IMPORTS=/compiler,/graal-js,/regex,/sdk,/substratevm,/tools,/truffle
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,poly,polynative,pro,rgx,sdk,tfl,tflm
NATIVE_IMAGES=lib:jvmcicompiler
COMPONENTS=cmp,cov,dap,gu,gvm,icu4j,ins,insight,insightheap,jss,lg,lsp,nfi-libffi,ni,nic,nil,poly,polynative,pro,rgx,sdk,svm,svmnfi,svmsl,tfl,tflm
NATIVE_IMAGES=lib:jvmcicompiler,lib:native-image-agent,lib:native-image-diagnostics-agent,native-image
DISABLE_INSTALLABLES=False
Loading

0 comments on commit 886d817

Please sign in to comment.