Rocky Linux 8.5にプログラム言語Nimをインストールする

1.OSバージョンの確認
# cat /etc/redhat-release
Rocky Linux release 8.5 (Green Obsidian)

2.依存パッケージgccをインストール
# sudo dnf install gcc
# gcc –version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)

3.nimをインストール

nimのホームページ https://nim-lang.org/

# curl https://nim-lang.org/choosenim/init.sh -sSf | sh
choosenim-init: Downloading choosenim-0.8.2_linux_amd64
    Prompt: Can choosenim record and send anonymised telemetry data? [y/n]
        ... Anonymous aggregate user analytics allow us to prioritise
        ... fixes and features based on how, where and when people use Nim.
        ... For more details see: https://goo.gl/NzUEPf.
    Answer: n
Downloading Nim 1.6.0 from nim-lang.org
[##################################################] 100.0% 0kb/s
 Extracting nim-1.6.0-linux_x64.tar.xz
 Extracting nim-1.6.0-linux_x64.tar
   Building Nim 1.6.0
  Compiler: Already built
  Installed component 'nim'
  Installed component 'nimble'
  Installed component 'nimgrep'
  Installed component 'nimpretty'
  Installed component 'nimsuggest'
  Installed component 'testament'
  Installed component 'nim-gdb'
   Switched to Nim 1.6.0
choosenim-init: ChooseNim installed in /root/.nimble/bin
choosenim-init: You must now ensure that the Nimble bin dir is in your PATH.
choosenim-init: Place the following line in the ~/.profile or ~/.bashrc file.
choosenim-init:     export PATH=/root/.nimble/bin:$PATH

4.環境PATHを設定します

# echo 'export PATH=$HOME/.nimble/bin:$PATH' >> ~/.bash_profile
# exec $SHELL -l

5.nimバージョンを確認します

# nim -v
Nim Compiler Version 1.6.0 [Linux: amd64]
Compiled at 2021-10-19
Copyright (c) 2006-2021 by Andreas Rumpf

git hash: 727c6378d2464090564dbcd9bc8b9ac648467e38
active boot switches: -d:release

6.動作確認
# mkdir -p /data
# cd /data
3 vi test.vim
以下の内容を編集します
echo “study skill hard become smart"

7.ファイルを実行
ファイルをコンパイルします

# nim c test.vim
Hint: used config file '/root/.choosenim/toolchains/nim-1.6.0/config/nim.cfg' [Conf]
Hint: used config file '/root/.choosenim/toolchains/nim-1.6.0/config/config.nims' [Conf]
.........................................................
Hint: gcc -c  -w -fmax-errors=3   -I/root/.choosenim/toolchains/nim-1.6.0/lib -I/data -o /root/.cache/nim/test_d/stdlib_digitsutils.nim.c.o /root/.cache/nim/test_d/stdlib_digitsutils.nim.c [Exec]
Hint: gcc -c  -w -fmax-errors=3   -I/root/.choosenim/toolchains/nim-1.6.0/lib -I/data -o /root/.cache/nim/test_d/stdlib_assertions.nim.c.o /root/.cache/nim/test_d/stdlib_assertions.nim.c [Exec]
Hint: gcc -c  -w -fmax-errors=3   -I/root/.choosenim/toolchains/nim-1.6.0/lib -I/data -o /root/.cache/nim/test_d/stdlib_dollars.nim.c.o /root/.cache/nim/test_d/stdlib_dollars.nim.c [Exec]
Hint: gcc -c  -w -fmax-errors=3   -I/root/.choosenim/toolchains/nim-1.6.0/lib -I/data -o /root/.cache/nim/test_d/stdlib_io.nim.c.o /root/.cache/nim/test_d/stdlib_io.nim.c [Exec]
Hint: gcc -c  -w -fmax-errors=3   -I/root/.choosenim/toolchains/nim-1.6.0/lib -I/data -o /root/.cache/nim/test_d/stdlib_system.nim.c.o /root/.cache/nim/test_d/stdlib_system.nim.c [Exec]
Hint: gcc -c  -w -fmax-errors=3   -I/root/.choosenim/toolchains/nim-1.6.0/lib -I/data -o /root/.cache/nim/test_d/@mtest.nim.c.o /root/.cache/nim/test_d/@mtest.nim.c [Exec]
Hint:  [Link]
Hint: gc: refc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
26565 lines; 1.733s; 31.539MiB peakmem; proj: /data/test.vim; out: /data/test [SuccessX]

ファイルを実行します
# ./test
study skill hard become smart

Rocky Linux 8

Posted by arkgame