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(setup.sh): Enable LLVM tools installation on Ubuntu 24.04 #1781

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

navin772
Copy link
Member

Purpose of PR?:

Fixes #1755

LLVM tools are not installed successfully on Ubuntu 24.04 via sudo ./llvm.sh 14 because of no available release channel. They need to be installed via the llvm-14-tools package.

Does this PR introduce a breaking change?
No

If the changes in this PR are manually verified, list down the scenarios covered::

Additional information for reviewer? :
Mention if this PR is part of any design or a continuation of previous PRs

Checklist:

Copy link
Member

@kranurag7 kranurag7 left a comment

Choose a reason for hiding this comment

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

thank you, the patch w.r.t. the scope looks good to me.

can you also update the following:

  1. echo "Support Ubuntu 18.xx, 20.xx" (here 24.xx should be also included)
  2. the go download as of now doesn't take arch into account, when you run it on arm architecture (linux, arm64) then the script fails. Either terminate the script if arch is arm64 with a helpful error message or let's modify the script so that go download takes arch into account. To maintain the consistency of go version, we can consider using gotip https://github.com/golang/dl and this has to be done if go is already installed. If it's not installed then nothing needs to be done, download the latest stable go version.

@navin772
Copy link
Member Author

navin772 commented Jul 21, 2024

@kranurag7 regarding the 2 point, we need gotip in arm64 case only?
Can you test this on an arm machine:

# install golang
echo "Installing golang binaries..."
arch=$(uname -m)
if [ "$arch" == "aarch64" ]; then
    arch="arm64"
elif [ "$arch" == "x86_64" ]; then
    arch="amd64"
else
    echo "Unsupported architecture: $arch"
    exit 1
fi

if command -v go &>/dev/null; then
    if [ "$arch" == "arm64" ]; then
        echo "Go is already installed on ARM architecture, setting up gotip..."
        go install golang.org/dl/gotip@latest
        gotip download
        echo "export PATH=\$PATH:\$HOME/sdk/gotip/bin" >> ~/.bashrc
        echo "export GOTOOLDIR=\$HOME/sdk/gotip/pkg/tool/linux_arm64" >> ~/.bashrc
        source ~/.bashrc
    else
        echo "Go is already installed."
    fi
else
    goBinary=$(curl -s https://go.dev/dl/ | grep "linux-$arch" | grep -Eo 'go[0-9.]+\.linux-'$arch'\.tar\.gz' | head -n 1)
    wget --quiet https://dl.google.com/go/$goBinary -O /tmp/build/$goBinary
    sudo tar -C /usr/local -xzf /tmp/build/$goBinary
fi

I have changed how goBinary gets computed as the earlier approach didn't work in case of arm64

Also, shall I make a new PR for the 2nd point or update here only?

@kranurag7
Copy link
Member

When go is installed:

Details

# ./go.sh
+ echo 'Installing golang binaries...'
Installing golang binaries...
++ uname -m
+ arch=aarch64
+ '[' aarch64 == aarch64 ']'
+ arch=arm64
+ command -v go
+ '[' arm64 == arm64 ']'
+ echo 'Go is already installed on ARM architecture, setting up gotip...'
Go is already installed on ARM architecture, setting up gotip...
+ go install golang.org/dl/gotip@latest
go: downloading golang.org/dl v0.0.0-20240716205829-396652c1bbd0
+ gotip download
./go.sh: line 20: gotip: command not found
+ echo 'export PATH=$PATH:$HOME/sdk/gotip/bin'
+ echo 'export GOTOOLDIR=$HOME/sdk/gotip/pkg/tool/linux_arm64'
+ source /root/.bashrc
++ '[' -z '' ']'
++ return

When go is not installed:

Details

~ [2]# ./go.sh
+ echo 'Installing golang binaries...'
Installing golang binaries...
++ uname -m
+ arch=aarch64
+ '[' aarch64 == aarch64 ']'
+ arch=arm64
+ command -v go
++ curl -s https://go.dev/dl/
++ grep -Eo 'go[0-9.]+\.linux-arm64\.tar\.gz'
++ grep linux-arm64
++ head -n 1
+ goBinary=go1.22.5.linux-arm64.tar.gz
+ wget --quiet https://dl.google.com/go/go1.22.5.linux-arm64.tar.gz -O /tmp/build/go1.22.5.linux-arm64.tar.gz
/tmp/build/go1.22.5.linux-arm64.tar.gz: No such file or directory
+ sudo tar -C /usr/local -xzf /tmp/build/go1.22.5.linux-arm64.tar.gz
tar (child): /tmp/build/go1.22.5.linux-arm64.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

@navin772 I've not looked into the details here but this is the raw output, ping me if you need any help here.

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.

make run fails in Ubuntu 24.04
2 participants