Skip to content

fix: pin the full image's C++ libraries to AtCoder's versions - #21

Merged
haiiro2gou merged 11 commits into
masterfrom
worktree-pin-cxx-libs
Sep 24, 2026
Merged

haiiro2gou merged 11 commits into
masterfrom
worktree-pin-cxx-libs

Conversation

@carbon-nil

Copy link
Copy Markdown
Owner

Summary

Pin the full image's C++ libraries to the versions AtCoder's 2025-10 judge uses.

Depends on #20. This branch is based on it, so the diff shows #20's commits until #20 is merged.

Library Before After
Boost 1.83 (apt) 1.88.0, built from source with AtCoder's bootstrap / b2 options in its own boost-build stage (cached independently)
Z3 4.8.12 (apt) 4.15.2, official release binaries (amd64 x64-glibc-2.39, arm64 arm64-glibc-2.34)
immer unpinned HEAD v0.8.1
unordered_dense unpinned HEAD v4.5.0
  • Boost 1.88 is copied after the OR-Tools output, so headers that OR-Tools' bundled Boost may install cannot shadow it.
  • With Boost 1.88, ojt no longer has to skip charconv, contract, process and stacktrace_from_exception. Every library in AtCoder's link list is now present.
  • test/full-smoke.cpp now also links boost::json, so a compiled Boost library is exercised.
  • README: C++ row versions updated.

Test

CI, all four builds including the test step: https://github.com/carbon-nil/atcoder-docker/actions/runs/35999608939

  • The full build logs show no ojt: skip lines.
  • test/full.sh passes on amd64 and arm64 (C++, Python, PyPy, Rust, and the combined library program with boost::json).

🤖 Generated with Claude Code

https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa

carbon-nil and others added 11 commits September 24, 2026 19:39
apt's libabsl-dev (20220623) sat in /usr/lib/<triplet>, which the linker
searches before /usr/local/lib, so programs compiled against the 20250512
headers linked the old libraries. AtCoder only has 20250512.1.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa
…der does

ojt passed none of AtCoder's defines or libraries, so OR-Tools headers did not
compile and Abseil, LightGBM, LibTorch and friends did not link. ojt now adds
-fopenmp, -DNOMINMAX and -lstdc++exp like the judge, and in the full image
reads cxx/full-flags.txt (AtCoder's defines and -l list, dropping libraries
the image lacks). LightGBM is installed as a static library like AtCoder's,
LibTorch gets an rpath, and libstdc++ is resolved before OR-Tools, whose arm64
build re-exports standard library symbols and otherwise gets linked into
every program (crashing together with LibTorch). A smoke test builds and runs
a program using all of them with ojt.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa
…tCoder

The prebuilt arm64 OR-Tools is an AlmaLinux build that re-exports libstdc++
symbols; linked together with LibTorch it crashed before main during
Abseil's flag registration. Build Abseil 20250512.1 and OR-Tools 9.14 (with
GLPK) from source with AtCoder's options in a separate cxx-libs-build stage,
cached independently of full. GCC 15 moves to its own gcc stage so edits to
light do not invalidate it. The -lstdc++ workaround is no longer needed and
-lGLPK is back in ojt's flags.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa
…the Dockerfile

Running ojt mid-build tested an unfinished image, reached PyPI through oj's
update check, and invalidated the cache below it whenever the check changed.
The build job now loads the image it just built and runs test/light.sh or
test/full.sh (C++, Python, PyPy and Rust through ojt, plus the full image's
C++ libraries together).

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa
…d into /usr/local

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa
…orch, like AtCoder

-L/opt/libtorch/lib made -lprotobuf pick libtorch's older copy instead of the
one built with OR-Tools, so OR-Tools programs failed to link on amd64.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa
Boost 1.88.0 is built from source with AtCoder's bootstrap/b2 options in its
own cached stage (Ubuntu's 1.83 lacked charconv, contract, process and
stacktrace_from_exception, which ojt had to skip). Z3 4.15.2 comes from the
official release binaries, and immer / unordered_dense are pinned to v0.8.1 /
v4.5.0. apt's Boost and Z3 are dropped. The full test now also links
boost::json.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa
…ktree-pin-cxx-libs

# Conflicts:
#	Dockerfile
#	README.md
@haiiro2gou
haiiro2gou merged commit de3d5d7 into master Sep 24, 2026
@haiiro2gou
haiiro2gou deleted the worktree-pin-cxx-libs branch September 24, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants