> On 13 Nov 2025, at 6:59 AM, Jed Brown <[email protected]> wrote:
> 
> I'm assuming that you configured and built PETSc with gcc, and now are 
> building a package that depends on PETSc using AOCC? Is it possible to 
> configure PETSc with the same compiler, or to use -std=gnu++17 (any dialect 
> that supports GNU extensions)?

Do what Jed suggests.
But to give you a thorough answer, this FreeFEM post got me to fix some missing 
code in PETSc 
https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/merge_requests/7868__;!!G_uCfscf7eWS!ZCDn8GMjZjjHKboEmYNh_DysRggGBuwNc5uVk819bJyjAPCkifplTawg0JU1vik-GoaLgcKII1fsCidj5CrSqw$
 .
So now, the more “elegant” solution of defining PETSC_SKIP_REAL___FLOAT128 
(which was not working back then) should work given that you are using a recent 
enough PETSc (it seems you are using version 3.21.0, we are at 3.24.1, and the 
fix is there since 3.21.6).
But again, try what Jed suggests first and foremost.

Thanks,
Pierre

> Benjamin Chapman via petsc-users <[email protected]> writes:
> 
>> Hello,
>> 
>> We are using PETSc as part of a larger project and are switching from 
>> compiling with gcc to using AOCC (clang). However, I am getting an error 
>> from my include statements stating that the data type __complex128 is an 
>> "unknown type name". The full error log is attached.
>> 
>> I found this solution online (FreeFem - PETSc compilation error - 
>> libblas.a/liblapack.a cannot be used - FreeFEM installation - 
>> FreeFEM<https://urldefense.us/v3/__https://community.freefem.org/t/freefem-petsc-compilation-error-libblas-a-liblapack-a-cannot-be-used/2771/8__;!!G_uCfscf7eWS!fqL9KO-Su4o3uzl3iGDcskkh1utILAAeNaaZ25v6yAZ2CEn2axOiqwOCYwJHMlq_jQwt9Oc4FXRaM9tMvfMBVx5mCetoylgskpID89ee$
>>  >), which says to comment out a line in the petscconf.h header file. Is 
>> this a safe fix or is there a more elegant way to go about this?
>> 
>> Best,
>> Ben
>> [ 64%] Building CXX object 
>> src/CMakeFiles/rebel_lib.dir/common/coordinate_system.cpp.o
>> [ 65%] Building CXX object 
>> src/CMakeFiles/rebel_lib.dir/common/FFTW_interface.cpp.o
>> [ 65%] Building CXX object src/CMakeFiles/rebel_lib.dir/common/fileIO.cpp.o
>> [ 66%] Building CXX object 
>> src/CMakeFiles/rebel_lib.dir/common/lapacke_interface.cpp.o
>> [ 66%] Building CXX object 
>> src/CMakeFiles/rebel_lib.dir/common/petsc_extensions.cpp.o
>> In file included from 
>> /mnt/scratch/bchapman/rebel/src/common/petsc_extensions.cpp:7:
>> In file included from 
>> /mnt/scratch/bchapman/rebel/src/common/petsc_extensions.h:14:
>> In file included from 
>> /mnt/scratch/bchapman/rebel/build/external/builds/petsc-3.21.0/include/petscksp.h:6:
>> In file included from 
>> /mnt/scratch/bchapman/rebel/build/external/builds/petsc-3.21.0/include/petscpc.h:6:
>> In file included from 
>> /mnt/scratch/bchapman/rebel/build/external/builds/petsc-3.21.0/include/petscmat.h:6:
>> In file included from 
>> /mnt/scratch/bchapman/rebel/build/external/builds/petsc-3.21.0/include/petscvec.h:8:
>> In file included from 
>> /mnt/scratch/bchapman/rebel/build/external/builds/petsc-3.21.0/include/petscsys.h:193:
>> /mnt/scratch/bchapman/rebel/build/external/builds/petsc-3.21.0/include/petscmath.h:429:45:
>>  error: unknown type name '__complex128'
>>  429 | PETSC_EXTERN MPI_Datatype MPIU___COMPLEX128 
>> MPIU___COMPLEX128_ATTR_TAG;
>>      |                                             ^
>> /mnt/scratch/bchapman/rebel/build/external/builds/petsc-3.21.0/include/petscmath.h:424:71:
>>  note: expanded from macro 'MPIU___COMPLEX128_ATTR_TAG'
>>  424 |       #define MPIU___COMPLEX128_ATTR_TAG 
>> PETSC_ATTRIBUTE_MPI_TYPE_TAG(__complex128)
>>      |                                                                       
>> ^
>> /mnt/scratch/bchapman/rebel/src/common/petsc_extensions.cpp:2570:13: 
>> warning: decomposition declarations are a C++17 extension 
>> [-Wc++17-extensions]
>> 2570 |         const auto [min, max] = std::minmax_element(std::begin(s), 
>> std::end(s));
>>      |                    ^~~~~~~~~~
>> 1 warning and 1 error generated.
>> make[2]: *** [src/CMakeFiles/rebel_lib.dir/build.make:132: 
>> src/CMakeFiles/rebel_lib.dir/common/petsc_extensions.cpp.o] Error 1
>> make[1]: *** [CMakeFiles/Makefile2:772: src/CMakeFiles/rebel_lib.dir/all] 
>> Error 2
>> make: *** [Makefile:136: all] Error 2

Reply via email to