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

'atomic' header not found when comiling Odin #3376

Closed
max22- opened this issue Apr 4, 2024 · 6 comments
Closed

'atomic' header not found when comiling Odin #3376

max22- opened this issue Apr 4, 2024 · 6 comments

Comments

@max22-
Copy link

max22- commented Apr 4, 2024

Context

I can't manage to compile Odin on Debian testing (Trixie), on a x86_64. But when I compile it inside a docker image (based on the same distribution) it works.

I've tried with llvm-17 and llvm-14, still the same. I've also installed libx32stdc++-12-dev, as stated on the Getting Started page.

  • Operating System & Odin Version: Debian testing (trixie), Odin commit id 8899f42 ( also retried with 510574a )
  • Please paste odin report output:

generated from the version i built with the docker image :

Odin:    dev-2024-03:8899f4247
OS:      Debian GNU/Linux trixie/sid, Linux 6.6.15-amd64
CPU:     12th Gen Intel(R) Core(TM) i7-12700F
RAM:     15857 MiB
Backend: LLVM 17.0.6

Expected Behavior

It should compile.

Current Behavior

It doesn't find the "atomic" c++ header.

Failure Information (for bugs)

Steps to Reproduce

I can't reproduce it since it works inside docker, with the same distribution.
Dockerfile used :
Dockerfile.txt

Failure Logs

$ make
./build_odin.sh debug
+ clang++ src/main.cpp src/libtommath.cpp -Wno-switch -Wno-macro-redefined -Wno-unused-value -DODIN_VERSION_RAW="dev-2024-04" -DGIT_SHA="510574aa7" -std=c++14 -I/usr/lib/llvm-17/include -std=c++17 -fno-exceptions -funwind-tables -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -L/usr/lib/llvm-17/lib -g -pthread -lm -lstdc++ -ldl /usr/lib/llvm-17/lib/libLLVM-17.so -Wl,-rpath=$ORIGIN -o odin
In file included from src/main.cpp:2:
src/common.cpp:30:10: fatal error: 'atomic' file not found
#include <atomic> // Because I wanted the C++11 memory order semantics, of which gb.h does not offer (because it was a C89 library)
         ^~~~~~~~

@refual
Copy link

refual commented Apr 23, 2024

Looks like a typo on the "Getting Started" page. The package you're actually looking for is libstdc++-12-dev, i.e. without the "x32" in the name.

@max22-
Copy link
Author

max22- commented Apr 23, 2024

this package is already installed on my system but it still doesn't work :(
i've checked where the atomic header is located in the docker image :
/usr/include/c++/13/atomic
It is present at the same location on my linux distro, i don't understand...
it's not a big deal for me because i can use the version i've built using docker, but it could maybe be useful to find the reason for other users ?

@jimhub
Copy link

jimhub commented Apr 26, 2024

I've had the same issue on Mint. I fix it by installing libc++-dev and g++-12.

@refual
Copy link

refual commented Apr 28, 2024

this package is already installed on my system but it still doesn't work :( i've checked where the atomic header is located in the docker image : /usr/include/c++/13/atomic It is present at the same location on my linux distro, i don't understand...

Looking into it some more it seems you should run clang++ -v to find out which version of GCC it wants to use and install the corresponding libstd++-dev package for that. On my system (Ubuntu 22.04) that was version 12:

$ clang++ -v
...
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12

Note that this is indeed gcc-12 and not g++-12 as I don't have g++-12 installed on my system and I can build the compiler just fine.

@max22-
Copy link
Author

max22- commented Apr 29, 2024

clang++ -v returned this :

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

I installed libstdc++-14-dev, and now it works, thank you !!

@max22- max22- closed this as completed Apr 29, 2024
@joaocarvalhoopen
Copy link
Sponsor

joaocarvalhoopen commented May 19, 2024

Hello,

In Linux OpenSuse Tumbleweed with LLVM 18, if it gives us the following error:

In file included from src/main.cpp:2:
src/common.cpp:30:10: fatal error: 'atomic' file not found
   30 | #include <atomic> // Because I wanted the C++11 memory order semantics, of which gb.h does not offer (because it was a C89 library)
      |          ^~~~~~~~
1 error generated.
make: *** [Makefile:10: debug] Error 1

We have to issue the following command

clang++ -v
(base) joaocarvalho@soundofsilence:~/odin/Odin> clang++ -v
clang version 18.1.5
Target: x86_64-suse-linux
Thread model: posix
InstalledDir: /usr/bin
System configuration file directory: /etc/clang
User configuration file directory: /home/joaocarvalho/.config/clang
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/12
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/13
Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/14
Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/14
Candidate multilib: .;@m64
Selected multilib: .;@m64

We then see that it is the gcc 14 that is in use by clang++ and then we have to install the corresponding gcc version of the libstdc++ :

OpenSuse Tumbleweed compilation of Odin with llvm 18 I had to install:

libstdc++6-devel-gcc14

do:

sudo zypper install libstdc++6-devel-gcc14

then do again:

make

Note: This was made ( solved ) according the current thread and from the help of Jason and Layton:

'atomic' header not found when comiling Odin #3376
#3376

Thank you very much Jason,
and thank you very much Laytan!

Best regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants