fix: build the full image's C++ libraries like AtCoder and test the images with ojt in CI - #20
Merged
Merged
Conversation
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
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
# Conflicts: # Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the full image's C++ libraries usable through
ojtexactly as AtCoder links them, and test the images in CI.9800ad7): install only 20250512.1./usr/lib/<triplet>, which the linker searches before/usr/local/lib.d75969e):-fopenmp -DNOMINMAX -lstdc++explike the judge.cxx/full-flags.txt: AtCoder's defines and-llist, with libraries the image lacks dropped at build time.3c912b4,1123a21,815cd4e):main(Abseil flag registration).cxx-libs-buildstage./usr/local.gccstage so edits to light do not invalidate it.f6916df): delete thelibprotobuf*.abundled with libtorch, as AtCoder does.-L/opt/libtorch/libmade-lprotobufpick that older copy.450ed1b):test/light.sh(C++, Python, PyPy and Rust throughojt) ortest/full.sh(the same, plus one program that uses Abseil, Boost, GMP, LightGBM, OR-Tools, LibTorch, Z3 and OpenMP together).ojtinside the Dockerfile. That tested an unfinished image, hit PyPI through oj's update check, and invalidated the cache below it.Still different from AtCoder: 4 Boost libraries (
charconv,contract,process,stacktrace_from_exception) are missing from Ubuntu's Boost 1.83 and are skipped. A follow-up PR moves to Boost 1.88.Test
CI, all four builds including the new test step: https://github.com/carbon-nil/atcoder-docker/actions/runs/35998419705
ojtAC for C++, Python, PyPy, RustEarlier runs on this branch caught, in order:
/usr/local/mansymlink conflict🤖 Generated with Claude Code
https://claude.ai/code/session_01VQaZJRoT1k7VZ8ThsuLdFa