** Description changed:

- In a simple default installation of Ubuntu 26.04 and CUDA (via the new
- meta package cuda-toolkit), a minimal program fails to compile. The host
- compiler libraries are incompatible with the CUDA libraries.
+ Transforming this into a SRU for cuda-crt to resolute.
  
- A way to reproduce the issue:
+ [ Impact ]
  
- docker run -it ubuntu:26.04
- apt update && apt upgrade -y && apt install cuda-toolkit -y
- printf "int main() {}" > main.cu
- /usr/local/cuda/bin/nvcc main.cu
+  * On a Resolute install, the CUDA toolkit cannot compile minimal CUDA
+    programs. Installing `cuda-toolkit-13-1` and running nvcc on a trivial
+    file (e.g. `int main() {}` in main.cu) fails at compile time.
  
- The error:
+  * The cause is a declaration conflict between the CUDA runtime header
+    crt/math_functions.h (shipped by cuda-crt-13-1) and glibc's
+    /usr/include/x86_64-linux-gnu/bits/mathcalls.h. A newer glibc release
+    added rsqrt/rsqrtf declarations (with a noexcept exception
+    specification) that conflict with cuda-crt's existing declarations.
  
- /usr/include/x86_64-linux-gnu/bits/mathcalls.h(206): error: exception 
specification is incompatible with that of previous function "rsqrt" (declared 
at line 629 of 
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h)
-    extern double rsqrt (double __x) noexcept (true); extern double __rsqrt 
(double __x) noexcept (true);
-                                     ^
+  * This makes the CUDA compiler (nvcc) unusable out of the box on
+    Resolute.
  
- /usr/include/x86_64-linux-gnu/bits/mathcalls.h(206): error: exception 
specification is incompatible with that of previous function "rsqrtf" (declared 
at line 653 of 
/usr/local/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h)
-    extern float rsqrtf (float __x) noexcept (true); extern float __rsqrtf 
(float __x) noexcept (true);
+      $ /usr/local/cuda-13.1/bin/nvcc main.cu
+      /usr/include/aarch64-linux-gnu/bits/mathcalls.h(206): error: exception 
specification is incompatible with that of previous function "rsqrt" (declared 
at line 629 of 
/usr/local/cuda-13.1/bin/../targets/sbsa-linux/include/crt/math_functions.h)
+         extern double rsqrt (double __x) noexcept (true); extern double 
__rsqrt (double __x) noexcept (true);
+                                          ^
+ 
+      /usr/include/aarch64-linux-gnu/bits/mathcalls.h(206): error: exception 
specification is incompatible with that of previous function "rsqrtf" (declared 
at line 653 of 
/usr/local/cuda-13.1/bin/../targets/sbsa-linux/include/crt/math_functions.h)
+         extern float rsqrtf (float __x) noexcept (true); extern float 
__rsqrtf (float __x) noexcept (true);
                                     ^
  
- 2 errors detected in the compilation of "main.cu".
+     2 errors detected in the compilation of "main.cu".
  
- -------------------------------------------------------------
+  * The fix adds a patch to crt/math_functions.h
+    (debian/patches/Fix-name-conflict-with-libc6.patch) that resolves the
+    conflict with libc6 by aligning the declarations. This is also how it
+    is resolved in newer CUDA releases.
  
- The issue was also discussed here:
- https://forums.developer.nvidia.com/t/fedora-43-and-nvcc-cuda13-1-error-
- exception-specification-is-incompatible-rsqrt-rsqrtf/354510
+ [ Test Plan ]
  
- Applying the proposed patch in the first post fixes the issue.
+  * On a clean Ubuntu 26.04 (Resolute) system, install cuda-toolkit-13-1
+    and compile the following snippet with nvcc:
  
- ProblemType: Bug
- DistroRelease: Ubuntu 26.04
- Package: cuda-toolkit 13.1.1-0ubuntu1
- ProcVersionSignature: Ubuntu 6.17.0-22.22~24.04.1-generic 6.17.13
- Uname: Linux 6.17.0-22-generic x86_64
- ApportVersion: 2.34.0-0ubuntu2
- Architecture: amd64
- CasperMD5CheckResult: unknown
- CloudBuildName: ubuntu-oci:minimized
- CloudSerial: 20260421
- Date: Thu Jun  4 08:36:14 2026
- ProcEnviron:
-  PATH=(custom, no user)
-  TERM=xterm
- SourcePackage: cuda-meta-13-1
- UpgradeStatus: No upgrade log present (probably fresh install)
+      $ printf 'int main() {}' > main.cu
+      $ /usr/local/cuda-13.1/bin/nvcc main.cu
+ 
+  * Before the fix (13.1.115-0ubuntu1): compilation fails with two
+    "exception specification is incompatible with that of previous
+    function rsqrt / rsqrtf" errors, and no binary is produced.
+ 
+  * After including the proposed fix it compiles and produces a binary.
+ 
+ [ Where problems could occur ]
+ 
+  * The change is confined to a single CUDA runtime header
+    (crt/math_functions.h); it does not modify runtime binaries or any
+    other package. Any regression would therefore surface at CUDA
+    compile time only.
+ 
+ [ Other Info ]
+ 
+  * Fixed in Stonking in version 13.1.115-0ubuntu2.
+ 
+  * Test build of the fixed package (Stonking) available in PPA:
+    https://launchpad.net/~aglinserer/+archive/ubuntu/cuda-2155233
+ 
+  * Upstream discussion of this bug:
+    
https://forums.developer.nvidia.com/t/fedora-43-and-nvcc-cuda13-1-error-exception-specification-is-incompatible-rsqrt-rsqrtf/354510
+ 
+  * A build is present in
+ https://launchpad.net/~aglinserer/+archive/ubuntu/lp2155233/+packages

** Merge proposal linked:
   https://code.launchpad.net/~canonical-nvidia/+git/cuda-crt-13-1/+merge/509487

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2155233

Title:
  cuda-toolkit cannot compile minimal example

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cuda-crt-13-1/+bug/2155233/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to