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

Check on GLIBC requirements #219

Merged
merged 15 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from 13 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
11 changes: 9 additions & 2 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
check:
name: check
timeout-minutes: 90 # instead of 360 by default.
runs-on: ubuntu-20.04
runs-on: ubuntu-18.04
steps:
- name: Cancel when duplicated
uses: styfle/[email protected]
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
matrix:
os:
- "macos-11"
- "ubuntu-20.04"
- "ubuntu-18.04"
mode:
- "default"
# On CI, by default, we use libc++.
Expand Down Expand Up @@ -119,3 +119,10 @@ jobs:
if: runner.os == 'Linux' && matrix.mode == 'clang'
run: |
make requirestatic

# Upload the binary as an artifact.
- uses: actions/upload-artifact@v3
if: runner.os == 'Linux' && matrix.mode == 'clang'
with:
name: auth_server
path: bazel-bin/src/main/auth_server.stripped
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
matrix:
os:
- "macos-11"
- "ubuntu-20.04"
- "ubuntu-18.04"
mode:
- "default"
# By default we use libc++.
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:

release:
name: release
runs-on: ubuntu-20.04
runs-on: ubuntu-18.04
needs: dist
timeout-minutes: 90 # instead of 360 by default.
steps:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ endef

# Install clang from https://github.com/llvm/llvm-project. We don't support win32 yet as this script
# will fail.
clang-os = $(if $(findstring $(goos),darwin),apple-darwin,linux-gnu-ubuntu-20.04)
clang-os = $(if $(findstring $(goos),darwin),apple-darwin,linux-gnu-ubuntu-16.04)
dio marked this conversation as resolved.
Show resolved Hide resolved
clang-download-archive-url-prefix = https://$(subst llvmorg/clang+llvm@,releases/download/llvmorg-,$($(notdir $1)@v))
$(clang):
@mkdir -p $(dir $@)
Expand Down
2 changes: 1 addition & 1 deletion Tools.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bazelisk@v := github.com/bazelbuild/[email protected]
buildifier@v := github.com/bazelbuild/buildtools/buildifier@4.2.5
buildifier@v := github.com/bazelbuild/buildtools/buildifier@5.0.1
dio marked this conversation as resolved.
Show resolved Hide resolved
clang@v := github.com/llvm/llvm-project/llvmorg/[email protected]
clang-format@v := github.com/angular/[email protected]
envsubst@v := github.com/a8m/envsubst/cmd/[email protected]
Expand Down
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/istio-ecosystem/authservice

go 1.17

require github.com/hashicorp/go-version v1.4.0
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/hashicorp/go-version v1.4.0 h1:aAQzgqIrRKRa7w75CKpbBxYsmUoPjzVm1W59ca1L0J4=
github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
39 changes: 39 additions & 0 deletions test/exe/require_glibc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package main
dio marked this conversation as resolved.
Show resolved Hide resolved

import (
"bufio"
"bytes"
"log"
"os"
"os/exec"
"strings"

version "github.com/hashicorp/go-version"
)

func main() {
required, _ := version.NewVersion("2.27")
args := os.Args[1:]
cmd := exec.Command("objdump", "-T", args[0])
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
log.Fatal("failed to check GLIBC version:", err)
dio marked this conversation as resolved.
Show resolved Hide resolved
}
scanner := bufio.NewScanner(strings.NewReader(out.String()))
for scanner.Scan() {
entry := scanner.Text()
if strings.Contains(entry, "GLIBC_") {
line := bufio.NewScanner(strings.NewReader(entry[strings.Index(entry, "GLIBC_")+len("GLIBC_"):]))
line.Split(bufio.ScanWords)
for line.Scan() {
v, _ := version.NewVersion(line.Text())
dio marked this conversation as resolved.
Show resolved Hide resolved
if required.LessThan(v) {
log.Fatal("linked to a newer GLIBC: ", line.Text())
}
break
}
}
}
}
2 changes: 2 additions & 0 deletions test/exe/require_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ elif [[ "${DYNLIBS}" =~ libstdc\+\+ || "${DYNLIBS}" =~ libgcc ]]; then
echo "${DYNLIBS}"
exit 1
fi

go run test/exe/require_glibc.go $1