ROCm / HIP-CPU

An implementation of HIP that works on CPUs, across OSes.
MIT License
112 stars 19 forks source link

<version> header requires C++ 20 #17

Closed wnissen closed 3 years ago

wnissen commented 3 years ago

Hi, It looks like the <version> header included in hip_runtime.h is a C++ 20 thing. I tried to build with: env CXX="/usr/tce/packages/clang/clang-10.0.1/bin/clang++ -std=c++17" cmake .. And got the error:

In file included from /g/g20/nissen5/proj/HIP-CPU/examples/bit_extract/bit_extract.cpp:5:
/g/g20/nissen5/proj/HIP-CPU/examples/bit_extract/../../include/hip/hip_runtime.h:7:10: fatal error: 'version' file not found
#include <version>
         ^~~~~~~~~
1 error generated.

I'm just playing around for a hackathon today so I can use whatever compiler I like, but if you're targeting C++ 17 you may want to use something else. Thanks.

wnissen commented 3 years ago

Hi, looks like this is my issue, sorry. Our compilers are configured to use the system headers (which are ancient GCC 4.9.3) even on the new Clangs. I'm trying it out with LLVM Libc++ and I'll let you know if I have any more issues. Thanks!

bcaddy commented 2 years ago

How exactly did you solve this? I'm running into the same issue and adding -stdlib=libc++ isn't fixing it

AlexVlx commented 2 years ago

You need to have an up-to-date version of the standard library - what are the versions for GCC / LLVM that you're seeing this with?

bcaddy commented 2 years ago

Like the other user this is on my end. I'm using CCE which doesn't support C++17. I'm trying now to use a different compiler. Thank you

skyreflectedinmirrors commented 2 years ago

FWIW, you might be able to point CCE (or any clang) to a newer GCC installed on the system via (e.g.,) --gcc-toolchain (see the bottom here: https://llvm.org/docs/GettingStarted.html#getting-a-modern-host-c-toolchain)

wnissen commented 2 years ago

@bcaddy , @arghdos has the right magic. Something like: clang++ --gcc-toolchain=/usr/tcetmp/packages/gcc/gcc-4.9.3