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

Fetch stdatomic.h from system on FreeBSD #574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shym
Copy link

@shym shym commented Apr 18, 2024

This PR adds stdatomic.h to the set of headers that must be copied over from /usr/include on FreeBSD because it is not included in the clang resources on that system.

stdatomic.h is not listed in the C standard as a freestanding header but many atomic operations (in particular all the atomic operations the OCaml runtime uses) are really compiler builtins.

Add `stdatomic.h` to the set of headers that must be copied over from
`/usr/include` on FreeBSD because it is not included in the clang
resources on that system

`stdatomic.h` is not listed in the C standard as a freestanding header
but many atomic operations (in particular all the atomic operations the
OCaml runtime uses) are really compiler builtins
@hannesm
Copy link
Contributor

hannesm commented Apr 18, 2024

to me, this looks fine. I'm curious whether other systems need this as well? especially OpenBSD?

@shym
Copy link
Author

shym commented Apr 18, 2024

I expected so too but, at least on OpenBSD 7.3, stdatomic.h is in the Clang resources and I could compile the OCaml 5.2 runtime which needs this header with the current solo5 package.

@hannesm
Copy link
Contributor

hannesm commented Apr 18, 2024

The reason may be that the gen_headers.sh does a cd /usr/include and cc -M float.h stddef.h stdint.h stdbool.h stdarg.h to figure out all dependencies of these header files -- eventually an OpenBSD system includes atomic.h/stdatomic.h in these dependencies...

@hannesm
Copy link
Contributor

hannesm commented Apr 18, 2024

hmm, on a OpenBSD 7.4 system I have access to, there's just no atomic.h, neither a stdatomic.h... but a sys/atomic.h -- and the cc -M doesn't show it up... well, I don't have insights into the OCaml configure, but if it works without copying stuff, that's fine :)

@shym
Copy link
Author

shym commented Apr 18, 2024

On an OpenBSD 7.5, I see:

$ echo '#include <stdatomic.h>' > test.c
$ cc -H -c test.c
. /usr/lib/clang/16/include/stdatomic.h
[...]

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

Successfully merging this pull request may close these issues.

None yet

2 participants