ocaml-multicore / eio

Effects-based direct-style IO for multicore OCaml
Other
562 stars 71 forks source link

Add _BSD_SOURCE flag to fix eio_posix on OpenBSD. #722

Closed prgbln closed 7 months ago

prgbln commented 7 months ago

eio_posix currently fails to build on OpenBSD 7.4 due to O_NOFOLLOW not being exposed:

#=== ERROR while compiling eio_posix.1.0 ======================================#
# context     2.0.10 | openbsd/x86_64 | ocaml-base-compiler.5.1.1 | https://opam.ocaml.org#a92d9dfb
# path        ~/.opam/5.1.1/.opam-switch/build/eio_posix.1.0
# command     ~/.opam/5.1.1/bin/dune build -p eio_posix -j 1 @install
# exit-code   1
# env-file    ~/.opam/log/eio_posix-34687-68bbf5.env
# output-file ~/.opam/log/eio_posix-34687-68bbf5.out
### output ###
# -> stderr:
# [...]
#  | /tmp/build_550fc6_dune/ocaml-configuratorf7473a/c-test-2/test.c:105:12: error: use of undeclared identifier 'O_NOFOLLOW'
#  | /tmp/build_550fc6_dune/ocaml-configuratorf7473a/c-test-2/test.c:105:12: error: use of undeclared identifier 'O_NOFOLLOW'
#  | /tmp/build_550fc6_dune/ocaml-configuratorf7473a/c-test-2/test.c:105:12: error: use of undeclared identifier 'O_NOFOLLOW'
#  | /tmp/build_550fc6_dune/ocaml-configuratorf7473a/c-test-2/test.c:105:12: error: use of undeclared identifier 'O_NOFOLLOW'
#  | /tmp/build_550fc6_dune/ocaml-configuratorf7473a/c-test-2/test.c:105:12: error: use of undeclared identifier 'O_NOFOLLOW'
#  | /tmp/build_550fc6_dune/ocaml-configuratorf7473a/c-test-2/test.c:105:12: error: use of undeclared identifier 'O_NOFOLLOW'
#  | /tmp/build_550fc6_dune/ocaml-configuratorf7473a/c-test-2/test.c:105:12: error: use of undeclared identifier 'O_NOFOLLOW'
#  | /tmp/build_550fc6_dune/ocaml-configuratorf7473a/c-test-2/test.c:105:12: error: use of undeclared identifier 'O_NOFOLLOW'
#  | fatal error: too many errors emitted, stopping now [-ferror-limit=]
#  | 20 errors generated.
# Error: failed to compile program

Adding the -D_BSD_SOURCE compiler flag fixes the issue.