diff --git a/scripts/setup_build_env.sh b/scripts/setup_build_env.sh index beb20605..d32d0fc2 100755 --- a/scripts/setup_build_env.sh +++ b/scripts/setup_build_env.sh @@ -36,8 +36,6 @@ function install_package_dependencies() log_error "Exiting: No supported package manager found. Contact support" exit 1 fi - go install google.golang.org/protobuf/cmd/protoc-gen-go@latest - go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest log_info "Finished: Successful OS packages installation." log_warning OS reboot is required for all of the changes to take place. return 0 @@ -58,7 +56,6 @@ function install_ubuntu_package_dependencies() curl \ dracut \ gcc-multilib \ - golang \ libbsd-dev \ libcap-ng-dev \ libelf-dev \ @@ -88,6 +85,7 @@ function install_ubuntu_package_dependencies() zlib1g-dev \ "${APT_LINUX_HEADERS}" \ "${APT_LINUX_MOD_EXTRA}" && \ + lib_build_and_install_golang && \ return 0 || return 1 } @@ -112,7 +110,6 @@ function install_yum_package_dependencies() git \ glibc-devel.i686 \ glibc-devel.x86_64 \ - golang \ gtest-devel \ intel-ipp-crypto-mb \ intel-ipsec-mb \ @@ -151,6 +148,7 @@ function install_yum_package_dependencies() lib_install_nasm_from_rpm && \ lib_build_and_install_libfdt && \ lib_build_and_install_jsonc && \ + lib_build_and_install_golang && \ return 0 || return 1 } @@ -196,6 +194,16 @@ function lib_build_and_install_jsonc() as_root make -j "${NPROC}" -C "${JSONC_DIR}/json-c-build" install } +# Get and install golang from source +function lib_build_and_install_golang() +{ + as_root wget_download_strip_unpack "https://go.dev/dl/go1.23.4.linux-amd64.tar.gz" "/usr/local/go/" + as_root ln -s /usr/local/go/bin/go /usr/bin/go + go version + go install google.golang.org/protobuf/cmd/protoc-gen-go@latest + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest +} + # Build the xdp-tools project with ebpf function lib_install_xdp_bpf_tools() {