Skip to content

dune fails to build on termux due to missing wait3/pthreads #8676

@purarue

Description

@purarue

Expected Behavior

opam install dune installs dune

Perhaps related #7385?

Actual Behavior

$ opam install dune
The following actions will be performed:
  ∗ install dune 3.10.0

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[dune.3.10.0] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of dune failed at
        "/data/data/com.termux/files/home/.opam/5.0.0/bin/ocaml boot/bootstrap.ml
        -j 1".

#=== ERROR while compiling dune.3.10.0 ========================================#
# context     2.0.4 | linux/arm64 | ocaml-base-compiler.5.0.0 | https://opam.ocaml.org#b61304c6
# path        ~/.opam/5.0.0/.opam-switch/build/dune.3.10.0
# command     ~/.opam/5.0.0/bin/ocaml boot/bootstrap.ml -j 1
# exit-code   2
# env-file    ~/.opam/log/dune-18226-d2c37b.env
# output-file ~/.opam/log/dune-18226-d2c37b.out
### output ###
# extern value caml_set_oo_id();
# [...]
# /data/data/com.termux/files/home/.opam/5.0.0/lib/ocaml/caml/mlvalues.h:423:18: note: conflicting prototype is here
# CAMLextern value caml_set_oo_id(value obj);
#                  ^
# 2 warnings generated.
# ./.duneboot.exe -j 1
# cd _boot && /data/data/com.termux/files/home/.opam/5.0.0/bin/ocamlopt.opt -o ../_boot/dune.exe -g -I +unix -I +threads unix.cmxa threads.cmxa -no-alias-deps -w -49-6 readdir.c wait3_stubs.c signal_stubs.c platform_stubs.c copyfile_stubs.c dune_digest_stubs.c xdg_stubs.c spawn_stubs.c dune_stats_stubs.c dune_flock.c csexp_rpc_stubs.c fsevents_stubs.c inotify_stubs.c fswatch_win_stubs.c sha512_[...]
# otherlibs/stdune/src/wait3_stubs.c:59:9: error: call to undeclared function 'wait3'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
#   pid = wait3(&status, cv_flags, &ru);
#         ^
# 1 error generated.
#



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build dune 3.10.0

I tried cloning the repository and running make release/configure, but I get the same error

I'd guess that wait3 is something that is typically available on linux but android does not have it (not sure if I need to install a package?). I looked through the code and I see windows doesn't have access to it either

Reproduction

Because I had previously tried to build opam from source, I did install pkg install rsync clang coreutils dash diffutils make nc

If its related, documented how I installed opam here, but TL;DR is through a pre-compiled binary for termux, then disabling the bubblewrap sandbox by editing ~/.config/opam and installing 5.0.0 with LDFLAGS="-landroid-shmem" opam switch create 5.0.0 --jobs=1, mostly by following instructions from here

I did find this SBCL thread that seems to be discussing the same issue.

Specifications

  • Version of dune (output of dune --version): --
  • Version of ocaml (output of ocamlc --version): 5.0.0
  • Verison of opam: 2.0.4
  • Operating system (distribution and version): termux on android on a Pixel 5a: Linux localhost 4.19.269-g8728c337137c-ab10161573 #1 SMP PREEMPT Thu May 18 11:19:41 UTC 2023 aarch64 Android

Additional information

Link to opam install dune --verbose (though, is not too different): https://gist.github.com/seanbreckenridge/4e86d5a2b74aa4104fa129b15a1eef82

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions