ocaml / ocaml/dune

Mode `(byte shared_object)` cannot find stubs in Dune >= 2.1

Open
#3,910 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build c-bindings
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

Hi all,

I'm trying to build https://github.com/janestreet/pythonlib/tree/master/examples , however, there seems to be a regression from dune 2.0 to dune 2.1.3 ; with dune 2.0.1 things build fine, however with >= 2.1.3. I get:

 ocamlc examples/ocaml.bc.so (exit 2)
(cd _build/default && /home/egallego/.opam/coq-dune/bin/ocamlc.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence -strict-formats -short-paths -keep-locs -linkall -g -o examples/ocaml.bc.so -output-complete-obj -runtime-variant _pic /home/egallego/.opam/coq-dune/lib/base/base_internalhash_types/base_internalhash_types.cma /home/egallego/.opam/coq-dune/lib/base/caml/caml.cma /home/egallego/.opam/coq-dune/lib/sexplib0/sexplib0.cma /home/egallego/.opam/coq-dune/lib/base/shadow_stdlib/shadow_stdlib.cma /home/egallego/.opam/coq-dune/lib/base/base.cma /home/egallego/.opam/coq-dune/lib/ocaml/compiler-libs/ocamlcommon.cma /home/egallego/.opam/coq-dune/lib/ocaml/compiler-libs/ocamlbytecomp.cma /home/egallego/.opam/coq-dune/lib/ocaml/compiler-libs/ocamltoplevel.cma /home/egallego/.opam/coq-dune/lib/ocaml/unix.cma /home/egallego/.opam/coq-dune/lib/stdcompat/stdcompat.cma /home/egallego/.opam/coq-dune/lib/pyml/pyml.cma /home/egallego/.opam/coq-dune/lib/pyml/numpy.cma /home/egallego/.opam/coq-dune/lib/stdio/stdio.cma /home/egallego/.opam/coq-dune/lib/typerep/typerep_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_sexp_conv/runtime-lib/ppx_sexp_conv_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_compare/runtime-lib/ppx_compare_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_enumerate/runtime-lib/ppx_enumerate_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_hash/runtime-lib/ppx_hash_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_python/runtime/ppx_python_runtime.cma /home/egallego/.opam/coq-dune/lib/ppx_inline_test/config/inline_test_config.cma /home/egallego/.opam/coq-dune/lib/jane-street-headers/jane_street_headers.cma /home/egallego/.opam/coq-dune/lib/time_now/time_now.cma /home/egallego/.opam/coq-dune/lib/ppx_inline_test/runtime-lib/ppx_inline_test_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_here/runtime-lib/ppx_here_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_expect/common/expect_test_common.cma /home/egallego/.opam/coq-dune/lib/ppx_expect/config_types/expect_test_config_types.cma /home/egallego/.opam/coq-dune/lib/ppx_expect/collector/expect_test_collector.cma /home/egallego/.opam/coq-dune/lib/ppx_expect/config/expect_test_config.cma src/python_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_assert/runtime-lib/ppx_assert_lib.cma /home/egallego/.opam/coq-dune/lib/ppx_bench/runtime-lib/ppx_bench_lib.cma /home/egallego/.opam/coq-dune/lib/base/md5/md5_lib.cma /home/egallego/.opam/coq-dune/lib/ocaml/bigarray.cma /home/egallego/.opam/coq-dune/lib/fieldslib/fieldslib.cma /home/egallego/.opam/coq-dune/lib/variantslib/variantslib.cma /home/egallego/.opam/coq-dune/lib/bin_prot/shape/bin_shape_lib.cma /home/egallego/.opam/coq-dune/lib/bin_prot/bin_prot.cma /home/egallego/.opam/coq-dune/lib/ppx_module_timer/runtime/ppx_module_timer_runtime.cma /home/egallego/.opam/coq-dune/lib/splittable_random/splittable_random.cma /home/egallego/.opam/coq-dune/lib/base_quickcheck/base_quickcheck.cma examples/init/python_ocaml_init.cma -I examples/init examples/.ocaml.eobjs/byte/dune__exe.cmo examples/.ocaml.eobjs/byte/dune__exe__Toploop_bindings.cmo examples/.ocaml.eobjs/byte/dune__exe__Ocaml.cmo)
/usr/bin/ld: cannot find -lbin_prot_stubs
/usr/bin/ld: cannot find -lexpect_test_collector_stubs
/usr/bin/ld: cannot find -ltime_now_stubs
/usr/bin/ld: cannot find -lnumpy_stubs
/usr/bin/ld: cannot find -lpyml_stubs
/usr/bin/ld: cannot find -lstdcompat__stubs
/usr/bin/ld: cannot find -lbase_stubs
/usr/bin/ld: cannot find -lbase_internalhash_types_stubs
collect2: error: ld returned 1 exit status
File "_none_", line 1:
Error: Error while building custom runtime system

Any idea on what is going on? I could research more, but I'm not very familiar with the code so maybe anyone here has an idea on what is going on.

This is likely related to #2994 ; other users are facing the same problem, see https://github.com/janestreet/pythonlib/issues/1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by building the pythonlib examples with Dune 2.0.1 and 2.1.3 or later. Start with the examples directory, the custom runtime link command, and related issue #2994; done means the byte shared_object build locates the listed native stubs and completes successfully.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.