Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utop can't load Base library #11

Closed
F-Loyer opened this issue Oct 21, 2022 · 7 comments
Closed

utop can't load Base library #11

F-Loyer opened this issue Oct 21, 2022 · 7 comments
Assignees
Milestone

Comments

@F-Loyer
Copy link

F-Loyer commented Oct 21, 2022

With dune, I can compile a program which uses the Base library. But can't use the same library with utop.

PS D:\DiskuvProjets\essai> with-dkml utop   
│ Welcome to utop version 2.9.0 (using OCaml version 4.12.1)! │                                                                                                      
utop.exe: lambda-term(history): failed to lock file 'C:\Users\frede\AppData\Local\Programs\DiskuvOCaml\tools\MSYS2\home\frede\.utop-history': Une opération de verrouillage de fichier demandée ne peut pas être traitée en raison d’une plage d’octets non valide.
utop.exe: lambda-term(history):

Type #utop_help for help about using utop.

utop # #use "topfind";;
- : 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 = ()
utop # #require "base";;
Cannot load required shared library dllbase_internalhash_types_stubs.
Reason: dllbase_internalhash_types_stubs.dll: L'opération a réussi.
.
Cannot load required shared library dllbase_stubs.
Reason: dllbase_stubs.dll: L'opération a réussi.
.
utop # Base.List.map;;Line 1:Error: Reference to undefined global `Base__List'

There is a DLL error while "requiring" base (and the reason is a success !), then, the functions from the library are not available.

@jonahbeckford jonahbeckford self-assigned this Nov 4, 2022
@jonahbeckford
Copy link
Contributor

Sorry I didn't see this earlier! I missed the email notification.

There are two issues ... one you can fix, and one I can fix:

  1. (You can fix). If you are in a switch directory and you have entered it with for /f "tokens=*" %i in ('opam env --set-switch') do @%i in the Command Prompt, then your #require "base";; should work. If it doesn't, try opam install utop first and then try again. See https://diskuv.gitlab.io/diskuv-ocaml/doc/BeyondBasics.html#learn-ocaml-a-first-project if my language about a "switch" is confusing.
  2. (I can fix). It would be nice to get that #require "base";; to work without a switch. So regardless I'll keep this open (although it may take a few versions before it is fixed).

If what I said in option 1 does not make sense, please use https://calendly.com/diskuv/60min-install to schedule a Zoom call. We'll likely need about 10-15 minutes.

@F-Loyer
Copy link
Author

F-Loyer commented Nov 4, 2022

Ok, that works. Thanks a lot.

One useful think to know is to double the % when copying the for statement in a CMD file to ease the reinitialization of the environnement.

@jonahbeckford
Copy link
Contributor

I think I need to give three different versions of the commands:

  1. Command Prompt
  2. CMD file
  3. PowerShell

I'll keep this open to track that. Thanks!

@jonahbeckford
Copy link
Contributor

The fix won't be in the next point release, but it will get in there.

@jonahbeckford jonahbeckford added this to the v1.0.3 milestone Nov 12, 2022
@jonahbeckford
Copy link
Contributor

Status update: This didn't make it in for https://github.com/diskuv/dkml-installer-ocaml/releases/tag/v1.1.0_r2 (1.1.0). The issue needs to stay open.

jonahbeckford added a commit to diskuv/dkml-runtime-distribution that referenced this issue Jan 4, 2023
@jonahbeckford
Copy link
Contributor

Interim results. The following gives a working #require "base";; ...

opam install --switch C:\Users\beckf\AppData\Local\Programs\DISKUV~1\dkml base
opam exec --switch C:\Users\beckf\AppData\Local\Programs\DISKUV~1\dkml utop
  • The first command will be done automatically during installation (next release). Commit: diskuv/dkml-runtime-distribution@db124b2
  • The second command will need to be simplified. The global utop will need a shim
    so that the lib/stublibs of the dkml switch is added to the PATH.

@jonahbeckford
Copy link
Contributor

Major release https://discuss.ocaml.org/t/ann-dkml-2-0-0-preview-release/12642 closes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants