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

4.02.0+dev: ocamlbuild fails to find ocamlfind.exe #6445

Closed
vicuna opened this issue May 30, 2014 · 6 comments
Closed

4.02.0+dev: ocamlbuild fails to find ocamlfind.exe #6445

vicuna opened this issue May 30, 2014 · 6 comments
Assignees
Milestone

Comments

@vicuna
Copy link

vicuna commented May 30, 2014

Original bug ID: 6445
Reporter: furuse
Assigned to: @damiendoligez
Status: closed (set by @xavierleroy on 2016-12-07T10:34:21Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: Mingw
Version: 4.01.0
Target version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: tools (ocaml{lex,yacc,dep,debug,...})
Child of: #6092

Bug description

It seems that ocamlbuild 4.02.0 fails to find ocamlfind.exe in MinGW build:

To compiile pcre-ocaml-7.0.4, I see:

$ ocaml setup.ml -build
Failure: ocamlfind not found on path, but -no-ocamlfind not used.

Additional information

ocamlfind is searched by Command.search_in_path cmd in options.ml, where

cmd = Command.string_of_command_spec (A "ocamlfind")

cmd is "''ocamlfind" in Win32. I do not follow later but it seems to cause the problem.

If I override cmd by "ocamlfind" then ocamlbuild succeeds finding it.

@vicuna
Copy link
Author

vicuna commented May 30, 2014

Comment author: @mshinwell

Alain, can you help (or if not, can you suggest someone?)

@vicuna
Copy link
Author

vicuna commented May 31, 2014

Comment author: @alainfrisch

I'd prefer is someone more knowledgeable about ocamlbuild would look at it. I've zero experience with the tool (it has been removed from LexiFi's version of OCaml for a long time).

@vicuna
Copy link
Author

vicuna commented Jun 2, 2014

Comment author: @mshinwell

Jeremie tells me that Gabriel is an ocamlbuild expert, so let's try :)

@vicuna
Copy link
Author

vicuna commented Jun 2, 2014

Comment author: @protz

The double simple quote was added by myself (with Damien looking over my shoulder), because of a complex quoting issue with Cygwin.

I only dimly recall what happened, but:

  • commands are executed via bash -c
  • cygwin arrives in-between and somehow tries to parse stuff with different quoting conventions depending on whether the path to the executable looks windows-y or cygwin-y
  • the resulting program receives a different argv

You can see the gory details in the original question that I asked on SO is http://stackoverflow.com/questions/9946586/cygwin-bash-c-yields-different-argc-depending-on-whether-the-command-start-with but the answer I picked did not really solve my problem.

It looks like these simple quotes are added erroneously in that particular case, but still need to be there to guarantee a consistent quoting behavior on windows in all situations.

@vicuna
Copy link
Author

vicuna commented Jul 11, 2014

Comment author: @damiendoligez

Regarding lines 289-290 of options.ml, it feels wrong to be feeding the result of Command.string_of_command_spec (a command line with quoted names intended for the shell) into Command.search_in_path (which only expects a command name).

I suggest removing the call to string_of_command_spec and passing directly the string "ocamlfind" to search_in_path.

@vicuna
Copy link
Author

vicuna commented Jul 19, 2014

Comment author: @damiendoligez

I have fixed this one (commit 15014) but there seems to be other problems.

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

No branches or pull requests

2 participants