Skip to content

Dockerfile: build runc 1.5 with libpathrs#6908

Draft
AkihiroSuda wants to merge 1 commit into
moby:masterfrom
AkihiroSuda:runc-1.5
Draft

Dockerfile: build runc 1.5 with libpathrs#6908
AkihiroSuda wants to merge 1 commit into
moby:masterfrom
AkihiroSuda:runc-1.5

Conversation

@AkihiroSuda

Copy link
Copy Markdown
Member

runc 1.5 depends on libpathrs, so build and install it before compiling runc statically. This requires several adjustments for cross-compilation:

  • Install cargo/rust for the build (native) arch via apk; only the target libraries go through xx-apk, otherwise the toolchain cannot run.
  • Pass --rust-target to install.sh, since xx-cargo builds into target//release rather than target/release.
  • Install into the xx sysroot (DESTDIR) so xx's cross pkg-config finds pathrs.pc, and --disable-dynamic since the static build only needs the .a (Alpine's BusyBox install also lacks the -T flag used for the .so).
  • Work around a go-pathrs build failure under clang's cgo by rewriting the PATHRS_PROC_* int64 temporaries to uint64.

runc 1.5 depends on libpathrs, so build and install it before compiling
runc statically. This requires several adjustments for cross-compilation:

- Install cargo/rust for the build (native) arch via apk; only the target
  libraries go through xx-apk, otherwise the toolchain cannot run.
- Pass --rust-target to install.sh, since xx-cargo builds into
  target/<triple>/release rather than target/release.
- Install into the xx sysroot (DESTDIR) so xx's cross pkg-config finds
  pathrs.pc, and --disable-dynamic since the static build only needs the .a
  (Alpine's BusyBox install also lacks the -T flag used for the .so).
- Work around a go-pathrs build failure under clang's cgo by rewriting the
  PATHRS_PROC_* int64 temporaries to uint64.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread Dockerfile
# enum's unsigned type, so it happens to work there). Rewrite the temporaries
# to uint64; the values fit and the comparison that follows is unchanged.
# TODO: drop this once fixed upstream: https://github.com/cyphar/go-pathrs
sed -i 's/int64 = C.PATHRS_PROC/uint64 = C.PATHRS_PROC/' vendor/cyphar.com/go-pathrs/internal/libpathrs/libpathrs_linux.go

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant