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

silkworm: disable on incompatible Linux versions #8893

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ CGO_CFLAGS += -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-pro

# about netgo see: https://github.com/golang/go/issues/30310#issuecomment-471669125 and https://github.com/golang/go/issues/57757
BUILD_TAGS = nosqlite,noboltdb

ifneq ($(shell "$(CURDIR)/turbo/silkworm/silkworm_compat_check.sh"),)
BUILD_TAGS := "$(BUILD_TAGS),nosilkworm"
endif

PACKAGE = github.com/ledgerwatch/erigon

GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false
Expand Down
69 changes: 69 additions & 0 deletions turbo/silkworm/silkworm_compat_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

set -e
set -u
set -o pipefail

OS_RELEASE_PATH=/etc/os-release

function glibc_version {
cmd="ldd --version"
$cmd | head -1 | awk '{ print $NF }'
}

function version_major {
IFS='.' read -a components <<< "$1"
echo "${components[0]}"
}

function version_minor {
IFS='.' read -a components <<< "$1"
echo "${components[1]}"
}

case $(uname -s) in
Linux)
if [[ ! -f "$OS_RELEASE_PATH" ]]
then
echo "not supported Linux without $OS_RELEASE_PATH"
exit 2
fi

source "$OS_RELEASE_PATH"

if [[ -n "$ID" ]] && [[ -n "$VERSION_ID" ]]
then
version=$(version_major "$VERSION_ID")
case "$ID" in
"debian")
if (( version < 12 ))
then
echo "not supported Linux version: $ID $VERSION_ID"
exit 3
fi
;;
"ubuntu")
if (( version < 22 ))
then
echo "not supported Linux version: $ID $VERSION_ID"
exit 3
fi
;;
esac
fi

version=$(version_minor "$(glibc_version)")
if (( version < 34 ))
then
echo "not supported glibc version: $version"
exit 4
fi

;;
Darwin)
;;
*)
echo "unsupported OS"
exit 1
;;
esac
Loading