Skip to content

Fix compilation error on macOS with OCaml >= 4.14.1#5

Merged
tov merged 2 commits intojanestreet:v0.15from
kit-ty-kate:fix-macos
Oct 17, 2022
Merged

Fix compilation error on macOS with OCaml >= 4.14.1#5
tov merged 2 commits intojanestreet:v0.15from
kit-ty-kate:fix-macos

Conversation

@kit-ty-kate
Copy link

# File "linux_ext/src/dune", line 1, characters 0-234:
# 1 | (library (name linux_ext) (public_name core_unix.linux_ext)
# 2 |  (libraries core_kernel.bounded_int_table core core_thread filename_unix
# 3 |   time_ns_unix)
# 4 |  (c_names linux_ext_stubs) (preprocessor_deps config.h)
# 5 |  (preprocess (pps ppx_jane)))
# (cd _build/default && /Users/mac1000/.opam/5.0.0~alpha1/bin/ocamlopt.opt -w -40 -g -shared -linkall -I linux_ext/src -o linux_ext/src/linux_ext.cmxs linux_ext/src/linux_ext.cmxa)
# ld: archive has no table of contents file 'linux_ext/src/liblinux_ext_stubs.a' for architecture x86_64
# 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 issue is that on macOS those two files are compiled empty. Previously on macOS, ranlib would only issue a warning:

(cd _build/default && /Users/kit_ty_kate/.opam/4.14.0/bin/ocamlmklib.opt -g -o linux_ext/src/linux_ext_stubs linux_ext/src/linux_ext_stubs.o)
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: linux_ext/src/liblinux_ext_stubs.a the table of contents is empty (no object file members in the library define global symbols)
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: linux_ext/src/liblinux_ext_stubs.a the table of contents is empty (no object file members in the library define global symbols)
(cd _build/default && /Users/kit_ty_kate/.opam/4.14.0/bin/ocamlmklib.opt -g -o core_thread/src/core_thread_stubs core_thread/src/pthread_np_stubs.o)
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: core_thread/src/libcore_thread_stubs.a the table of contents is empty (no object file members in the library define global symbols)
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: core_thread/src/libcore_thread_stubs.a the table of contents is empty (no object file members in the library define global symbols)

however, since ocaml/ocaml#11184, the use of ranlib has been removed, but now ld triggers an error when encountering such empty C library.

@tov tov merged commit 48ae8a5 into janestreet:v0.15 Oct 17, 2022
@tov
Copy link

tov commented Oct 17, 2022

Thanks!

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.

3 participants