thierry-martinez / stdcompat

Stdcompat: compatibility module for OCaml standard library
BSD 2-Clause "Simplified" License
31 stars 13 forks source link

Compilation fails in a static switch #8

Closed copy closed 5 years ago

copy commented 5 years ago

Compilation in a 4.08.0+musl+static+flambda switch fails as follows:

ocamlfind ocamlopt -package result -package seq -package uchar -bin-annot -no-alias-deps -shared stdcompat__native.cmx stdcompat__init.cmx stdcompat__root.cmx stdcompat__seq_s.cmx stdcompat__seq.cmx stdcompat__tools.cmx stdcompat__pervasives_s.cmx stdcompat__arg_s.cmx stdcompat__lazy_s.cmx stdcompat__char_s.cmx stdcompat__uchar_s.cmx stdcompat__buffer_s.cmx stdcompat__string_s.cmx stdcompat__stringLabels_s.cmx stdcompat__bytes_s.cmx stdcompat__bytesLabels_s.cmx stdcompat__list_s.cmx stdcompat__listLabels_s.cmx stdcompat__stack_s.cmx stdcompat__hashtbl_s.cmx stdcompat__set_s.cmx stdcompat__map_s.cmx stdcompat__weak_s.cmx stdcompat__sys_s.cmx stdcompat__stream_s.cmx stdcompat__digest_s.cmx stdcompat__nativeint_s.cmx stdcompat__int_s.cmx stdcompat__int64_s.cmx stdcompat__int32_s.cmx stdcompat__filename_s.cmx stdcompat__array_s.cmx stdcompat__arrayLabels_s.cmx stdcompat__float_s.cmx stdcompat__queue_s.cmx stdcompat__ephemeron_s.cmx stdcompat__spacetime_s.cmx stdcompat__moreLabels_s.cmx stdcompat__lexing_s.cmx stdcompat__option_s.cmx stdcompat__result_s.cmx stdcompat__bool_s.cmx stdcompat__fun_s.cmx stdcompat__stdlib_s.cmx stdcompat__printf_s.cmx stdcompat__printexc_s.cmx stdcompat__pervasives.cmx stdcompat__arg.cmx stdcompat__lazy.cmx stdcompat__char.cmx stdcompat__uchar.cmx stdcompat__sys.cmx stdcompat__buffer.cmx stdcompat__string.cmx stdcompat__stringLabels.cmx stdcompat__bytes.cmx stdcompat__bytesLabels.cmx stdcompat__list.cmx stdcompat__listLabels.cmx stdcompat__stack.cmx stdcompat__hashtbl_ext.cmx stdcompat__hashtbl.cmx stdcompat__set.cmx stdcompat__map.cmx stdcompat__weak.cmx stdcompat__stream.cmx stdcompat__digest.cmx stdcompat__nativeint.cmx stdcompat__int.cmx stdcompat__int64.cmx stdcompat__int32.cmx stdcompat__filename.cmx stdcompat__array.cmx stdcompat__arrayLabels.cmx stdcompat__float.cmx stdcompat__queue.cmx stdcompat__ephemeron.cmx stdcompat__spacetime.cmx stdcompat__moreLabels.cmx stdcompat__lexing.cmx stdcompat__option.cmx stdcompat__printexc.cmx stdcompat__result.cmx stdcompat__bool.cmx stdcompat__fun.cmx stdcompat__format.cmx stdcompat__printf.cmx stdcompat__stdlib.cmx stdcompat.cmx -cclib "-L. -lstdcompat__stubs" -o stdcompat.cmxs
sh: shared-libs-not-available: command not found
File "caml_startup", line 1:
Error: I/O error: shared-libs-not-available -o 'stdcompat.cmxs'   '-L/home/user/.opam/4.08.0+musl+static+flambda/lib/result' '-L/home/user/.opam/4.08.0+musl+static+flambda/lib/seq' '-L/home/user/.opam/4.08.0+musl+static+flambda/lib/uchar' '-L/home/user/.opam/4.08.0+musl+static+flambda/lib/ocaml'  'stdcompat.cmxs.startup.o' 'stdcompat.o' 'stdcompat__stdlib.o' 'stdcompat__printf.o' 'stdcompat__format.o' 'stdcompat__fun.o' 'stdcompat__bool.o' 'stdcompat__result.o' 'stdcompat__printexc.o' 'stdcompat__option.o' 'stdcompat__lexing.o' 'stdcompat__moreLabels.o' 'stdcompat__spacetime.o' 'stdcompat__ephemeron.o' 'stdcompat__queue.o' 'stdcompat__float.o' 'stdcompat__arrayLabels.o' 'stdcompat__array.o' 'stdcompat__filename.o' 'stdcompat__int32.o' 'stdcompat__int64.o' 'stdcompat__int.o' 'stdcompat__nativeint.o' 'stdcompat__digest.o' 'stdcompat__stream.o' 'stdcompat__weak.o' 'stdcompat__map.o' 'stdcompat__set.o' 'stdcompat__hashtbl.o' 'stdcompat__hashtbl_ext.o' 'stdcompat__stack.o' 'stdcompat__listLabels.o' 'stdcompat__list.o' 'stdcompat__bytesLabels.o' 'stdcompat__bytes.o' 'stdcompat__stringLabels.o' 'stdcompat__string.o' 'stdcompat__buffer.o' 'stdcompat__sys.o' 'stdcompat__uchar.o' 'stdcompat__char.o' 'stdcompat__lazy.o' 'stdcompat__arg.o' 'stdcompat__pervasives.o' 'stdcompat__printexc_s.o' 'stdcompat__printf_s.o' 'stdcompat__stdlib_s.o' 'stdcompat__fun_s.o' 'stdcompat__bool_s.o' 'stdcompat__result_s.o' 'stdcompat__option_s.o' 'stdcompat__lexing_s.o' 'stdcompat__moreLabels_s.o' 'stdcompat__spacetime_s.o' 'stdcompat__ephemeron_s.o' 'stdcompat__queue_s.o' 'stdcompat__float_s.o' 'stdcompat__arrayLabels_s.o' 'stdcompat__array_s.o' 'stdcompat__filename_s.o' 'stdcompat__int32_s.o' 'stdcompat__int64_s.o' 'stdcompat__int_s.o' 'stdcompat__nativeint_s.o' 'stdcompat__digest_s.o' 'stdcompat__stream_s.o' 'stdcompat__sys_s.o' 'stdcompat__weak_s.o' 'stdcompat__map_s.o' 'stdcompat__set_s.o' 'stdcompat__hashtbl_s.o' 'stdcompat__stack_s.o' 'stdcompat__listLabels_s.o' 'stdcompat__list_s.o' 'stdcompat__bytesLabels_s.o' 'stdcompat__bytes_s.o' 'stdcompat__stringLabels_s.o' 'stdcompat__string_s.o' 'stdcompat__buffer_s.o' 'stdcompat__uchar_s.o' 'stdcompat__char_s.o' 'stdcompat__lazy_s.o' 'stdcompat__arg_s.o' 'stdcompat__pervasives_s.o' 'stdcompat__tools.o' 'stdcompat__seq.o' 'stdcompat__seq_s.o' 'stdcompat__root.o' 'stdcompat__init.o' 'stdcompat__native.o' '-L.' '-lstdcompat__stubs' 

The problem seems to be the -shared flag here, which cannot be used in a static switch:

% ocamlopt -shared -o foo
sh: shared-libs-not-available: command not found
File "caml_startup", line 1:
Error: I/O error: shared-libs-not-available -o 'foo'   '-L/home/user/.opam/4.08.0+musl+static+flambda/lib/ocaml'  'foo.startup.o'
copy commented 5 years ago

https://github.com/ocaml/opam-repository/pull/14664 fixes this.