ocamlfind icon indicating copy to clipboard operation
ocamlfind copied to clipboard

ocamlnat problems

Open dbuenzli opened this issue 9 months ago • 0 comments

When one invokes #use topfind this test here triggers a an error on macos 14.4.1 with ocamlfind 1.9.6.

While on ocaml 4.14.2 this seems harmless:

> ocamlnat -noinit
OCaml version 4.14.2 - native toplevel
Enter #help;; for help.

# #use "topfind";;
>> Fatal error: Toploop.dll_run dlopen(/var/folders/9p/bzrzxtv53zsdsb88p7lbcsk80000gn/T/camlTOP256189b.so, 0x000A): symbol not found in flat namespace '_camlTopfind'
File "_none_", line 1:
Warning 58 [no-cmx-file]: no cmx file was found in path for module TOP1, and its interface was not compiled with -opaque
- : unit = ()
Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

- : unit = ()

It seems that on 5.2.0~rc1 this results in a catastrophic error:

> ocamlnat -noinit
OCaml version 5.2.0~rc1 - native toplevel
Enter #help;; for help.

# #use "topfind";;
File "_none_", line 1:
Warning 58 [no-cmx-file]: no cmx file was found in path for module Topfind, and its interface was not compiled with -opaque
>> Fatal error: Toploop.dll_run dlopen(/var/folders/9p/bzrzxtv53zsdsb88p7lbcsk80000gn/T/camlTOP2a4cc58.so, 0x000A): symbol not found in flat namespace '_camlTopfind'
Error while loading /Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib.cma: error loading shared library: Failure("dlopen(/Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib.cma, 0x000A): tried: '/Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib.cma' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib.cma' (no such file), '/Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib.cma' (not a mach-o file)").
Error while loading /Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib_top.cma: error loading shared library: Failure("dlopen(/Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib_top.cma, 0x000A): tried: '/Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib_top.cma' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib_top.cma' (no such file), '/Users/dbuenzli/.opam/5.2.0~rc1+ocamlnat/lib/findlib/findlib_top.cma' (not a mach-o file)").

File "_none_", line 1:
Warning 58 [no-cmx-file]: no cmx file was found in path for module TOP1, and its interface was not compiled with -opaque

- : unit = ()

File "_none_", line 1:
Warning 58 [no-cmx-file]: no cmx file was found in path for module Topfind, and its interface was not compiled with -opaque
>> Fatal error: Toploop.dll_run dlopen(/var/folders/9p/bzrzxtv53zsdsb88p7lbcsk80000gn/T/camlTOP3a63122.so, 0x000A): symbol not found in flat namespace '_camlTopfind'

Exception: Misc.Fatal_error.

However going back to 4.14.2. It seems the support is broken (does it try to load the wrong objects ? it prints cmxa files instead of cmxs, not sure if it's a rendering bug or the actual bug):

# #require "cmdliner";;
/Users/dbuenzli/.opam/4.14.2+ocamlnat/lib/cmdliner: added to search path
/Users/dbuenzli/.opam/4.14.2+ocamlnat/lib/cmdliner/cmdliner.cmxa: loaded
# Cmdliner.Cmd.eval;;
>> Fatal error: Toploop.dll_run dlopen(/var/folders/9p/bzrzxtv53zsdsb88p7lbcsk80000gn/T/camlTOP44dc430.so, 0x000A): symbol not found in flat namespace '_camlCmdliner'
Exception: Misc.Fatal_error.

This is not an issue with the compilation object as omod can load it:

# #use "omod.top";;
Omod v0.0.4-3-gb0d2684 loaded. Type Omod.help () for more info.
# Omod.load "Cmdliner";;
[INC] /Users/dbuenzli/.opam/4.14.2+ocamlnat/lib/ocaml
[INC] /Users/dbuenzli/.opam/4.14.2+ocamlnat/lib/cmdliner
[OBJ] /Users/dbuenzli/.opam/4.14.2+ocamlnat/lib/cmdliner/cmdliner.cmxs
- : bool = true
# Cmdliner.Cmd.eval;;
- : ?help:Format.formatter ->
    ?err:Format.formatter ->
    ?catch:bool ->
    ?env:(string -> string option) ->
    ?argv:string array ->
    ?term_err:Cmdliner.Cmd.Exit.code ->
    unit Cmdliner.Cmd.t -> Cmdliner.Cmd.Exit.code
= <fun>

dbuenzli avatar May 08 '24 22:05 dbuenzli