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

Fails to build with musl-gcc w/ linux-lts headers (no struct clone_args) #737

Closed
copy opened this issue Jun 10, 2024 · 1 comment · Fixed by #741
Closed

Fails to build with musl-gcc w/ linux-lts headers (no struct clone_args) #737

copy opened this issue Jun 10, 2024 · 1 comment · Fixed by #741

Comments

@copy
Copy link
Contributor

copy commented Jun 10, 2024

I install musl-gcc and kernel-headers-musl on Arch Linux, then create a switch with CC=musl-gcc opam switch create .... Installing eio_linux fails as follows:

File "lib_eio_linux/dune", line 13, characters 9-18:
13 |   (names eio_stubs))
              ^^^^^^^^^
(cd _build/default/lib_eio_linux && /usr/bin/musl-gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -pthread -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -g -I /home/fabian/.opam/5.2.0+musl/lib/ocaml -I /home/fabian/.opam/5.2.0+musl/lib/bigstringaf -I /home/fabian/.opam/5.2.0+musl/lib/cstruct -I /home/fabian/.opam/5.2.0+musl/lib/domain-local-await -I /home/fabian/.opam/5.2.0+musl/lib/eio -I /home/fabian/.opam/5.2.0+musl/lib/eio/core -I /home/fabian/.opam/5.2.0+musl/lib/eio/unix -I /home/fabian/.opam/5.2.0+musl/lib/eio/utils -I /home/fabian/.opam/5.2.0+musl/lib/fmt -I /home/fabian/.opam/5.2.0+musl/lib/hmap -I /home/fabian/.opam/5.2.0+musl/lib/logs -I /home/fabian/.opam/5.2.0+musl/lib/lwt-dllist -I /home/fabian/.opam/5.2.0+musl/lib/mtime -I /home/fabian/.opam/5.2.0+musl/lib/mtime/clock/os -I /home/fabian/.opam/5.2.0+musl/lib/ocaml/threads -I /home/fabian/.opam/5.2.0+musl/lib/ocaml/unix -I /home/fabian/.opam/5.2.0+musl/lib/optint -I /home/fabian/.opam/5.2.0+musl/lib/psq -I /home/fabian/.opam/5.2.0+musl/lib/seq -I /home/fabian/.opam/5.2.0+musl/lib/thread-table -I /home/fabian/.opam/5.2.0+musl/lib/uring -I ../lib_eio/unix/include -o eio_stubs.o -c eio_stubs.c)
eio_stubs.c:161:42: warning: ‘struct clone_args’ declared inside parameter list will not be visible outside of this definition or declaration
  161 | static pid_t clone3_with_fallback(struct clone_args *cl_args) {
      |                                          ^~~~~~~~~~
eio_stubs.c: In function ‘clone3_with_fallback’:
eio_stubs.c:162:42: error: invalid use of undefined type ‘struct clone_args’
  162 |   int *pidfd = (int *)(uintptr_t) cl_args->pidfd;
      |                                          ^~
...

Note that the kernel-headers-musl package uses 4.19.88 (LTS) headers, which don't have struct clone_args: https://github.com/sabotage-linux/kernel-headers

@talex5
Copy link
Collaborator

talex5 commented Jun 14, 2024

eio_stubs.c provides its own struct clone_args for older kernels:

#ifndef SYS_clone3
# define SYS_clone3 435
# define CLONE_PIDFD 0x00001000
struct clone_args {
uint64_t flags;
uint64_t pidfd;
uint64_t child_tid;
uint64_t parent_tid;
uint64_t exit_signal;
uint64_t stack;
uint64_t stack_size;
uint64_t tls;
uint64_t set_tid;
uint64_t set_tid_size;
uint64_t cgroup;
};
#endif

If you can figure out the right ifdef, it should be an easy fix!

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 a pull request may close this issue.

2 participants