From d651a994e3a5009b20196ac84ad2ea6334c2c57d Mon Sep 17 00:00:00 2001 From: charly Date: Fri, 16 Oct 2026 17:18:19 +0200 Subject: [PATCH] fix(cuda): enumerate the toolkit libs so nvcc's static archives are linked The library loop globbed *.so* and so never linked the STATIC archives nvcc links by default -- libcudart_static.a, libcudadevrt.a, libculibos.a, and the _static family. Every CUDA executable link therefore failed with 'cannot find -lcudart_static: No such file or directory' while the package ships the file all along, so no CUDA image in the family could build past CMake's compiler identification. Both Arch arms now enumerate every entry of the toolkit's lib directories, matching the header loop's fix in #10 and the sibling-tree fix in #11. Third and last pattern-matched loop closed. The check is strengthened again, from a compile (-c) to a real COMPILE AND LINK, because -c never links and so could not fail on this: it now produces an executable, which is exactly the stage that was broken. Proven on real Arch hardware: the build is clean and the check passes; it fails by construction on the unpatched candy (the gate's own log shows the link failing there). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) --- charly.yml | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/charly.yml b/charly.yml index b15bb08..476bda7 100644 --- a/charly.yml +++ b/charly.yml @@ -168,8 +168,19 @@ cuda: done # Libraries: libcudart, libcudnn, libcurand, etc. mkdir -p /usr/lib64 - for so in /opt/cuda/targets/x86_64-linux/lib/*.so* /opt/cuda/lib64/*.so*; do - [ -e "$so" ] && ln -sf "$so" /usr/lib64/$(basename "$so") + # Enumerate EVERY entry, not a `*.so*` glob. nvcc links the STATIC archives by + # default (libcudart_static.a, libcudadevrt.a, libculibos.a, ...), and a `.so*` + # pattern cannot match a `.a` — so the linker failed with "cannot find + # -lcudart_static: No such file or directory" although the package ships the file + # (opencharly/layer-cuda#12). Same defect shape as the `*.h` header glob that missed + # `.hpp`: pattern-matching a directory instead of enumerating it. + mkdir -p /usr/lib64 + for libdir in /opt/cuda/targets/x86_64-linux/lib /opt/cuda/lib64; do + [ -d "$libdir" ] || continue + for entry in "$libdir"/*; do + [ -e "$entry" ] || continue + ln -sfn "$entry" /usr/lib64/"$(basename "$entry")" + done done run_as: root command: | @@ -212,8 +223,19 @@ cuda: done # Libraries: libcudart, libcudnn, libcurand, etc. mkdir -p /usr/lib64 - for so in /opt/cuda/targets/x86_64-linux/lib/*.so* /opt/cuda/lib64/*.so*; do - [ -e "$so" ] && ln -sf "$so" /usr/lib64/$(basename "$so") + # Enumerate EVERY entry, not a `*.so*` glob. nvcc links the STATIC archives by + # default (libcudart_static.a, libcudadevrt.a, libculibos.a, ...), and a `.so*` + # pattern cannot match a `.a` — so the linker failed with "cannot find + # -lcudart_static: No such file or directory" although the package ships the file + # (opencharly/layer-cuda#12). Same defect shape as the `*.h` header glob that missed + # `.hpp`: pattern-matching a directory instead of enumerating it. + mkdir -p /usr/lib64 + for libdir in /opt/cuda/targets/x86_64-linux/lib /opt/cuda/lib64; do + [ -d "$libdir" ] || continue + for entry in "$libdir"/*; do + [ -e "$entry" ] || continue + ln -sfn "$entry" /usr/lib64/"$(basename "$entry")" + done done - check: the nvcc CUDA compiler driver is on the canonical /usr path file: @@ -228,7 +250,7 @@ cuda: file: file: /usr/include/cudnn.h exists: true - - check: "a CUDA translation unit COMPILES against the stitched /usr layout (Arch: the header subtrees are linked, not only the top-level files)" + - check: "a CUDA translation unit COMPILES AND LINKS against the stitched /usr layout (Arch: the header subtrees are linked, not only the top-level files)" id: cuda-arch-header-root # Scoped IN THE COMMAND deliberately: the check runner does not honour runner-level # exclude-distro fields, and Fedora's RPMs land in /usr directly so its layout differs. @@ -243,7 +265,7 @@ cuda: [ -f /etc/arch-release ] || exit 0 test -f /usr/include/crt/host_config.h || exit 1 printf 'int main(void){return 0;}\n' > /tmp/chkcuda.cu - nvcc -c -x cu -o /tmp/chkcuda.o /tmp/chkcuda.cu + nvcc -x cu -o /tmp/chkcuda /tmp/chkcuda.cu rc=$? rm -f /tmp/chkcuda.cu exit $rc