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

OPAM on Cygwin: lambda-term fails to install due to a glitch of xxx.install processing #2313

Open
camlspotter opened this issue Sep 22, 2015 · 14 comments

Comments

@camlspotter
Copy link

I am playing Cygwin OPAM to install MinGW OCaml packages and found a glitch. I guess this is not specific to MinGW OCaml installation therefore file an inssue.

opam install lambda-term fails at the last stage:

### stderr ###
# install: cannot create regular file ‘/home/jun/.opam/system/bin/lambda-term-actions’: File exists

File .../bin/lambda-term-actions.exe is already installed when ocaml setup.ml -install is executed. The processing of lambda-term.install tries to reinstall the executable again and fails. In Unix, this does not happen. The related code (opamAction.ml, around line 77) checks the destination file and does not install the file if the destination already exists.

In Cygwin OPAM + MinGW OCaml, (and in Cygwin OPAM + Cygwin OCaml too I imagine) somehow opam tries to reinstall this executable file and fails since the destination already exists. Here is my rough guess:

  • opam checks the existence of the destination using OpamFilename.exists which calls Unix.stat with ..../lambda-term-actions. It returns false.
  • Since it cannot find the desitnation, opam tries to install the executable as ..../lambda-term-actions by OpamSystem.install. It executes Cygwin's install command. install command is Cygwin friendly therefore it awares the existence of ..../lambda-term-actions.exe and fails to install.
@camlspotter
Copy link
Author

Possible fixes are:

  • Make OPAM's xxx.install handling more strict: if the destination file already exists, it should fail
  • Fix the OPAM's behaviour in Cygwin so that it follows the current Unix one: it must check the destination file with .exe postifix too to decide whether it should execute install command or not.

My current package specific workaround is remove lambda-term-actions from lambda-term.install.

@dbuenzli
Copy link
Contributor

There's no fix to be done here. It's using oasis there's no reason it should use a static .install file (i.e. in the package description itself).

oasis is perfectly able to install things correctly both on windows and unix there's no reason there should be a .install file here. See #2253 for a similar issue.

Note that this may be due to oasis2opam which has a completely broken approach regarding .install files see the discussion here ocaml/opam-repository#4510

@dbuenzli
Copy link
Contributor

There's no fix to be done here.

That is in opam itself. The packages should be fixed in opam-repository.

@camlspotter
Copy link
Author

I agree that lambda-term.install contains non-necessary entries and should be fixed.

How about opam itself? In Unix, it seems that files already exist at their destinations are ignored even they are listed in *.install. Ideally should it fail the installation or at least print warnings?

@dbuenzli
Copy link
Contributor

How about opam itself?

Regarding the cygwin case this was settled down #2253: build system should be fixed (this one is obviously wrong since it's trying to install things twice) and no magic should be introduced in the straightforward mechanism of .install file to counter the hacks of cygwin.

In Unix, it seems that files already exist at their destinations are ignored even they are listed in *.install. Ideally should it fail the installation or at least print warnings?

If that is the case I think you should file a separate issue for that one so that this gets clarified. The manual itself says nothing special about this.

@protz
Copy link

protz commented Apr 12, 2016

I think the reason that this is listed in the install file is so that the file gets automatically removed on uninstall. I have the same problem for jsonm, menhir, and many other packages.

Someone with enough knowledge of the OPAM command wizardry could just replace the call to install with [ -f $src ] && install $src $dest?

@dbuenzli
Copy link
Contributor

I have the same problem for jsonm

What exact install problem do you have with jsonm ? The reported behaviour should not occur with jsonm as it doesn't use oasis

@msprotz
Copy link

msprotz commented Apr 12, 2016

protz@Joprotze-Z420:~/.opam/system/build/jsonm.0.9.1 $ ls
_build  _tags    doc            myocamlbuild.ml  setup.data  setup.ml  test
_oasis  CHANGES  jsonm.install  README           setup.log   src

notice the _oasis file.

@msprotz
Copy link

msprotz commented Apr 12, 2016

protz@Joprotze-Z420:~/.opam/system/build/jsonm.0.9.1 $ ocaml setup.ml -install

installs .opam/system/bin/ocamltweets.exe which jsonm.install then tries to install again

@dbuenzli
Copy link
Contributor

@msprotz Uuuuh, it seems that a jsonm release has been pending for more than 2 years... guess it's time to clear the pins (n.b. ocamltweets.exe no longer works because twitter killed the token-free public search API).

@protz
Copy link

protz commented May 17, 2016

@dbuenzli have you had any luck updating jsonm? we're likely to start using it in F*, but for that to happen we need jsonm to be easily installable via my "hacked" windows build of opam (protz.github.io/ocaml-installer/)...

@dbuenzli
Copy link
Contributor

I'll make a new release when I port it to the new topkg which is to be released in the following weeks. What kind of timeframe do you have ?

@msprotz
Copy link

msprotz commented May 19, 2016

I think for F* specifically using yojson is an acceptable option, but I'm trying to install via OPAM all the dependencies needed to build OPAM when I refresh my installer, and jsonm is one of the two that are currently not installable via OPAM-on-windows.

Thanks,

Jonathan

@rjbou
Copy link
Collaborator

rjbou commented Jun 27, 2019

What is the status of this issue?

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

5 participants