GraalVM Community Edition 19 をUbuntu Server 18.04にインストールする

GraalVM
https://www.graalvm.org/

以前Ubuntu 16.04にインストールしてみました。
GraalVMをUbuntu Server 16.04にインストールする

しばらく触っていなかったので、改めてUbuntu 18.04にインストールしてみます。



Install GraalVM



こちらを参考にインストールしていきます。
install-graalvm

ダウンロードサイトからCommunity Edition (CE)の「DOWNLOAD FROM GITHUB」をクリック。
https://www.graalvm.org/downloads/

986_01.png

githubのリリースページが表示されます。

986_02.png

Ubuntuにインストールするので「graalvm-ce-linux-amd64-19.0.0.tar.gz」をダウンロード。
解凍して適当なパスに移動します。
今回は「/opt/graalvm」に配置しました。


$ wget https://github.com/oracle/graal/releases/download/vm-19.0.0/graalvm-ce-linux-amd64-19.0.0.tar.gz
$ tar zxf graalvm-ce-linux-amd64-19.0.0.tar.gz
$ sudo mv ./graalvm-ce-19.0.0 /opt/graalvm



.bash_profileを作成し、パスを通します。


$ vi ~/.bash_profile



内容は以下の通り。


export PATH=/opt/graalvm/bin:$PATH



sourceで設定を反映。


$ source ~/.bash_profile



「gu」を実行すると、こんなヘルプが表示されました。


$ gu
GraalVM Component Updater v2.0.0

Usage:
    gu info [-clLprstuvV] <param>        prints info about specific component (from file, URL or catalog)
    gu available [-alvV] <expr>         lists components available in catalog
    gu install [-0cfiLnorvyxY] <param> installs a component package
    gu list [-clv] <expression>         lists installed components, or components from catalog
    gu remove [-0fxv] <id>             uninstalls a component
    gu update [-x] [<ver>] [<param>]     upgrades to recent GraalVM
    gu rebuild-images                    rebuilds native images. Use -h for detailed usage

Common options:
    --auto-yes
    -A     say YES or ACCEPT to all questions
    --catalog
    -c     treat parameters as component IDs from catalog of GraalVM components. This is the default.
    --local-file
    -L     treat parameters as local filenames of packaged components.
    --debug
    -d     debugging. Prints stacktraces, ...
    --help
    -h     print help.
    --no-progress
    -n     do not display download progress.
    --non-interactive
    -N     noninteractive mode. Fail when input is required.
    --url
    -u     interpret parameters as URLs of packaged components.
    --verbose
    -v     be verbose. Prints versions and dependency info.

Use
    gu <command> -h
to get specific help.





最初から使える機能



graalvmを設置した時点で、いくつかのプログラム言語は利用可能です。

・javascript

$ js --version
GraalVM JavaScript (GraalVM CE Native 19.0.0)



・node.js

$ node -v
v10.15.2



npmも使用できます。

$ npm -v
6.4.1



・java

$ java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-20190420092731.buildslave.jdk8u-src-tar--b03)
OpenJDK GraalVM CE 19.0.0 (build 25.212-b03-jvmci-19-b01, mixed mode)



・LLVM

$ lli --version
LLVM (GraalVM CE Native 19.0.0)






Running Ruby



guコマンドでRubyの実行環境を追加することが出来ます。


gu install [インストールする実行環境]



rubyの実行環境を追加してみます。


$ gu install ruby
Downloading: Component catalog from www.graalvm.org
Processing component archive: TruffleRuby
Downloading: Component ruby: TruffleRuby from github.com
Installing new component: TruffleRuby (org.graalvm.ruby, version 19.0.0)
IMPORTANT NOTE:
---------------
The Ruby openssl C extension needs to be recompiled on your system to work with the installed libssl.
First, make sure TruffleRuby's dependencies are installed, which are described at:
https://github.com/oracle/truffleruby/blob/master/README.md#dependencies
Then run the following command:
        /opt/graalvm/jre/languages/ruby/lib/truffle/post_install_hook.sh


IMPORTANT NOTE:
---------------
Set of GraalVM components that provide language implementations have changed. The Polyglot native image and polyglot native C library may be out of sync:
- new languages may not be accessible
- removed languages may cause the native binary to fail on missing resources or libraries.
To rebuild and refresh the native binaries, use the following command:
        /opt/graalvm/bin/gu rebuild-images

You may need to install "native-image" component which provide the rebuild tools.




Ruby 2.6.2相当のtrufflerubyがインストール出来ました。


$ ruby -v
truffleruby 19.0.0, like ruby 2.6.2, GraalVM CE Native [x86_64-linux]





Running R



R言語を追加してみます。


$ gu install R
Downloading: Component catalog from www.graalvm.org
Processing component archive: FastR
Downloading: Component R: FastR from github.com
Installing new component: FastR (org.graalvm.R, version 19.0.0)
NOTES:
---------------
The user specific library directory was not created automatically. You can either create the directory manually or edit file /opt/graalvm/jre/languages/R/etc/Renviron to change it to any desired location. Without user specific library directory, users will need write permission for the GraalVM home directory in order to install R packages.

Some R packages need a system-dependent configuration before they can be installed. A generic configuration that works out of the box in most cases is provided by default. If you wish to fine-tune the configuration to your system or should you encounter any issues during R package installation, try running the following script that adjusts the configuration to your system:
    /opt/graalvm/jre/languages/R/bin/configure_fastr

The R component comes without native image by default. If you wish to build the native image, which provides faster startup, but slightly slower peak performance, then run the following:
/opt/graalvm/jre/languages/R/bin/install_r_native_image

The native image is then used by default. Pass '--jvm' flag to the R or Rscript launcher to use JVM instead of the native image. Note that the native image is not stable yet and is intended for evaluation purposes and experiments. Some features may not work in the native image mode, most notably some Rcpp based packages. The native image can be uninstalled using the installation script with 'uninstall' argument.

See http://www.graalvm.org/docs/reference-manual/languages/r for more.




実行してみます。


$ R
R version 3.5.1 (FastR)
Copyright (c) 2013-19, Oracle and/or its affiliates
Copyright (c) 1995-2018, The R Core Team
Copyright (c) 2018 The R Foundation for Statistical Computing
Copyright (c) 2012-4 Purdue University
Copyright (c) 1997-2002, Makoto Matsumoto and Takuji Nishimura
All rights reserved.

FastR is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information.

Type 'q()' to quit R.
FastR unexpected failure: error loading libR from: /opt/graalvm/jre/languages/R/lib/libR.so.
If running on the NFI backend, did you provide the location of libtrufflenfi.so as the value of the system property 'truffle.nfi.library'?
The current value is 'null'.
Is the OpenMP runtime library (libgomp.so) present on your system? This library is, e.g., typically part of the GCC package.
Details: libgomp.so.1: 共有オブジェクトファイルを開けません: そのようなファイルやディレクトリはありません



libgomp.soがないというエラーになりました。
不足しているライブラリを追加します。


$ sudo apt install libgomp1



これで実行できました。


$ R
R version 3.5.1 (FastR)
Copyright (c) 2013-19, Oracle and/or its affiliates
Copyright (c) 1995-2018, The R Core Team
Copyright (c) 2018 The R Foundation for Statistical Computing
Copyright (c) 2012-4 Purdue University
Copyright (c) 1997-2002, Makoto Matsumoto and Takuji Nishimura
All rights reserved.

FastR is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information.

Type 'q()' to quit R.
>






Running Python 3



Pythonを追加してみます。


$ gu install python
Downloading: Component catalog from www.graalvm.org
Processing component archive: Graal.Python
Downloading: Component python: Graal.Python from github.com
Installing new component: Graal.Python (org.graalvm.python, version 19.0.0)

IMPORTANT NOTE:
---------------
Set of GraalVM components that provide language implementations have changed. The Polyglot native image and polyglot native C library may be out of sync:
- new languages may not be accessible
- removed languages may cause the native binary to fail on missing resources or libraries.
To rebuild and refresh the native binaries, use the following command:
        /opt/graalvm/bin/gu rebuild-images

You may need to install "native-image" component which provide the rebuild tools.



コマンドは「graalpython」となります。


$ graalpython --version
Python 3.7.0 (GraalVM CE Native 19.0.0)





guコマンド



「gu list」でインストール済のコンポーネント一覧が表示されます。


$ gu list
ComponentId             Version             Component name     Origin
--------------------------------------------------------------------------------
graalvm                 19.0.0             GraalVM Core        
R                        19.0.0             FastR             github.com
python                 19.0.0             Graal.Python        github.com
ruby                     19.0.0             TruffleRuby         github.com




「gu -c list」で利用可能なコンポーネントの一覧が表示されます。


$ gu -c list
Downloading: Component catalog from www.graalvm.org
ComponentId             Version             Component name     Origin
--------------------------------------------------------------------------------
native-image             19.0.0             Native Image        github.com
python                 19.0.0             Graal.Python        github.com
R                        19.0.0             FastR             github.com
ruby                     19.0.0             TruffleRuby         github.com



関連記事

コメント

非公開コメント

プロフィール

Author:symfo
blog形式だと探しにくいので、まとめサイト作成中です。
Symfoware まとめ

PR




検索フォーム

月別アーカイブ