Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: 'climits' file not found #15910

Open
vidyalathabadde opened this issue Oct 29, 2024 · 7 comments
Open

fatal error: 'climits' file not found #15910

vidyalathabadde opened this issue Oct 29, 2024 · 7 comments
Labels
bug Something isn't working cuda CUDA back-end

Comments

@vidyalathabadde
Copy link

vidyalathabadde commented Oct 29, 2024

Describe the bug

I'm unable to compile a SYCL migrated code on NVIDIA CUDA backend (H100) getting climits not found error
tried fixing it manually by including the path of climits throws another error which says <bits/c++config.h> not found.

To reproduce

Reproducer:

#include<sycl/sycl.hpp>
int main()
{
return 0;
}

To compile:
clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda test.cpp

Error:

In file included from test.cpp:1:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/sycl.hpp:11:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/detail/core.hpp:21:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/accessor.hpp:11:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/access/access.hpp:14:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/__spirv/spirv_ops.hpp:11:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/__spirv/spirv_types.hpp:11:
vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/detail/defines.hpp:14:10: fatal error: 'climits' file not found
   14 | #include <climits>
      |          ^~~~~~~~~
1 error generated.

Tried fixing it manually by passing the path of climits but ended up with another error

To compile:

clang++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda -I /usr/include/c++/11/ -L /usr/lib/gcc/x86_64-linux-gnu/11/ -lstdc++ test.cpp

Error:

In file included from test.cpp:1:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/sycl.hpp:11:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/detail/core.hpp:21:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/accessor.hpp:11:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/access/access.hpp:14:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/__spirv/spirv_ops.hpp:11:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/__spirv/spirv_types.hpp:11:
In file included from vidya/new_wmma_sample/clang_2024-10-25/bin/../include/sycl/detail/defines.hpp:14:
/usr/include/c++/11/climits:41:10: fatal error: 'bits/c++config.h' file not found
   41 | #include <bits/c++config.h>
      |          ^~~~~~~~~~~~~~~~~~
1 error generated.

Environment

  • OS: Linux
  • Target device and vendor: NVIDIA H100 PCIe
  • clang++ --version:
clang version 20.0.0git (https://github.com/intel/llvm 7b9615c8784c83745159e11668cc15f6026bdce2)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: vidya/new_wmma_sample/clang_2024-10-25/bin
Build config: +assertions

Additional context

No response

@vidyalathabadde vidyalathabadde added the bug Something isn't working label Oct 29, 2024
@0x12CC 0x12CC added the cuda CUDA back-end label Oct 29, 2024
@sarnex
Copy link
Contributor

sarnex commented Oct 30, 2024

I've seen this before with broken libstdc++ installs or libstdc++ installs clang can't find.

If you run
clang -v, do you see anything like

Found candidate GCC installation: /usr/lib/gcc/i686-redhat-linux/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/11
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/11

@vidyalathabadde
Copy link
Author

Here is the output:

clang version 20.0.0git (https://github.com/intel/llvm 7b9615c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: vidya/new_wmma_sample/clang_2024-10-25/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/lib/cuda, version 12.0

@sarnex
Copy link
Contributor

sarnex commented Oct 31, 2024

I'm not sure why it's trying to use /usr/include/c++/11/. How did you build the compiler?

@hvdijk
Copy link
Contributor

hvdijk commented Oct 31, 2024

I'm not sure why it's trying to use /usr/include/c++/11/.

It's not. The OP was explicitly passing -I /usr/include/c++/11/ to work around the error. The compiler on its own picks the latest installed GCC, which here is GCC 14 and would cause /usr/include/c++/11/ to not be used:

Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14

I've seen this before with broken libstdc++ installs or libstdc++ installs clang can't find.

It can also happen when the installation of GCC 14 only included the C compiler, not the C++ compiler or its associated headers. In that case, Clang will still pick that installation of GCC on account of it being the most recent one.

Installing the version of libstdc++ that matches the latest available GCC should solve the problem. The exact package name will depend on the distribution, e.g. on Ubuntu it would be apt install libstdc++-14-dev.

@bader
Copy link
Contributor

bader commented Oct 31, 2024

I've seen this issue reported multiple times already.

The answer to this problem deserves to be documented in FAQ.

In addition to that, we should probably improve the Get Started Guide to emphasize the importance of using the right stdc++ package.

@vidyalathabadde
Copy link
Author

apt install libstdc++-14-dev

Thanks a lot for all your replies, but I don't have root access to install compatible libstdc++ version in the machine i work. Do you have any other suggestions to workaround the issue?

@sarnex
Copy link
Contributor

sarnex commented Nov 4, 2024

You can try installing it to a directory you have permission to and using the --gcc-toolchain or --gcc-install-dir to point clang there. I'm not sure if you need other packages (like glibc) in that folder too though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda CUDA back-end
Projects
None yet
Development

No branches or pull requests

5 participants