Seeking workaround for compiling code in a system with GCC 13

Hello,

I use a linux system based on Arch Linux, and unfortunately with one of the latest updates it switched to GCC 13. This causes issues when I try to build a C++ code with NVHPC, e.g. this type of output when compiling:

"/usr/include/stdlib.h", line 141: error: identifier "_Float32" is undefined
  extern _Float32 strtof32 (const char *__restrict __nptr,
         ^
(...)

I have installed GCC 12 in my system, under /usr/bin asgcc-12 and g++-12. I was wondering if there may be some environment variables I can set when installing and using NVHPC such that it is configured using GCC 12 in my system? I realize that NVHPC does not support GCC 13, but I was still wondering if someone has managed to install other GCC versions in an Arch-based system like I did, and managed to circumvent these issues.

Thank you,
Pedro

Hi Pedro,

Which version of NVHPC are you using? Which header files are you including which triggers this error?

While we’re still working on full support for interoperability with GNU 13 (they made significant changes), we did add some support in our 23.5 release and additional items in 23.7. Specifically we saw similar errors when the “type_traits” header gets included (either implicitly or explicitly) but were able to work around this in the 23.5 release.

-Mat

Hi Mat,

I forgot to mention - version 23.7. They arise when building this library on my system, which includes:

<algorithm>, <numeric>, <string>, <vector>, <iostream>

In addition to some other ones unrelated to stdlib:

<cuda_runtime.h> <mpi.h> <nccl.h> <nvshmem.h> <nvshmemx.h> <cuda_runtime.h> <cuda/std/complex>                                                                                                                     

Thanks,
Pedro

I’m not seeing errors when building the mpicxx (nvc++) parts of cuDecomp, but do see similar errors with the nvcc portions. Are you only seeing errors when using nvcc?

Unfortunately I don’t have insights on when nvcc will add support for GNU 13.x.

Hi again Mat,

Thanks for checking!

On my system, I’m seeing errors when building nvcc++ parts too:

# $ mpicxx -fPIC -DENABLE_NVSHMEM -DNVSHMEM_USE_NCCL -DENABLE_NVTX  -O3 -std=c++14 -I/home/pedro/Desktop/cuDecomp/include -I/home/pedro/Software/nvidia/hpc_sdk/Linux_x86_64/2023/comm_libs/hpcx/latest/ompi/include -I/home/pedro/Software/nvidia/hpc_sdk/Linux_x86_64/2023/cuda/include -I/home/pedro/Software/nvidia/hpc_sdk/Linux_x86_64/2023/comm_libs/nccl/include  -I/home/pedro/Software/nvidia/hpc_sdk/Linux_x86_64/2023/math_libs/include -I/home/pedro/Software/nvidia/hpc_sdk/Linux_x86_64/2023/cuda/include -I/home/pedro/Software/nvidia/hpc_sdk/Linux_x86_64/2023/comm_libs/nvshmem/include -c -o /home/pedro/Desktop/cuDecomp/build/cudecomp.o src/cudecomp.cc
"/usr/include/stdlib.h", line 141: error: identifier "_Float32" is undefined
  extern _Float32 strtof32 (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 147: error: identifier "_Float64" is undefined
  extern _Float64 strtof64 (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 153: error: identifier "_Float128" is undefined
  extern _Float128 strtof128 (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 159: error: identifier "_Float32x" is undefined
  extern _Float32x strtof32x (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 165: error: identifier "_Float64x" is undefined
  extern _Float64x strtof64x (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 299: error: identifier "_Float32" is undefined
  		       _Float32 __f)
  		       ^

"/usr/include/stdlib.h", line 305: error: identifier "_Float64" is undefined
  		       _Float64 __f)
  		       ^

"/usr/include/stdlib.h", line 311: error: identifier "_Float128" is undefined
  			_Float128 __f)
  			^

"/usr/include/stdlib.h", line 317: error: identifier "_Float32x" is undefined
  			_Float32x __f)
  			^

"/usr/include/stdlib.h", line 323: error: identifier "_Float64x" is undefined
  			_Float64x __f)
  			^

"/usr/include/stdlib.h", line 436: error: identifier "_Float32" is undefined
  extern _Float32 strtof32_l (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 443: error: identifier "_Float64" is undefined
  extern _Float64 strtof64_l (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 450: error: identifier "_Float128" is undefined
  extern _Float128 strtof128_l (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 457: error: identifier "_Float32x" is undefined
  extern _Float32x strtof32x_l (const char *__restrict __nptr,
         ^

"/usr/include/stdlib.h", line 464: error: identifier "_Float64x" is undefined
  extern _Float64x strtof64x_l (const char *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 422: error: identifier "_Float32" is undefined
  extern _Float32 wcstof32 (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 427: error: identifier "_Float64" is undefined
  extern _Float64 wcstof64 (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 432: error: identifier "_Float128" is undefined
  extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 437: error: identifier "_Float32x" is undefined
  extern _Float32x wcstof32x (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 442: error: identifier "_Float64x" is undefined
  extern _Float64x wcstof64x (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 649: error: identifier "_Float32" is undefined
  extern _Float32 wcstof32_l (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 655: error: identifier "_Float64" is undefined
  extern _Float64 wcstof64_l (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 661: error: identifier "_Float128" is undefined
  extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 667: error: identifier "_Float32x" is undefined
  extern _Float32x wcstof32x_l (const wchar_t *__restrict __nptr,
         ^

"/usr/include/wchar.h", line 673: error: identifier "_Float64x" is undefined
  extern _Float64x wcstof64x_l (const wchar_t *__restrict __nptr,
         ^

"/home/pedro/Software/nvidia/hpc_sdk/Linux_x86_64/2023/comm_libs/nvshmem/include/nvshmem_build_options.h", line 24: warning: incompatible redefinition of macro "NVSHMEM_USE_NCCL" [bad_macro_redef]
  #define NVSHMEM_USE_NCCL
          ^

Remark: individual warnings can be suppressed with "--diag_suppress <warning-name>"

"/usr/include/bits/mathcalls.h", line 53: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (acos,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 55: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (asin,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 57: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (atan,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 59: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (atan2,, (_Mdouble_ __y, _Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 62: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (cos,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 64: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (sin,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 66: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (tan,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 71: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (cosh,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 73: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (sinh,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 75: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (tanh,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 79: error: identifier "_Float32" is undefined
  __MATHDECL_VEC (void,sincos,,
  ^

"/usr/include/bits/mathcalls.h", line 85: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (acosh,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 87: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (asinh,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 89: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (atanh,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 95: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (exp,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 98: error: identifier "_Float32" is undefined
  __MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
  ^

"/usr/include/bits/mathcalls.h", line 101: error: identifier "_Float32" is undefined
  __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
  ^

"/usr/include/bits/mathcalls.h", line 104: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (log,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 107: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (log10,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 110: error: identifier "_Float32" is undefined
  __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
  ^

"/usr/include/bits/mathcalls.h", line 114: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (exp10,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 119: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (expm1,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 122: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (log1p,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 125: error: identifier "_Float32" is undefined
  __MATHCALL (logb,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 130: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (exp2,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 133: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (log2,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 140: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
  ^

"/usr/include/bits/mathcalls.h", line 143: error: identifier "_Float32" is undefined
  __MATHCALL (sqrt,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 147: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
  ^

"/usr/include/bits/mathcalls.h", line 152: error: identifier "_Float32" is undefined
  __MATHCALL_VEC (cbrt,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 159: error: identifier "_Float32" is undefined
  __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
  ^

"/usr/include/bits/mathcalls.h", line 162: error: identifier "_Float32" is undefined
  __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
  ^

"/usr/include/bits/mathcalls.h", line 165: error: identifier "_Float32" is undefined
  __MATHCALLX (floor,, (_Mdouble_ __x), (__const__));
  ^

"/usr/include/bits/mathcalls.h", line 168: error: identifier "_Float32" is undefined
  __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
  ^

"/usr/include/bits/mathcalls.h", line 198: error: identifier "_Float32" is undefined
  __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
  ^

"/usr/include/bits/mathcalls.h", line 203: error: identifier "_Float32" is undefined
  __MATHCALL (nan,, (const char *__tagb));
  ^

"/usr/include/bits/mathcalls.h", line 220: error: identifier "_Float32" is undefined
  __MATHCALL (j0,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 220: error: expected a ";"
  __MATHCALL (j0,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 220: error: "_Float32" is not a type name
  __MATHCALL (j0,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 220: error: expected a ";"
  __MATHCALL (j0,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 221: error: "_Float32" is not a type name
  __MATHCALL (j1,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 221: error: expected a ";"
  __MATHCALL (j1,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 221: error: expected a ";"
  __MATHCALL (j1,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 222: error: "_Float32" is not a type name
  __MATHCALL (jn,, (int, _Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 223: error: "_Float32" is not a type name
  __MATHCALL (y0,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 223: error: expected a ";"
  __MATHCALL (y0,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 223: error: expected a ";"
  __MATHCALL (y0,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 224: error: "_Float32" is not a type name
  __MATHCALL (y1,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 224: error: expected a ";"
  __MATHCALL (y1,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 224: error: expected a ";"
  __MATHCALL (y1,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 225: error: "_Float32" is not a type name
  __MATHCALL (yn,, (int, _Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 231: error: "_Float32" is not a type name
  __MATHCALL_VEC (erf,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 231: error: expected a ";"
  __MATHCALL_VEC (erf,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 231: error: expected a ";"
  __MATHCALL_VEC (erf,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 232: error: "_Float32" is not a type name
  __MATHCALL_VEC (erfc,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 232: error: expected a ";"
  __MATHCALL_VEC (erfc,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 232: error: expected a ";"
  __MATHCALL_VEC (erfc,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 233: error: "_Float32" is not a type name
  __MATHCALL (lgamma,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 233: error: expected a ";"
  __MATHCALL (lgamma,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 233: error: expected a ";"
  __MATHCALL (lgamma,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 238: error: "_Float32" is not a type name
  __MATHCALL (tgamma,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 238: error: expected a ";"
  __MATHCALL (tgamma,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 238: error: expected a ";"
  __MATHCALL (tgamma,, (_Mdouble_));
  ^

"/usr/include/bits/mathcalls.h", line 252: error: "_Float32" is not a type name
  __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
  ^

"/usr/include/bits/mathcalls.h", line 252: error: type name is not allowed
  __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
  ^

"/usr/include/bits/mathcalls.h", line 252: error: identifier "__signgamp" is undefined
  __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
  ^

"/usr/include/bits/mathcalls.h", line 252: error: expected a ";"
  __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
  ^

"/usr/include/bits/mathcalls.h", line 252: error: type name is not allowed
  __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
  ^

"/usr/include/bits/mathcalls.h", line 252: error: expected a ";"
  __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
  ^

"/usr/include/bits/mathcalls.h", line 259: error: "_Float32" is not a type name
  __MATHCALL (rint,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 259: error: expected a ")"
  __MATHCALL (rint,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 259: error: expected a ";"
  __MATHCALL (rint,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 259: error: expected a ")"
  __MATHCALL (rint,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 259: error: expected a ";"
  __MATHCALL (rint,, (_Mdouble_ __x));
  ^

"/usr/include/bits/mathcalls.h", line 262: error: "_Float32" is not a type name
  __MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
  ^

Error limit reached. Use -fmax-errors=N to change the limit, N=0 for unlimited.
100 errors detected in the compilation of "src/cudecomp.cc".
Compilation terminated.

I’m guessing there is no easy fix on my end for this other than downgrading my system.

Pedro

Hmm, sorry I’m not sure what to suggest here. I’ve successfully compiled this file with both 23.7 and 23.3. Though given I don’t have a system with GNU 13.1 installed natively, I need to use our “–gcc-toolchain” flag to point the compiler to an GNU 13.1 installation.

Possibly the stdlib.h that ships with the 13.1 I have installed is different from what you have install natively? Not sure.

Right, perhaps because I have GNU 13.2.1?

gcc --version
gcc (GCC) 13.2.1 20230801
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

PS: I edited the previous post output, as I accidentally took NVHPC 23.1 to produce it. Now it has the 23.7 output (showing similar errors).

Pedro

I still can’t reproduce it with GNU 13.2. Seem to compile file for me with 23.7:

I doubt this would be it, but I am using the direct paths to our CUDA 12.2 include directories as opposed to using the top-level links.

% mpicxx -V

nvc++ 23.7-0 64-bit target on x86-64 Linux -tp zen3
NVIDIA Compilers and Tools
Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.
% gcc --version                                                                                                                         
gcc (GCC) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% mpicxx -fPIC -DENABLE_NVSHMEM -DNVSHMEM_USE_NCCL -DENABLE_NVTX -O3 -std=c++14 -I/local/home/mcolgrove/cuDecomp/include -I/proj/nv/Linux_x86_64/23.7/comm_libs/12.2/hpcx/latest/ompi/include -I/proj/nv/Linux_x86_64/23.7/cuda/12.2/include -I/proj/nv/Linux_x86_64/23.7/comm_libs/12.2/nccl/include -I/proj/nv/Linux_x86_64/23.7/math_libs/12.2/include -I/proj/nv/Linux_x86_64/23.7/cuda/12.2/include -I/proj/nv/Linux_x86_64/23.7/comm_libs/12.2/nvshmem/include -c -o /local/home/mcolgrove/cuDecomp/build/cudecomp.o src/cudecomp.cc -w --gcc-toolchain=/home/sw/thirdparty/gcc/gcc-13.2.0/Linux_x86_64/
%

Thanks again Mat!

Perhaps the issue is that I was building it using OpenMPI? With OpenMPI 3 or 4 I get these errors, but when I use the HPC-X MPI wrapper it builds the nvc++ part, but not the nvcc.

Pedro