Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Nim install error #161

Merged
merged 1 commit into from
Oct 3, 2021
Merged

Conversation

3socha
Copy link
Collaborator

@3socha 3socha commented Oct 3, 2021

現象

ビルドログ抜粋
#93 [nim-builder 1/2] RUN curl https://nim-lang.org/choosenim/init.sh -sSf >...
#93 16.44    Building Nim 1.4.8
#93 16.44   Compiler: Already built
#93 16.44      Tools: Already built
#93 16.55   Installed component 'nim'
#93 16.55   Installed component 'nimble'
#93 16.55   Installed component 'nimgrep'
#93 16.58   Installed component 'nimpretty'
#93 16.58   Installed component 'nimsuggest'
#93 16.58   Installed component 'testament'
#93 16.58   Installed component 'nim-gdb'
#93 16.58    Switched to Nim 1.4.8
#93 16.64 choosenim-init: ChooseNim installed in /root/.nimble/bin
#93 16.64 choosenim-init: You must now ensure that the Nimble bin dir is in your PATH.
#93 16.64 choosenim-init: Place the following line in the ~/.profile or ~/.bashrc file.
#93 16.64 choosenim-init:     export PATH=/root/.nimble/bin:$PATH
#93 16.64 init.sh: 90: SHELL: parameter not set
#93 ERROR: executor failed running [/bin/sh -c curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh     && sh init.sh -y     && choosenim update stable]: exit code: 2

要因

  • RUN curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh \
    && sh init.sh -y \
    && choosenim update stable
    で取得・実行している choosenim/init.sh で、未定義の変数 SHELL を参照してしまっている
    • sh init.sh -y でスクリプトを実行しているが、Ubuntu の sh (dash) は SHELL 変数をセットしない
    • スクリプトに set -u が設定されているためエラー終了している
  • Nimble bin path instruction for fish shell users dom96/choosenim#214 でだいぶ前に入った修正のようだが、最近 nim-lang.org に置かれているファイルが更新されたんだろうか、詳細は不明

対応

  • sh ではなく bash で実行すれば SHELL 変数が設定されるはず
  • ついでにちょっとだけリファクタする

@3socha 3socha requested a review from theoremoon October 3, 2021 15:31
Copy link
Owner

@theoremoon theoremoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

キャッチ素早い! たすかります 🤗

@theoremoon theoremoon merged commit ed8e8ec into theoremoon:master Oct 3, 2021
@3socha
Copy link
Collaborator Author

3socha commented Oct 4, 2021

修正した箇所は通るようになったが、choosenim 関連で別の問題が発生するようになった。
dom96/choosenim#272 で報告されているようなので、しばらく様子見したい。

@jiro4989
Copy link
Contributor

jiro4989 commented Oct 4, 2021

結局の所、choosenimをインストールするために使用している init.sh はプラットフォームを判定してインストールするべき choosenim のバイナリを切り替えているだけなので、

https://github.com/dom96/choosenim/blob/master/scripts/choosenim-unix-init.sh

すぐにビルドが通らないのを直す必要があるのでしたら、バグが含まれていない v0.7.4 の choosenim のバイナリをURL直指定でダウンロードしてNimをインストールするようにしたらおそらく直ると思います。

https://github.com/dom96/choosenim/releases/tag/v0.7.4

@jiro4989
Copy link
Contributor

jiro4989 commented Oct 5, 2021

choosenim直ったみたいです。今ならCIも通ると思います

@3socha
Copy link
Collaborator Author

3socha commented Oct 6, 2021

@jiro4989 ありがとうございます
定期ビルド#1250 が通ったのでヨシ!

@3socha 3socha deleted the fix-nim-install branch October 16, 2021 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants