solo5 icon indicating copy to clipboard operation
solo5 copied to clipboard

Fetch `stdatomic.h` from system on FreeBSD

Open shym opened this issue 1 year ago • 5 comments

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.

shym avatar Apr 18 '24 11:04 shym

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

hannesm avatar Apr 18 '24 16:04 hannesm

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.

shym avatar Apr 18 '24 16:04 shym

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 avatar Apr 18 '24 16:04 hannesm

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 :)

hannesm avatar Apr 18 '24 16:04 hannesm

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
[...]

shym avatar Apr 18 '24 16:04 shym

Thanks!

dinosaure avatar Oct 10 '24 14:10 dinosaure