Subtleties Around Environment Variable JULIA_BINDIR

  1. The Running Configuration
    An LXC container instance based on Ubuntu 22.04 (Jammy) with Oh-my-zsh installed.
lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy
  1. To make Julia available globally, I extract the tar bar to directory /opt/.
sudo tar -xzf julia-1.8.1-linux-x86_64.tar.gz -C /opt/
  1. Edit my ~/.zshrc file to update the environment variable PATH.
    At first, I created the JULIA_HOME environment variable as I didn’t notice that JULIA_BINDIR is recommended by the Julia official website.
# The settings for Julia
export JULIA_HOME="/opt/julia-1.8.1"
export PATH="$JULIA_HOME/bin:$PATH"
#export JULIA_BINDIR="/opt/julia-1.8.1"
#export PATH="$JULIA_BINDIR/bin:$PATH"
export JULIA_PKG_SERVER="https://mirrors.bfsu.edu.cn/julia"
  1. Refresh the running configuration with the command source ~/.zshrc and then test Julia with the following commands without a hitch:
which julia
/opt/julia-1.8.1/bin/julia

julia --version
julia version 1.8.1

Function versioninfo() works well.

  1. As hinted in 3, after I change JULIA_HOME to JULIA_BINDIR, and, then, source ~/.zshrc, or logout and login to make the changes take effect, I get the following error:
┌─[ubuntu@mycontainer][~]
└─%source ~/.zshrc
┌─[ubuntu@mycontainer][~]
└─%which julia
/opt/julia-1.8.1/bin/julia
┌─[ubuntu@mycontainer][~]
└─%julia
ERROR: could not load library "/opt/julia-1.8.1/../lib/julia/sys.so"
/opt/julia-1.8.1/../lib/julia/sys.so: cannot open shared object file: No such file or directory
  1. Stefan Karpinski suggested using JULIA_BINDIR instead of JULIA_HOME. See rename JULIA_HOME?.

  2. I’ve tested this scenario on both Ubuntu 20.04 and 22.04. Whether on the LXC container version, the standalone version, or the desktop version, the same subtleties exist.

  3. After I changed the setting back to JULIA_HOME, the error disappears.