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

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

shym
Copy link
Contributor

@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
@shym shym mentioned this pull request Apr 18, 2024
6 tasks
@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
Contributor 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
Contributor 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
[...]

Copy link
Contributor

@hannesm hannesm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine to me, good to include into the next release

@dinosaure
Copy link
Collaborator

Thanks!

@dinosaure dinosaure merged commit d1e7575 into Solo5:master Oct 10, 2024
@shym shym deleted the freebsd-stdatomic branch October 10, 2024 14:44
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.

3 participants