You are not logged in.

#1 2026-05-04 11:38:05

silver-lasombra
Member
Registered: 2024-08-14
Posts: 30

nvcc isn't compatiable with gcc16

After upgrade to gcc16, compile failed.

My test code:

#include <stdio.h>

__global__ void hello_from_gpu ()
{
	printf("Hello from GPU! \n");
}

int main (void)
{
	hello_from_gpu<<<4,4>>>();
	cudaDeviceSynchronize();

	return 0;
}

Compiled it with:

nvcc hello.cu -o hello

Error:

/usr/include/c++/16.1.1/type_traits(393): error: identifier "char8_t" is undefined
      struct __is_integral_helper<char8_t>
                                  ^

/usr/include/c++/16.1.1/type_traits(1448): error: identifier "__f" is undefined
        = requires (void(&__f)(_Tp)) { __f({}); };
                          ^

/usr/include/c++/16.1.1/type_traits(1448): error: expression preceding parentheses of apparent call must have (pointer-to-) function type
        = requires (void(&__f)(_Tp)) { __f({}); };
                    ^

/usr/include/c++/16.1.1/type_traits(1448): error: type name is not allowed
        = requires (void(&__f)(_Tp)) { __f({}); };
                               ^

/usr/include/c++/16.1.1/type_traits(1448): error: identifier "requires" is undefined
        = requires (void(&__f)(_Tp)) { __f({}); };
          ^

/usr/include/c++/16.1.1/type_traits(1448): error: expected a ";"
        = requires (void(&__f)(_Tp)) { __f({}); };
                                     ^

/usr/include/c++/16.1.1/type_traits(2071): error: identifier "char8_t" is undefined
      struct __make_unsigned<char8_t>
                             ^

/usr/include/c++/16.1.1/type_traits(2074): error: identifier "char8_t" is undefined
   = typename __make_unsigned_selector<char8_t, false, true>::__type;
                                       ^

/usr/include/c++/16.1.1/type_traits(2074): error: incomplete type "std::__make_unsigned_selector<<error-type>, false, true>" is not allowed
   = typename __make_unsigned_selector<char8_t, false, true>::__type;
              ^

/usr/include/c++/16.1.1/type_traits(2209): error: identifier "char8_t" is undefined
      struct __make_signed<char8_t>
                           ^

/usr/include/c++/16.1.1/type_traits(2212): error: identifier "char8_t" is undefined
   = typename __make_signed_selector<char8_t, false, true>::__type;
                                     ^

/usr/include/c++/16.1.1/type_traits(2212): error: incomplete type "std::__make_signed_selector<<error-type>, false, true>" is not allowed
   = typename __make_signed_selector<char8_t, false, true>::__type;
              ^

/usr/include/c++/16.1.1/type_traits(2986): error: "requires" is not a type name
      requires requires { typename _Op<_Args...>; }
      ^

/usr/include/c++/16.1.1/type_traits(2986): error: a class or namespace qualified name is required
      requires requires { typename _Op<_Args...>; }
                                   ^

/usr/include/c++/16.1.1/type_traits(2986): error: type name is not allowed
      requires requires { typename _Op<_Args...>; }
                          ^

/usr/include/c++/16.1.1/type_traits(2986): error: expected a "}"
      requires requires { typename _Op<_Args...>; }
                                                ^

/usr/include/c++/16.1.1/type_traits(2987): error: __detected_or is not a template
      struct __detected_or<_Def, _Op, _Args...>
             ^

/usr/include/c++/16.1.1/type_traits(2987): error: identifier "_Def" is undefined
      struct __detected_or<_Def, _Op, _Args...>
                           ^

/usr/include/c++/16.1.1/type_traits(2987): error: identifier "_Op" is undefined
      struct __detected_or<_Def, _Op, _Args...>
                                 ^

/usr/include/c++/16.1.1/type_traits(2987): error: identifier "_Args" is undefined
      struct __detected_or<_Def, _Op, _Args...>
                                      ^

/usr/include/c++/16.1.1/type_traits(2987): error: expected a ">"
      struct __detected_or<_Def, _Op, _Args...>
                                           ^

/usr/include/c++/16.1.1/type_traits(2989): error: expected a ">"
        using type = _Op<_Args...>;
                              ^

/usr/include/c++/16.1.1/type_traits(2990): error: identifier "true_type" is undefined
        using __is_detected = true_type;
                              ^

/usr/include/c++/16.1.1/type_traits(3020): error: __detected_or is not a template
        = typename __detected_or<_Default, _Op, _Args...>::type;
                   ^

/usr/include/c++/16.1.1/type_traits(3043): error: not a class or struct name
      struct __is_tuple_like_impl : false_type
                                    ^

/usr/include/c++/16.1.1/type_traits(3049): error: __remove_cvref_t is not a template
      : public __is_tuple_like_impl<__remove_cvref_t<_Tp>>::type
                                    ^

/usr/include/c++/16.1.1/type_traits(3056): error: _Require is not a template
      _Require<__not_<__is_tuple_like<_Tp>>,
      ^

/usr/include/c++/16.1.1/type_traits(3056): error: identifier "__not_" is undefined
      _Require<__not_<__is_tuple_like<_Tp>>,
               ^

/usr/include/c++/16.1.1/type_traits(3056): error: type name is not allowed
      _Require<__not_<__is_tuple_like<_Tp>>,
                      ^

/usr/include/c++/16.1.1/type_traits(3054): error: "constexpr" is not valid here
      constexpr
      ^

/usr/include/c++/16.1.1/type_traits(3056): error: expected a ";"
      _Require<__not_<__is_tuple_like<_Tp>>,
                                           ^

/usr/include/c++/16.1.1/type_traits(3066): error: __enable_if_t is not a template
      __enable_if_t<__is_swappable<_Tp>::value>
      ^

/usr/include/c++/16.1.1/type_traits(3072): error: namespace "std" has no member "swap"
      using std::swap;
                 ^

/usr/include/c++/16.1.1/type_traits(3078): error: identifier "true_type" is undefined
          static true_type __test(int);
                 ^

/usr/include/c++/16.1.1/type_traits(3081): error: identifier "false_type" is undefined
          static false_type __test(...);
                 ^

/usr/include/c++/16.1.1/type_traits(3087): error: __bool_constant is not a template
          static __bool_constant<
                 ^

/usr/include/c++/16.1.1/type_traits(3092): error: identifier "false_type" is undefined
          static false_type __test(...);
                 ^

/usr/include/c++/16.1.1/type_traits(3130): error: identifier "__type_identity" is undefined
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                      ^

/usr/include/c++/16.1.1/type_traits(3130): error: type name is not allowed
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                                      ^

/usr/include/c++/16.1.1/type_traits(3130): error: expected an expression
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                                          ^

/usr/include/c++/16.1.1/type_traits(3130): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                      ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3139): error: identifier "__type_identity" is undefined
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                      ^

/usr/include/c++/16.1.1/type_traits(3139): error: type name is not allowed
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                                      ^

/usr/include/c++/16.1.1/type_traits(3139): error: expected an expression
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                                          ^

/usr/include/c++/16.1.1/type_traits(3139): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                      ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3157): error: namespace "std" has no member "swap"
      using std::swap;
                 ^

/usr/include/c++/16.1.1/type_traits(3165): error: identifier "true_type" is undefined
          static true_type __test(int);
                 ^

/usr/include/c++/16.1.1/type_traits(3168): error: identifier "false_type" is undefined
          static false_type __test(...);
                 ^

/usr/include/c++/16.1.1/type_traits(3174): error: __bool_constant is not a template
          static __bool_constant<
                 ^

/usr/include/c++/16.1.1/type_traits(3181): error: identifier "false_type" is undefined
          static false_type __test(...);
                 ^

/usr/include/c++/16.1.1/type_traits(3222): error: identifier "__type_identity" is undefined
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                      ^

/usr/include/c++/16.1.1/type_traits(3222): error: type name is not allowed
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                                      ^

/usr/include/c++/16.1.1/type_traits(3222): error: expected an expression
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                                          ^

/usr/include/c++/16.1.1/type_traits(3222): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                      ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3224): error: type name is not allowed
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
                                                                      ^

/usr/include/c++/16.1.1/type_traits(3224): error: expected an expression
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
                                                                          ^

/usr/include/c++/16.1.1/type_traits(3224): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
                      ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3233): error: identifier "__type_identity" is undefined
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                      ^

/usr/include/c++/16.1.1/type_traits(3233): error: type name is not allowed
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                                      ^

/usr/include/c++/16.1.1/type_traits(3233): error: expected an expression
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                                                                          ^

/usr/include/c++/16.1.1/type_traits(3233): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                      ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3235): error: type name is not allowed
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
                                                                      ^

/usr/include/c++/16.1.1/type_traits(3235): error: expected an expression
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
                                                                          ^

/usr/include/c++/16.1.1/type_traits(3235): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}),
                      ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3259): error: identifier "is_void" is undefined
      bool = is_void<_Ret>::value, typename = void>
             ^

/usr/include/c++/16.1.1/type_traits(3259): error: type name is not allowed
      bool = is_void<_Ret>::value, typename = void>
                     ^

/usr/include/c++/16.1.1/type_traits(3259): error: expected a ";"
      bool = is_void<_Ret>::value, typename = void>
                                 ^

/usr/include/c++/16.1.1/type_traits(3270): error: identifier "__void_t" is undefined
            __void_t<typename _Result::type>>
            ^

/usr/include/c++/16.1.1/type_traits(3270): error: type name is not allowed
            __void_t<typename _Result::type>>
                     ^

/usr/include/c++/16.1.1/type_traits(3268): error: __is_invocable_impl is not a template
      struct __is_invocable_impl<_Result, _Ret,
             ^

/usr/include/c++/16.1.1/type_traits(3270): error: expected a ";"
            __void_t<typename _Result::type>>
                                           ^

/usr/include/c++/16.1.1/type_traits(3282): error: identifier "__void_t" is undefined
            __void_t<typename _Result::type>>
            ^

/usr/include/c++/16.1.1/type_traits(3282): error: type name is not allowed
            __void_t<typename _Result::type>>
                     ^

/usr/include/c++/16.1.1/type_traits(3280): error: __is_invocable_impl is not a template
      struct __is_invocable_impl<_Result, _Ret,
             ^

/usr/include/c++/16.1.1/type_traits(3282): error: expected a ";"
            __void_t<typename _Result::type>>
                                           ^

/usr/include/c++/16.1.1/type_traits(3310): error: identifier "false_type" is undefined
   static false_type
          ^

/usr/include/c++/16.1.1/type_traits(3313): error: expected a declaration
      public:
      ^

/usr/include/c++/16.1.1/type_traits(3318): error: identifier "_Ret" is undefined
        using __nothrow_conv = decltype(_S_test<_Ret>(1));
                                                ^

/usr/include/c++/16.1.1/type_traits(3325): error: __bool_constant is not a template
      : __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
        ^

/usr/include/c++/16.1.1/type_traits(3332): error: identifier "__invoke_memfun_ref" is undefined
      constexpr bool __call_is_nt(__invoke_memfun_ref)
                                  ^

/usr/include/c++/16.1.1/type_traits(3333): error: expected a ";"
      {
      ^

/usr/include/c++/16.1.1/type_traits(3374): error: __call_is_nothrow is not a template
        = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
          ^

/usr/include/c++/16.1.1/type_traits(3374): error: identifier "__invoke_result" is undefined
        = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
                            ^

/usr/include/c++/16.1.1/type_traits(3374): error: type name is not allowed
        = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
                                            ^

/usr/include/c++/16.1.1/type_traits(3374): error: expected a ";"
        = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>;
                                                          ^

/usr/include/c++/16.1.1/type_traits(3380): error: __bool_constant is not a template
      : __bool_constant<__is_nothrow_invocable(_Fn, _Args...)>
        ^

/usr/include/c++/16.1.1/type_traits(3402): error: __invoke_result is not a template
      : public __invoke_result<_Functor, _ArgTypes...>
               ^

/usr/include/c++/16.1.1/type_traits(3404): error: identifier "__type_identity" is undefined
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
                                                      ^

/usr/include/c++/16.1.1/type_traits(3404): error: type name is not allowed
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
                                                                      ^

/usr/include/c++/16.1.1/type_traits(3404): error: expected an expression
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
                                                                               ^

/usr/include/c++/16.1.1/type_traits(3404): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}),
                      ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3407): error: type name is not allowed
   __type_identity<_ArgTypes>{}) && ...),
                   ^

/usr/include/c++/16.1.1/type_traits(3407): error: expected an expression
   __type_identity<_ArgTypes>{}) && ...),
                             ^

/usr/include/c++/16.1.1/type_traits(3406): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert((std::__is_complete_or_unbounded(
                       ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3419): error: __bool_constant is not a template
      : public __bool_constant<__is_invocable(_Fn, _ArgTypes...)>
               ^

/usr/include/c++/16.1.1/type_traits(3424): error: identifier "__type_identity" is undefined
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
                                                      ^

/usr/include/c++/16.1.1/type_traits(3424): error: type name is not allowed
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
                                                                      ^

/usr/include/c++/16.1.1/type_traits(3424): error: expected an expression
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
                                                                          ^

/usr/include/c++/16.1.1/type_traits(3424): error: no instance of overloaded function "std::__is_complete_or_unbounded" matches the argument list
            argument types are: (<error-type>)
        static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}),
                      ^
/usr/include/c++/16.1.1/type_traits(319): note #3327-D: candidate function template "std::__is_complete_or_unbounded(_TypeIdentity)" failed deduction
      __is_complete_or_unbounded(_TypeIdentity)
      ^
/usr/include/c++/16.1.1/type_traits(311): note #3327-D: candidate function template "std::__is_complete_or_unbounded(std::__type_identity<_Tp>)" failed deduction
      __is_complete_or_unbounded(__type_identity<_Tp>)
      ^

/usr/include/c++/16.1.1/type_traits(3427): error: type name is not allowed
   __type_identity<_ArgTypes>{}) && ...),
                   ^

Error limit reached.
100 errors detected in the compilation of "hello.cu".
Compilation terminated.

Offline

#2 2026-05-04 14:42:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,122

Re: nvcc isn't compatiable with gcc16

Does "nvcc -std c++20" work?

Offline

#3 2026-05-04 17:23:43

silver-lasombra
Member
Registered: 2024-08-14
Posts: 30

Re: nvcc isn't compatiable with gcc16

seth wrote:

Does "nvcc -std c++20" work?

Yes, it works without any error.

Offline

#4 2026-05-04 19:50:47

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,462
Website

Re: nvcc isn't compatiable with gcc16

Mod note: moving to programming and scripting.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2026-05-04 20:09:04

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,122

Re: nvcc isn't compatiable with gcc16

@silver-lasombra

Is there an open problem?

Offline

#6 2026-05-05 02:06:10

silver-lasombra
Member
Registered: 2024-08-14
Posts: 30

Re: nvcc isn't compatiable with gcc16

I'm trying to compile stable-diffusion.cpp with gcc16 and nvcc -std=c++20
But in the submodule there is:

./ggml/src/CMakeLists.txt:467:    target_compile_features   (${target} PRIVATE c_std_11 cxx_std_17) # don't bump

In fact the master branch of ggml still reqiures old standard:

foreach (target ggml-base ggml)
    target_include_directories(${target} PUBLIC    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include> $<INSTALL_INTERFACE:include>)
    target_compile_features   (${target} PRIVATE c_std_11 cxx_std_17) # don't bump
endforeach()

I try to force c++20:

-DCMAKE_CXX_STANDARD=20 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_CUDA_FLAGS="-std=c++20" -DCMAKE_CUDA_STANDARD=20 -DCMAKE_CUDA_STANDARD_REQUIRED=ON

But it still error: (Edit: use GNU make instead of Ninja to get an easy-to-copy error log)

[  4%] Built target ggml-base
[  5%] Building CUDA object ggml/src/ggml-cuda/CMakeFiles/ggml-cuda.dir/acc.cu.o
/usr/include/c++/16.1.1/bits/binders.h(133): error: expected a type specifier
   operator()(this _Self&& __self, _CallArgs&&... __call_args)
              ^

/usr/include/c++/16.1.1/bits/binders.h(136): error: identifier "__self" is undefined
     return _S_call(__like_t<_Self, _Binder>(__self),
                                             ^

/usr/include/c++/16.1.1/functional(635): error: expected a type specifier
   operator()(this _Self&& __self, _Args&&... __args)
              ^

/usr/include/c++/16.1.1/functional(639): error: identifier "__self" is undefined
       return _Bind_ref(__self)
                        ^

/usr/include/c++/16.1.1/functional(644): error: identifier "__self" is undefined
       return _Bind_ref(__self)
                        ^

/usr/include/c++/16.1.1/functional(1148): error: expected a type specifier
        operator()(this _Self&& __self, _Args&&... __args)
                   ^

/usr/include/c++/16.1.1/functional(1152): error: identifier "__self" is undefined
   return !std::__invoke(__like_t<_Self, _Not_fn>(__self)._M_fn,
                                                  ^

/usr/include/c++/16.1.1/bits/shared_ptr_base.h(2117): error: type name is not allowed
     else if constexpr (!__builtin_is_virtual_base_of(_Tp, _Yp))
                                                      ^

/usr/include/c++/16.1.1/bits/shared_ptr_base.h(2117): error: type name is not allowed
     else if constexpr (!__builtin_is_virtual_base_of(_Tp, _Yp))
                                                           ^

/usr/include/c++/16.1.1/bits/shared_ptr_base.h(2117): error: identifier "__builtin_is_virtual_base_of" is undefined
     else if constexpr (!__builtin_is_virtual_base_of(_Tp, _Yp))
                         ^

10 errors detected in the compilation of "/media/BRbtrfs/repo/sd-cpp-gcc16/ggml/src/ggml-cuda/acc.cu".
make[2]: *** [ggml/src/ggml-cuda/CMakeFiles/ggml-cuda.dir/build.make:80:ggml/src/ggml-cuda/CMakeFiles/ggml-cuda.dir/acc.cu.o] 错误 2
make[1]: *** [CMakeFiles/Makefile2:484:ggml/src/ggml-cuda/CMakeFiles/ggml-cuda.dir/all] 错误 2
make: *** [Makefile:136:all] 错误 2

By the way there is also report in AUR:llama.cpp-cuda

Last edited by silver-lasombra (2026-05-05 10:08:27)

Offline

#7 2026-05-05 02:10:27

silver-lasombra
Member
Registered: 2024-08-14
Posts: 30

Re: nvcc isn't compatiable with gcc16

Maybe we should just add gcc15 back to official repo and make cuda use gcc15.

A lot of other cuda dependent packages (e.g gromacs) just add the older compiler as a dependency, but it will take lots of time to compile gcc15 itself.

Offline

#8 2026-05-05 07:24:49

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,122

Re: nvcc isn't compatiable with gcc16

Does

nvcc -std=c++17…

still run into the char8_t use?

Offline

#9 2026-05-05 10:01:41

silver-lasombra
Member
Registered: 2024-08-14
Posts: 30

Re: nvcc isn't compatiable with gcc16

No, std=c++17 could also compile my hello.cu mentioned above.

But when come to ggml of sd-cpp
I use:

git clone --recursive https://github.com/leejet/stable-diffusion.cpp sd-cpp-gcc16
cd sd-cpp-gcc16 && mkdir build && cd build
cmake .. -DSD_CUDA=ON -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_CUDA_FLAGS="-std=c++17" -DCMAKE_CUDA_STANDARD=17 -DCMAKE_CUDA_STANDARD_REQUIRED=ON
cmake --build . --config Release

It end up with the similar type specifier error as c++20 but not char8_t

[  4%] Built target ggml-base
[  5%] Building CUDA object ggml/src/ggml-cuda/CMakeFiles/ggml-cuda.dir/acc.cu.o
/usr/include/c++/16.1.1/functional(635): error: expected a type specifier
   operator()(this _Self&& __self, _Args&&... __args)
              ^

/usr/include/c++/16.1.1/functional(661): error: expected a type specifier
   operator()(this _Self&& __self, _Args&&... __args)
              ^

/usr/include/c++/16.1.1/functional(639): error: identifier "__self" is undefined
       return _Bind_ref(__self)
                        ^

/usr/include/c++/16.1.1/functional(644): error: identifier "__self" is undefined
       return _Bind_ref(__self)
                        ^

/usr/include/c++/16.1.1/functional(665): error: identifier "__self" is undefined
       return _Bind_ref(__self)
                        ^

/usr/include/c++/16.1.1/functional(670): error: identifier "__self" is undefined
       return _Bind_ref(__self)
                        ^

/usr/include/c++/16.1.1/functional(1148): error: expected a type specifier
        operator()(this _Self&& __self, _Args&&... __args)
                   ^

/usr/include/c++/16.1.1/functional(1152): error: identifier "__self" is undefined
   return !std::__invoke(__like_t<_Self, _Not_fn>(__self)._M_fn,
                                                  ^

/usr/include/c++/16.1.1/bits/shared_ptr_base.h(2117): error: type name is not allowed
     else if constexpr (!__builtin_is_virtual_base_of(_Tp, _Yp))
                                                      ^

/usr/include/c++/16.1.1/bits/shared_ptr_base.h(2117): error: type name is not allowed
     else if constexpr (!__builtin_is_virtual_base_of(_Tp, _Yp))
                                                           ^

/usr/include/c++/16.1.1/bits/shared_ptr_base.h(2117): error: identifier "__builtin_is_virtual_base_of" is undefined
     else if constexpr (!__builtin_is_virtual_base_of(_Tp, _Yp))
                         ^

11 errors detected in the compilation of "/media/BRbtrfs/repo/sd-cpp-gcc16/ggml/src/ggml-cuda/acc.cu".
make[2]: *** [ggml/src/ggml-cuda/CMakeFiles/ggml-cuda.dir/build.make:80:ggml/src/ggml-cuda/CMakeFiles/ggml-cuda.dir/acc.cu.o] 错误 2
make[1]: *** [CMakeFiles/Makefile2:484:ggml/src/ggml-cuda/CMakeFiles/ggml-cuda.dir/all] 错误 2
make: *** [Makefile:136:all] 错误 2

Last edited by silver-lasombra (2026-05-05 10:07:27)

Offline

#10 2026-05-05 14:53:23

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,122

Re: nvcc isn't compatiable with gcc16

Why are you trying to compile that as c++17 ?

Offline

#11 2026-05-05 16:05:50

silver-lasombra
Member
Registered: 2024-08-14
Posts: 30

Re: nvcc isn't compatiable with gcc16

seth wrote:

Why are you trying to compile that as c++17 ?

I have tried c++17 and c++20 both, they can both compile my hello.cu in my first post.
I have mentioned c++20 error in my post before you ask me if c++17 still run into the char8_t use.

Offline

#12 2026-05-05 19:38:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,122

Re: nvcc isn't compatiable with gcc16

So bottom line is that regardless of the C++ standard you're running into the "__self is undefined" issue when building acc.cu.o
"export VERBOSE=1" for the build, have you actually successfully compiled this w/ gcc15?
See https://github.com/leejet/stable-diffus … ssues/1238

Offline

#13 Yesterday 01:26:57

silver-lasombra
Member
Registered: 2024-08-14
Posts: 30

Re: nvcc isn't compatiable with gcc16

I'm compiling gcc15 from AUR...It would take long time.
But I already successfully compiled this w/ gcc14.
By the way, since the error is from the submodule ggml, I think it's understandable to refer to llama.cpp-cuda using the same submodule ggml; according to its comments gcc15 should work fine.

Offline

#14 Yesterday 04:19:55

silver-lasombra
Member
Registered: 2024-08-14
Posts: 30

Re: nvcc isn't compatiable with gcc16

seth wrote:

have you actually successfully compiled this w/ gcc15?

Build with gcc15 succeed with such command:

mkdir build-gcc15 && cd build-gcc15
cmake .. -G Ninja -DSD_CUDA=ON -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-15 -DCMAKE_C_COMPILER=/usr/bin/gcc-15 -DCMAKE_CXX_COMPILER=/usr/bin/g++-15
cmake --build . --config Release

Offline

#15 Yesterday 13:58:36

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,122

Offline

Board footer

Powered by FluxBB