janestreet / base

Standard library for OCaml
MIT License
848 stars 124 forks source link

Linker error on macOS with base 0.16.1 #154

Closed anuragsoni closed 1 year ago

anuragsoni commented 1 year ago

After updating base to the newly published 0.16.1, I'm noticing a compilation error (only on macOS) in some of my test libraries that use async.

duplicate symbol '_caml_csel_value' in:
    /Users/anuragsoni/.opam/5.0.0-flambda/lib/base/libbase_stubs.a(int_math_stubs.o)
    /Users/anuragsoni/.opam/5.0.0-flambda/lib/ocaml_intrinsics/libocaml_intrinsics_stubs.a(conditional_stubs.o)
ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking (exit code 1)

The comment on https://github.com/janestreet/base/commit/7ef8a32cf22b6584b843e00acbf5803c2b3803de indicates ocaml_intrinsics not supporting macOS as a reason for excluding macOS from the list of platforms that will tag caml_csel_value is tagged as weak, but from what I can tell ocaml_instrinsics is only disabled for win32 platforms (https://github.com/janestreet/ocaml_intrinsics/pull/5 added macOS support).

Locking base to 0.16.0, or updating the #ifdef check to also include Apple (#if defined(__ELF__) || defined(__APPLE__)) both help resolve the issue.

dkalinichenko-js commented 1 year ago

Should be also resolved by https://github.com/janestreet/base/pull/152, which we aim to include in Base v0.16.2 and release this week.

dkalinichenko-js commented 1 year ago

Resolved in v0.16.2.

tmcgilchrist commented 1 year ago

Thanks @dkalinichenko-js v0.16.2 is working for me.