nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.55k stars 1.47k forks source link

install.sh fails to install on correct paths #23197

Open dkwolfe4 opened 9 months ago

dkwolfe4 commented 9 months ago

Description

choosenim doesn't not support Odroid N2_ SBC (arch: ARM 64) debian apt package is ancient at 1.0.xx

so, build v2.0.2 following instructions on https://nim-lang.org/install_unix.html

assumed that install.sh in nim folder would install him pieces in correct places... sh intall.sh /usr/bin

appears to install correctly but I get the following error when attempting to compile:

dietpi@DietPi:~$ nim c -d:ssl ./downloadAndParse.nim Error: cannot open '/usr/lib/nim/lib/system.nim'

Note extra lib in path... if I can find where it's pulling the path from, it I can probably fix it... however, the install.sh script doesn't seem to be the issue... where is this path being pulled from?

Nim Version

dietpi@DietPi:/usr/lib/nim$ nim -v Nim Compiler Version 2.0.2 [Linux: arm64] Compiled at 2024-01-11 Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release

Current Output

dietpi@DietPi:~$ nim c -d:ssl ./downloadAndParse.nim 
Error: cannot open '/usr/lib/nim/lib/system.nim'

Expected Output

No response

Possible Solution

bad path installed somewhere....

Additional Information

No response

dbrignoli commented 6 months ago

This is still an issue.

$ wget https://github.com/nim-lang/nightlies/releases/download/latest-devel/linux_arm64.tar.xz
$ xzcat /linux_arm64.tar.xz | tar x
$ cd nim-2.1.1
$ less install.sh

Relevant snippet from install.sh:

[...]
  case $1 in
    "--help"|"-h"|"help"|"h")
      echo "Nim installation script"
      echo "Usage: [sudo] [env DESTDIR=...] sh install.sh DIR"
      echo "Where DIR may be:"
      echo "  /usr/bin"
      echo "  /usr/local/bin"
      echo "  /opt"
      echo "  <some other dir> (treated similar to '/opt')"
      echo "To deinstall, use the command:"
      echo "sh deinstall.sh DIR"
      exit 1
      ;;
    "/usr/bin")
      bindir=$1
      configdir="/etc/nim"
      libdir="/usr/lib/nim"
      docdir="/usr/share/nim/doc"
      datadir="/usr/share/nim/data"
      nimbleDir="/opt/nimble/pkgs/nim-2.1.1"
      ;;
    "/usr/local/bin")
      bindir=$1
      configdir="/etc/nim"
      libdir="/usr/local/lib/nim"
      docdir="/usr/local/share/nim/doc"
      datadir="/usr/local/share/nim/data"
      nimbleDir="/opt/nimble/pkgs/nim-2.1.1"
      ;;
    "/opt")
      bindir="/opt/nim/bin"
      configdir="/opt/nim/config"
      libdir="/opt/nim/lib"
      docdir="/opt/nim/doc"
      datadir="/opt/nim/data"
      nimbleDir="/opt/nimble/pkgs/nim-2.1.1"
      ;;
    *)
      bindir="$1/nim/bin"
      configdir="$1/nim/config"
      libdir="$1/nim/lib"
      docdir="$1/nim/doc"
      datadir="$1/nim/data"
      nimbleDir="$1/nim"
      ;;
  esac
[...]

in case ./install.sh is executed with /usr/bin or /usr/local/bin, library files end up in /usr/lib/nim and /usr/local/lib/nim respectively but the nim compiler looks for them in /usr/lib/nim/lib and /usr/local/lib/nim/lib respectively which results in the issue reported above.

I currently work around it like so: cd /nim-2.1.1 && ./install.sh /usr/bin && ln -s /usr/lib/nim /usr/lib/nim/lib.