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

Static build warning: Is the compiled binary truly statically linked? #7938

Open
xuegege5290 opened this issue Mar 27, 2024 · 5 comments
Open
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@xuegege5290
Copy link

What happened?

I want to compile cri-o into a statically linked binary, but there are some warnings. The resulting statically linked binary still depends on the glibc library on the host side.

When compiling a program or project into a statically linked binary, the goal is typically to include all dependencies within the binary itself, thereby eliminating the need for external dependencies on the host system. However, in my case, it appears that despite the attempt to build a statically linked binary, there are still dependencies on the glibc library from the host system.
the way use the nix build:

docker run --rm --privileged -ti -v /nix:/nix -v ${PWD}:${PWD} -w ${PWD} nixos/nix:2.3.16 nix --print-build-logs --option cores 8 --option max-jobs 8 build --file nix/

warning: dumping very large path (> 256 MiB); this may run out of memory
warning: unable to download 'https://cache.nixos.org/9fsaya64n0pv788a0lj30242sjb3hv9z.narinfo': SSL connect error (35); retrying in 334 ms
cri-o> unpacking sources
cri-o> unpacking source archive /nix/store/h9gjix9ppf1awnanfdh2qv874pqn69m9-cri-o
cri-o> source root is cri-o
cri-o> patching sources
cri-o> configuring
cri-o> building
cri-o> patching script interpreter paths in .
cri-o> ./contrib/kube-local/kube-local: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./contrib/kube-local/examples/script: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./contrib/bundle/vars: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./contrib/bundle/test-e2e: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./contrib/bundle/build: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./contrib/bundle/test: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./contrib/test/ci/sync_images.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./packaging/app/kylinv10/arm64/scripts/install.sh: interpreter directive changed from "#!/usr/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./packaging/app/cclinux220902/arm64/scripts/install.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./packaging/app/cclinux220902/x86_64/scripts/install.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/golang.org/x/sys/windows/mkknownfolderids.bash: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/golang.org/x/sys/windows/mkerrors.bash: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/golang.org/x/sys/unix/mkall.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/golang.org/x/sys/unix/mkerrors.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/golang.org/x/sys/plan9/mkall.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./vendor/golang.org/x/sys/plan9/mkerrors.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh: interpreter directive changed from "#! /bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/mvdan.cc/sh/v3/syntax/canonical.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/mvdan.cc/sh/v3/cmd/shfmt/docker-entrypoint.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./vendor/go.uber.org/zap/checklicense.sh: interpreter directive changed from "#!/bin/bash -e" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash -e"
cri-o> ./vendor/go.opentelemetry.io/otel/get_main_pkgs.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/go.opentelemetry.io/otel/verify_examples.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/google.golang.org/appengine/internal/regen.sh: interpreter directive changed from "#!/bin/bash -e" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash -e"
cri-o> ./vendor/google.golang.org/appengine/travis_install.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/google.golang.org/appengine/travis_test.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/google.golang.org/grpc/regenerate.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/google.golang.org/grpc/codegen.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/google.golang.org/grpc/vet.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/capnproto.org/go/capnp/v3/regen.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/go.etcd.io/etcd/v3/build.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/go.etcd.io/etcd/v3/build: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/go.etcd.io/etcd/v3/test.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/go.etcd.io/etcd/v3/test: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/ulikunitz/xz/make-docs: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./vendor/github.com/PaesslerAG/jsonpath/test.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/go-openapi/validate/update-fixtures.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/gobwas/glob/bench.sh: interpreter directive changed from "#! /bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/creack/pty/test_crosscompile.sh: interpreter directive changed from "#!/usr/bin/env sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./vendor/github.com/creack/pty/mktypes.bash: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/aws/aws-sdk-go-v2/local-mod-replace.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/containers/buildah/selinux_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/containers/buildah/release.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./vendor/github.com/containers/buildah/libdm_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/containers/buildah/btrfs_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/containers/buildah/btrfs_installed_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/modern-go/concurrent/test.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/rcrowley/go-metrics/validate.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/json-iterator/go/build.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/json-iterator/go/test.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/prometheus/procfs/ttar: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/pelletier/go-toml/v2/ci.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/pelletier/go-toml/benchmark.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/pelletier/go-toml/fuzz.sh: interpreter directive changed from "#! /bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./vendor/github.com/fullstorydev/grpcurl/mk-test-files.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/klauspost/compress/gen.sh: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./vendor/github.com/mattn/go-colorable/go.test.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/mattn/go-runewidth/go.test.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/mattn/go-shellwords/go.test.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/github.com/mattn/go-isatty/go.test.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/cloud.google.com/go/internal/version/update_version.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./vendor/cloud.google.com/go/storage/emulator_test.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./test/test_runner.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./test/cni_plugin_helper.bash: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./test/hooks/checkhook.sh: interpreter directive changed from "#!/usr/bin/env sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./test/helpers.bash: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./packaging_podman/app/kylinv10/arm64/scripts/install.sh: interpreter directive changed from "#!/usr/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./packaging_podman/app/cclinux220902/arm64/scripts/install.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./packaging_podman/app/cclinux220902/x86_64/scripts/install.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./.git/hooks/pre-merge-commit.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/pre-applypatch.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/update.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/prepare-commit-msg.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/pre-receive.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/push-to-checkout.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/pre-rebase.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/applypatch-msg.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/pre-push.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/commit-msg.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/pre-commit.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./.git/hooks/post-update.sample: interpreter directive changed from "#!/bin/sh" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/sh"
cri-o> ./hack/selinux_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/openpgp_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/log-capitalized.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/init.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/build/version.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/build/rpm.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/build/binaries.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/constants.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/util/find.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/util/environment.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/util/trap.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/util/ensure.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/util/text.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/util/misc.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/log/stacktrace.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/log/output.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/lib/log/system.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/tree_status.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/libdm_installed.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/libdm_no_deferred_remove_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/btrfs_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/btrfs_installed_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/build-rpms.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/seccomp_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/apparmor_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/libsubid_tag.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./hack/validate-config.sh: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./scripts/node_e2e_installer: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./scripts/sign-artifacts: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./scripts/upload-artifacts: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./scripts/versions: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./scripts/github-actions-setup: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./scripts/get: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> ./scripts/github-actions-packages: interpreter directive changed from "#!/usr/bin/env bash" to "/nix/store/s7r5cnjj4zy41g2nql3vf2ivr09wfm5p-bash-5.1-p16/bin/bash"
cri-o> mkdir -p "/tmp/nix-build-cri-o.drv-0/go/src/github.com/cri-o"
cri-o> ln -s "/tmp/nix-build-cri-o.drv-0/cri-o" "/tmp/nix-build-cri-o.drv-0/go/src/github.com/cri-o/cri-o"
cri-o> if [ ! -d "/tmp/nix-build-cri-o.drv-0/go" ]; then mkdir -p /tmp/nix-build-cri-o.drv-0/go; fi
cri-o> touch "/tmp/nix-build-cri-o.drv-0/go/.gopathok"
cri-o> go build  -trimpath  -ldflags '-s -w -X github.com/cri-o/cri-o/internal/pkg/criocli.DefaultsPath="" -X github.com/cri-o/cri-o/internal/version.buildDate='1980-01-01T00:00:00Z' -s -w -linkmode external -extldflags "-static -lm"' -tags "static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux" -o bin/crio github.com/cri-o/cri-o/cmd/crio
cri-o> # github.com/cri-o/cri-o/cmd/crio
cri-o> /nix/store/vzsqcldzq3y8cwj0mr8pbc6x9w1jmfj1-binutils-2.38/bin/ld: /tmp/nix-build-cri-o.drv-0/go-link-3909878823/000038.o: in function `New':
cri-o> /_/github.com/miekg/pkcs11@v1.1.1/tmp/nix-build-cri-o.drv-0/cri-o/vendor/github.com/miekg/pkcs11/pkcs11.go:77: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cri-o> /nix/store/vzsqcldzq3y8cwj0mr8pbc6x9w1jmfj1-binutils-2.38/bin/ld: /nix/store/kgjz89nm2n833nh7ni2gq7g1wz57dz8v-libgpg-error-1.42/lib/libgpg-error.a(libgpg_error_la-sysutils.o): in function `_gpgrt_getpwdir':
cri-o> (.text+0x2da): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cri-o> /nix/store/vzsqcldzq3y8cwj0mr8pbc6x9w1jmfj1-binutils-2.38/bin/ld: (.text+0x2f8): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cri-o> go build  -trimpath  -ldflags '-s -w -X github.com/cri-o/cri-o/internal/pkg/criocli.DefaultsPath="" -X github.com/cri-o/cri-o/internal/version.buildDate='1980-01-01T00:00:00Z' -s -w -linkmode external -extldflags "-static -lm"' -tags "static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper seccomp apparmor selinux" -o bin/crio-status github.com/cri-o/cri-o/cmd/crio-status
cri-o> # github.com/cri-o/cri-o/cmd/crio-status
cri-o> /nix/store/vzsqcldzq3y8cwj0mr8pbc6x9w1jmfj1-binutils-2.38/bin/ld: /tmp/nix-build-cri-o.drv-0/go-link-2285884561/000035.o: in function `New':
cri-o> /_/github.com/miekg/pkcs11@v1.1.1/tmp/nix-build-cri-o.drv-0/cri-o/vendor/github.com/miekg/pkcs11/pkcs11.go:77: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cri-o> /nix/store/vzsqcldzq3y8cwj0mr8pbc6x9w1jmfj1-binutils-2.38/bin/ld: /nix/store/kgjz89nm2n833nh7ni2gq7g1wz57dz8v-libgpg-error-1.42/lib/libgpg-error.a(libgpg_error_la-sysutils.o): in function `_gpgrt_getpwdir':
cri-o> (.text+0x2da): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cri-o> /nix/store/vzsqcldzq3y8cwj0mr8pbc6x9w1jmfj1-binutils-2.38/bin/ld: (.text+0x2f8): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
cri-o> make -C pinns
cri-o> make[1]: Entering directory '/tmp/nix-build-cri-o.drv-0/cri-o/pinns'
cri-o> gcc -static -pthread -O3 -o src/pinns.o -c src/pinns.c
cri-o> gcc -static -pthread -O3 -o src/sysctl.o -c src/sysctl.c
cri-o> gcc -o ../bin/pinns src/pinns.o src/sysctl.o -static -pthread -s -w -static-libgcc -static
cri-o> strip -s ../bin/pinns
cri-o> make[1]: Leaving directory '/tmp/nix-build-cri-o.drv-0/cri-o/pinns'
cri-o> buildPhase completed in 2 minutes 9 seconds
cri-o> glibPreInstallPhase
cri-o> installing
cri-o> glibPreFixupPhase
cri-o> post-installation fixup
cri-o> shrinking RPATHs of ELF executables and libraries in /nix/store/9fsaya64n0pv788a0lj30242sjb3hv9z-cri-o
cri-o> shrinking /nix/store/9fsaya64n0pv788a0lj30242sjb3hv9z-cri-o/bin/crio
cri-o> patchelf: cannot find section '.dynamic'. The input file is most likely statically linked
cri-o> shrinking /nix/store/9fsaya64n0pv788a0lj30242sjb3hv9z-cri-o/bin/pinns
cri-o> patchelf: cannot find section '.dynamic'. The input file is most likely statically linked
cri-o> shrinking /nix/store/9fsaya64n0pv788a0lj30242sjb3hv9z-cri-o/bin/crio-status
cri-o> patchelf: cannot find section '.dynamic'. The input file is most likely statically linked
cri-o> strip is /nix/store/k0np19xv7wjc1grhrb2y6r85qiv1cikd-gcc-wrapper-11.2.0/bin/strip
cri-o> stripping (with command strip and flags -S) in /nix/store/9fsaya64n0pv788a0lj30242sjb3hv9z-cri-o/bin
cri-o> patching script interpreter paths in /nix/store/9fsaya64n0pv788a0lj30242sjb3hv9z-cri-o
cri-o> checking for references to /tmp/nix-build-cri-o.drv-0/ in /nix/store/9fsaya64n0pv788a0lj30242sjb3hv9z-cri-o...
cri-o> patchelf: cannot find section '.dynamic'. The input file is most likely statically linked
cri-o> patchelf: cannot find section '.dynamic'. The input file is most likely statically linked
cri-o> patchelf: cannot find section '.dynamic'. The input file is most likely statically linked
[1 built, 0.0 MiB DL]

the warning like below:

warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

i try to build by myself,it still has the warning:

root@syx:~/go/cri-o# make BUILDTAGS="osusergo netgo exclude_graphdriver_devicemapper"
if [ ! -d "/root/go" ]; then mkdir -p /root/go; fi
touch "/root/go/.gopathok"
go build  -trimpath  -ldflags '-s -w -X github.com/cri-o/cri-o/internal/pkg/criocli.DefaultsPath="" -X github.com/cri-o/cri-o/internal/version.buildDate='2024-03-27T08:06:09Z'  -linkmode exte
rnal -extldflags -static' -tags "osusergo netgo exclude_graphdriver_devicemapper" -o bin/crio github.com/cri-o/cri-o/cmd/crio
# github.com/cri-o/cri-o/cmd/crio
/usr/bin/ld: /tmp/go-link-4099155275/000038.o: in function `New':
/_/github.com/miekg/pkcs11@v1.1.1/root/go/cri-o/vendor/github.com/miekg/pkcs11/pkcs11.go:77: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
go build  -trimpath  -ldflags '-s -w -X github.com/cri-o/cri-o/internal/pkg/criocli.DefaultsPath="" -X github.com/cri-o/cri-o/internal/version.buildDate='2024-03-27T08:06:17Z'  -linkmode exte
rnal -extldflags -static' -tags "osusergo netgo exclude_graphdriver_devicemapper" -o bin/crio-status github.com/cri-o/cri-o/cmd/crio-status
# github.com/cri-o/cri-o/cmd/crio-status
/usr/bin/ld: /tmp/go-link-158303994/000035.o: in function `New':
/_/github.com/miekg/pkcs11@v1.1.1/root/go/cri-o/vendor/github.com/miekg/pkcs11/pkcs11.go:77: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking

warning:

/_/github.com/miekg/pkcs11@v1.1.1/root/go/cri-o/vendor/github.com/miekg/pkcs11/pkcs11.go:77: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries

What did you expect to happen?

Is there a way to eliminate these warnings, and if a statically compiled binary has these warnings, it is not truly statically linked, right?

How can we reproduce it (as minimally and precisely as possible)?

The issue can be reproduced in any environment.

Anything else we need to know?

the moby project long before has the problem ,bu it can choose to ignore
https://github.com/moby/moby/blob/ceb9e244d934d87104b7e4e0032f1d389e47fd64/hack/make/.binary#L30

CRI-O and Kubernetes version

$ crio --version
# paste output here
$ kubectl version --output=json
# paste output here
```bash root@syx:~/go/cri-o# git branch main * release-1.25 ```

OS version

root@syx:~/go/cri-o# uname -a
Linux syx 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
root@syx:~/go/cri-o# cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Additional environment details (AWS, VirtualBox, physical, etc.)

@xuegege5290 xuegege5290 added the kind/bug Categorizes issue or PR as related to a bug. label Mar 27, 2024
@xuegege5290 xuegege5290 changed the title Static compilation warning: Is the compiled binary truly statically linked? Static build warning: Is the compiled binary truly statically linked? Mar 27, 2024
@saschagrunert
Copy link
Member

@xuegege5290 you're right. We require a runtime glibc because of some cgo related dependencies. Alternatively we could build using musl libc, but that's something we decided against a few years ago.

@xuegege5290
Copy link
Author

@xuegege5290 you're right. We require a runtime glibc because of some cgo related dependencies. Alternatively we could build using musl libc, but that's something we decided against a few years ago.
Have you considered adding a removable module similar to Moby to eliminate the dependency on the pkcs11 library in the statically linked binary of cri-o? PKCS11 is an encryption module, and it seems that they no longer reference the Go pkcs11 library. I also attempted to compile it with musl, but without success.

@xuegege5290
Copy link
Author

@xuegege5290 you're right. We require a runtime glibc because of some cgo related dependencies. Alternatively we could build using musl libc, but that's something we decided against a few years ago.

Can you please provide detailed information on the discussion about compiling with musl-libc? I still want to give it a try.

@saschagrunert
Copy link
Member

@xuegege5290 you're right. We require a runtime glibc because of some cgo related dependencies. Alternatively we could build using musl libc, but that's something we decided against a few years ago.

Can you please provide detailed information on the discussion about compiling with musl-libc? I still want to give it a try.

Unfortunately not, but you can try it by using the nix musl cross compilation like:

rec {
  pkgs = (import <nixpkgs> {}).pkgsMusl;
  # ...
}

Copy link

A friendly reminder that this issue had no activity for 30 days.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

2 participants