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

Permissions issue when running dune build #35

Open
porcupinenick opened this issue Dec 14, 2019 · 19 comments
Open

Permissions issue when running dune build #35

porcupinenick opened this issue Dec 14, 2019 · 19 comments

Comments

@porcupinenick
Copy link

I'm having some trouble running through this tutorial: https://github.com/janestreet/install-ocaml

I've cloned the files, installed the dependencies, but I'm not able to run 'dune' properly.

I'm running this command within the 01-install-ocaml folder: dune build hello_world.exe
I get this: -bash: ./dune: Permission denied

Then, I run using this command: sudo dune build hello_world.exe
I get this: sudo: dune: command not found

Here's my environment setup: macOS 10.15.2 (Catalina) and 'bash' in Terminal. Are there any steps I've missed? How would I check?

@xclerc
Copy link

xclerc commented Dec 20, 2019

One thing that comes to mind is that you may have . in your path.
That would explain the "permission denied" (trying to execute the
01-hello-world/dune file).

@porcupinenick
Copy link
Author

did I mistakenly miss a step in the initial setup process?

@haohangxu
Copy link
Member

Can you try running this?

opam install dune

@porcupinenick
Copy link
Author

[NOTE] Package dune is already installed (current version is 2.0.0).

@xclerc
Copy link

xclerc commented Dec 20, 2019

Actually I am not sure what I said before really makes sense,
but I would try to execute the following:

which dune

@porcupinenick
Copy link
Author

that's weird.....it doesn't give me the path.

@xclerc
Copy link

xclerc commented Dec 20, 2019

Could you try echo $PATH?

@porcupinenick
Copy link
Author

is there a specific directory you would like me to run it in?

@xclerc
Copy link

xclerc commented Dec 20, 2019

No specific directory, but be sure to execute it from
a terminal exhibiting the problem.

@porcupinenick
Copy link
Author

is there anything I should be expecting?

@porcupinenick
Copy link
Author

I'm not seeing anything related to OPAM/dune in the output.

@xclerc
Copy link

xclerc commented Dec 20, 2019

I expect the variable (whose components are :-separated),
to contain .. It would mean that instead of trying to execute
the dune binary, your shell tries to execute this file, which is
not executable.

@porcupinenick
Copy link
Author

I do see the '.'

@porcupinenick
Copy link
Author

porcupinenick commented Dec 20, 2019

Have I just downloaded the incorrect project directory? Also, why am I not seeing the hello_world.exe file in the 01-hello-world folder for the install-ocaml repo?

@haohangxu
Copy link
Member

haohangxu commented Dec 20, 2019

I suspect this is not a problem with the source code here, likely a weird environment/misconfiguration problem as xclerc suggests.

hello_world.exe is the executable compiled hello_world.ml. dune is the compiler, so given that you're having trouble getting dune to work, it's expected that you won't see hello_world.exe.

Can you try this?

eval $(opam env)
which dune

@porcupinenick
Copy link
Author

Ok, that worked!

@porcupinenick
Copy link
Author

porcupinenick commented Dec 20, 2019

But another question:

git clone https://github.com/janestreet/install-ocaml
cd install-ocaml/01-hello-world

^ after following those instructions, I still don't see hello_world.exe; I haven't generated anything. How did you know to build the program like this:

dune build hello_world.exe
dune exec ./hello_world.exe

@haohangxu
Copy link
Member

Those build instructions are outlined in the readme:
https://github.com/janestreet/install-ocaml#test-that-you-can-build-basic-program

@porcupinenick
Copy link
Author

Ok, thanks. I referenced this link for more info:

https://dune.readthedocs.io/en/latest/quick-start.html

It seems that within the project folder, there is a dune file. That dune file specifies the name of the executable (hello_world.exe in this case) which is built by dune.

  1. May I submit a PR to this link within the description for more background information on where the .exe is coming from?

  2. Once I start-up a new .bash shell and run 'which dune', I don't see the file path. Once I run these two commands (eval $(opam env); which dune), I see the path. Perhaps I can also submit a PR regarding solving this issue for more context?

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

No branches or pull requests

3 participants