简体   繁体   中英

Can't install Graalvm native-image on ubuntu 20.04.3 LTS

I've just downloaded and installed graalvm-ce-java11-21.3.0. By default Native Image is not available, so I need to add it. So I ran this command,

gu install native-image

I got this error:

Downloading: Release index file from oca.opensource.oracle.com
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Downloading: Component native-image: Native Image  from github.com
Installing new component: Native Image (org.graalvm.native-image, version 21.3.0)
Installation of Native Image failed: /home/deehaz/Downloads/graalvm-ce-java11-21.3.0/lib/graal_isolate.h: Operation not permitted
I/O error occurred: /home/deehaz/Downloads/graalvm-ce-java11-21.3.0/lib/graal_isolate.h: Operation not permitted

Please, can anyone tell me how to solve this?

How to Install GraalVM Community Edition on Linux

Note: Tested on Ubuntu 20 only

  1. Download the new release of GraalVM and unpack it anywhere in your filesystem:
$wget https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-linux-amd64-22.0.0.2.tar.gz

$ tar -xvzf graalvm-ce-java11-linux-amd64-22.0.0.2.tar.gz
  1. Move the unpacked dir to /usr/lib/jvm/ and create a symbolic link to make your life easier when updating the GraalVM version:

if the jvm folder does not exist run the command

$ mkdir /usr/lib/jvm
$ mv graalvm-ce-java11-linux-amd64-22.0.0.2/ /usr/lib/jvm/
$ cd /usr/lib/jvm
$ ln -s graalvm-ce-java11-linux-amd64-22.0.0.2 graalvm
  1. Configure ~/.bashrce:
$vim ~/.bashrc

paste the content

#gralvm configuration
export PATH=/usr/lib/jvm/graalvm/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/graalvm/

reload the edited file

$ source ~/.bashrc
  1. Testing

To make sure everything is working fine, set the new JVM on your environment:

java -version

To verify, just check the version number:

openjdk version "11.0.14" 2022-01-18
OpenJDK Runtime Environment GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05)
OpenJDK 64-Bit Server VM GraalVM CE 22.0.0.2 (build 11.0.14+9-jvmci-22.0-b05, mixed mode, sharing)

And you're set.

  1. install native-image.
gu install native-image

hope i helped you..

It seems i accidentally downloaded and extracted GraalVM installation as root and then tried to install Native Image as normal user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM