From f590030e5936412de47a31f56edf031e0f3fdb5b Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 13 Nov 2025 18:33:56 +0100 Subject: [PATCH] Use static link for compare scripts In case you have different GLIBC versions inside and outside of the chroot we would get errors. As dynamic linking saves a bit of space we shouldn't always do this but as we only do this for compare scripts and not the submissions this is quite a small diskoverhead. --- judge/judgedaemon.main.php | 4 ++-- sql/files/defaultdata/compare/build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php index eb0574fdf0..bf8fcc8569 100644 --- a/judge/judgedaemon.main.php +++ b/judge/judgedaemon.main.php @@ -463,10 +463,10 @@ function fetch_executable_internal( } switch ($execlang) { case 'c': - $buildscript .= "gcc -Wall -O2 -std=gnu11 $source -o run -lm\n"; + $buildscript .= "gcc -Wall -O2 -static -std=gnu11 $source -o run -lm\n"; break; case 'cpp': - $buildscript .= "g++ -Wall -O2 -std=gnu++20 $source -o run\n"; + $buildscript .= "g++ -Wall -O2 -static -std=gnu++20 $source -o run\n"; break; case 'java': $buildscript .= "javac -cp . -d . $source\n"; diff --git a/sql/files/defaultdata/compare/build b/sql/files/defaultdata/compare/build index 31bb255097..f9275e2544 100755 --- a/sql/files/defaultdata/compare/build +++ b/sql/files/defaultdata/compare/build @@ -1,2 +1,2 @@ #!/bin/sh -g++ -std=c++11 -pedantic -g -O1 -Wall -fstack-protector -D_FORTIFY_SOURCE=2 -fPIE -Wformat -Wformat-security -fPIE -Wl,-z,relro -Wl,-z,now compare.cc -o run +g++ -std=c++11 -pedantic -g -O1 -static -Wall -fstack-protector -D_FORTIFY_SOURCE=2 -fPIE -Wformat -Wformat-security -fPIE -Wl,-z,relro -Wl,-z,now compare.cc -o run