-
Notifications
You must be signed in to change notification settings - Fork 325
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
Use [opam exec -- dune build] rather than rely on [eval $(opam env)] #1819
Comments
Hi @jonahbeckford, thanks for starting this discussion.
We'd love to update all windows related texts in the install instruction
I share this feeling. I always disliked that idea. I'm using
I'm sorry, I'm not sure I understand. Are you saying the current instructions are failing in Windows? P.S. Do you have any opinion on WSL? We receive feedback from users working on this. Should we mention this too? |
Yep, I use
I am saying it is trivial for the
WSL2 is one of those things that is "easy" to get started with, but then the users will curse us when they realize they can only build Linux executables but not Windows executables. And then they install Windows and find their favorite The core problem is that OCaml does not cross-compile easily from Linux to Windows, unlike other standard compiled languages like C++ and Rust. At best there is https://github.com/ocaml-cross/opam-cross-windows which I've never used ... notice the lack of |
TLDR: I'm about to recommend consistently to all DkML users to use
opam exec -- dune build
rather than... opam env ...
and thendune build
. I would like to see if the UX team agrees.This suggestion is feedback that I've collected from many users about the difficulty on remembering the
eval $(opam env)
magic. This applies to students I've witnessed using Ubuntu, and also comes through in tickets to DkML Windows users. Worse, on Windows, the syntax is(& opam env) -split '\r?\n' | ForEach-Object { Invoke-Expression $_ }
with PowerShell andfor /f "tokens=*" %i in ('opam env') do @%i
with Command Prompt.Personally, I stopped using that magic invocation a year ago and doing so has improved my productivity.
Here is the latest example of that feedback from another user:
Let's say we start on https://ocaml.org/docs/your-first-program. The user does
dune build
and it fails (this was the issue above; the failure reason wasn't as important as the confusion about the correct "path" and "dir" and "env"). Why does the user have to do theeval $(opam env)
magic (or its Windows cousins) at all, or even understand what opam switches are?I know that page links to a section about working within global opam switches but only "When you work on several OCaml projects simultaneously ...". So it is easy to forget, but more important it is unnecessary for a person doing their first OCaml program.
PS. I have a major update to DkML coming. The Major changes are listed at https://gitlab.com/dkml/distributions/dkml/-/blob/next/contributors/changes/v2.1.0.md?ref_type=heads. So the installation instructions on ocaml.org will need a revamp.
The text was updated successfully, but these errors were encountered: