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

Add _BSD_SOURCE flag to fix eio_posix on OpenBSD. #722

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

prgbln
Copy link
Contributor

@prgbln prgbln commented Apr 4, 2024

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.

Copy link
Collaborator

@talex5 talex5 left a comment

Choose a reason for hiding this comment

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

Thanks - looks good to merge once CI has finished!

@talex5 talex5 merged commit 58aa3f6 into ocaml-multicore:main Apr 4, 2024
5 checks passed
talex5 added a commit to talex5/opam-repository that referenced this pull request May 28, 2024
CHANGES:

New features:

- Add `Eio.Path.symlink` (@patricoferris ocaml-multicore/eio#715, reviewed by @talex5).

- Add `Eio.Pool.use ~never_block` (@SGrondin ocaml-multicore/eio#657, reviewed by @talex5).

- Add `Eio_unix.Net.import_socket_listening` (@alyssais ocaml-multicore/eio#733).

- Add `Eio.Time.Timeout.sleep` (@talex5 ocaml-multicore/eio#726).

Documentation:

- Add `examples/fs` showing how to walk a directory tree (@talex5 ocaml-multicore/eio#730).

- README: explain that `read_all` reads until shutdown (@talex5 ocaml-multicore/eio#717, reported by @Wenke-D).

- Use long dash in README title (@lucperkins ocaml-multicore/eio#718).

Linux backend:

- Require Linux >= 5.15 (@talex5 ocaml-multicore/eio#720, reviewed by @SGrondin and @avsm).
  Removes a work-around that required checking whether every flow was a tty.

- Don't call submit immediately before wait (@talex5 ocaml-multicore/eio#728).
  This is slightly faster and makes the traces clearer.

- Don't record submit events when there's nothing to submit (@talex5 ocaml-multicore/eio#729).
  Makes the traces a bit clearer.

- Split flow into its own file (@talex5 ocaml-multicore/eio#727).

- Add work-around for signals race (@talex5 ocaml-multicore/eio#734).

POSIX backend:

- Add `_BSD_SOURCE` flag to fix build on OpenBSD (@prgbln ocaml-multicore/eio#722).

- Fix sandboxed path resolution on OpenBSD (@jebrosen ocaml-multicore/eio#723, reviewed by @talex5).
  OpenBSD uses `ELOOP` when opening a symlink with `O_NOFOLLOW`.

Build and test:

- Benchmarks: record uname, Eio backend, and number of cores (@talex5 ocaml-multicore/eio#719).

- Update to MDX 2.4.1 for OCaml 5.2 (@talex5 ocaml-multicore/eio#712).
talex5 added a commit to talex5/opam-repository that referenced this pull request May 28, 2024
CHANGES:

New features:

- Add `Eio.Path.symlink` (@patricoferris ocaml-multicore/eio#715, reviewed by @talex5).

- Add `Eio.Pool.use ~never_block` (@SGrondin ocaml-multicore/eio#657, reviewed by @talex5).

- Add `Eio_unix.Net.import_socket_listening` (@alyssais ocaml-multicore/eio#733, reviewed by @talex5).

- Add `Eio.Time.Timeout.sleep` (@talex5 ocaml-multicore/eio#726).

Documentation:

- Add `examples/fs` showing how to walk a directory tree (@talex5 ocaml-multicore/eio#730).

- README: explain that `read_all` reads until shutdown (@talex5 ocaml-multicore/eio#717, reported by @Wenke-D).

- Use long dash in README title (@lucperkins ocaml-multicore/eio#718).

Linux backend:

- Require Linux >= 5.15 (@talex5 ocaml-multicore/eio#720, reviewed by @SGrondin and @avsm).
  Removes a work-around that required checking whether every flow was a tty.

- Don't call submit immediately before wait (@talex5 ocaml-multicore/eio#728).
  This is slightly faster and makes the traces clearer.

- Don't record submit events when there's nothing to submit (@talex5 ocaml-multicore/eio#729).
  Makes the traces a bit clearer.

- Split flow into its own file (@talex5 ocaml-multicore/eio#727).

- Add work-around for signals race (@talex5 ocaml-multicore/eio#734).

POSIX backend:

- Add `_BSD_SOURCE` flag to fix build on OpenBSD (@prgbln ocaml-multicore/eio#722).

- Fix sandboxed path resolution on OpenBSD (@jebrosen ocaml-multicore/eio#723, reviewed by @talex5).
  OpenBSD uses `ELOOP` when opening a symlink with `O_NOFOLLOW`.

Build and test:

- Benchmarks: record uname, Eio backend, and number of cores (@talex5 ocaml-multicore/eio#719).

- Update to MDX 2.4.1 for OCaml 5.2 (@talex5 ocaml-multicore/eio#712).
avsm pushed a commit to avsm/opam-repository that referenced this pull request Sep 5, 2024
CHANGES:

New features:

- Add `Eio.Path.symlink` (@patricoferris ocaml-multicore/eio#715, reviewed by @talex5).

- Add `Eio.Pool.use ~never_block` (@SGrondin ocaml-multicore/eio#657, reviewed by @talex5).

- Add `Eio_unix.Net.import_socket_listening` (@alyssais ocaml-multicore/eio#733, reviewed by @talex5).

- Add `Eio.Time.Timeout.sleep` (@talex5 ocaml-multicore/eio#726).

Documentation:

- Add `examples/fs` showing how to walk a directory tree (@talex5 ocaml-multicore/eio#730).

- README: explain that `read_all` reads until shutdown (@talex5 ocaml-multicore/eio#717, reported by @Wenke-D).

- Use long dash in README title (@lucperkins ocaml-multicore/eio#718).

Linux backend:

- Require Linux >= 5.15 (@talex5 ocaml-multicore/eio#720, reviewed by @SGrondin and @avsm).
  Removes a work-around that required checking whether every flow was a tty.

- Don't call submit immediately before wait (@talex5 ocaml-multicore/eio#728).
  This is slightly faster and makes the traces clearer.

- Don't record submit events when there's nothing to submit (@talex5 ocaml-multicore/eio#729).
  Makes the traces a bit clearer.

- Split flow into its own file (@talex5 ocaml-multicore/eio#727).

- Add work-around for signals race (@talex5 ocaml-multicore/eio#734).

POSIX backend:

- Add `_BSD_SOURCE` flag to fix build on OpenBSD (@prgbln ocaml-multicore/eio#722).

- Fix sandboxed path resolution on OpenBSD (@jebrosen ocaml-multicore/eio#723, reviewed by @talex5).
  OpenBSD uses `ELOOP` when opening a symlink with `O_NOFOLLOW`.

Build and test:

- Benchmarks: record uname, Eio backend, and number of cores (@talex5 ocaml-multicore/eio#719).

- Update to MDX 2.4.1 for OCaml 5.2 (@talex5 ocaml-multicore/eio#712).
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.

2 participants