opencontainers / opencontainers/runc

Build does not produce statically linked binary anymore (on musl hosts)

Open
#3,950 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
13.5k
Forks
2.3k
Avg merge
2d 8h
Merged PRs (30d)
30

Description

Description

Calling make static is no longer producing a statically linked binary since release v1.1.8.
The produced binary is dynamically linked to musl libc.

Steps to reproduce the issue

Compile static runc v1.1.8 binary (on alpine:3.18 with Go 1.18):

  1. Install packages:
apk add --update --no-cache gcc musl-dev libseccomp-dev libseccomp-static make git bash
  1. Build runc:
git clone --branch v1.1.9 https://github.com/opencontainers/runc runc
cd runc
make static 'BUILDTAGS=seccomp selinux ambient'
  1. Inspect the produced binary:
$ ldd runc
/lib/ld-musl-x86_64.so.1 (0x7feebc024000)

With runc v1.1.7 this was producing a statically linked binary but stopped doing so with the v1.1.8 release.

Describe the results you received and expected

ldd runc should fail with /lib/ld-musl-x86_64.so.1: /usr/local/bin/runc: Not a valid dynamic program as it did with runc v1.1.7.

What version of runc are you using?

v1.1.8

Host OS information
$ cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.17.4
PRETTY_NAME="Alpine Linux v3.17"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
Host kernel information
$ uname -a
Linux 8860fbc8c11f 5.19.0-50-generic #50-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 10 18:24:29 UTC 2023 x86_64 Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the make static build and linker behavior between runc v1.1.7 and v1.1.8, using the reported Alpine environment and BUILDTAGS=seccomp selinux ambient. Run the reproduction commands and inspect the result with ldd. Done means make static again produces a binary that ldd reports as not dynamically linked.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.