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

ocamlbuild on cygwin cannot find ocamlfind #6626

Closed
vicuna opened this issue Oct 24, 2014 · 4 comments
Closed

ocamlbuild on cygwin cannot find ocamlfind #6626

vicuna opened this issue Oct 24, 2014 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Oct 24, 2014

Original bug ID: 6626
Reporter: algoriddle
Status: closed (set by @damiendoligez on 2014-12-17T23:18:01Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: Cygwin
OS: Cygwin
Version: 4.02.1
Fixed in version: 4.02.2+dev / +rc1
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues

Bug description

"Failure: ocamlfind not found on path, but -no-ocamlfind not used."

ocamlbuild should append .exe extension to filename when looking for
executables on os_type 'Cygwin' (same as os_type 'Win32')

Steps to reproduce

ocamlbuild fails in "opam install react" with the following error:

"Failure: ocamlfind not found on path, but -no-ocamlfind not used."

This is where the exception is thrown:

https://github.com/ocaml/ocaml/blob/trunk/ocamlbuild/options.ml#L295

It is the result of Command.search_in_path not finding ocamlfind:

https://github.com/ocaml/ocaml/blob/trunk/ocamlbuild/command.ml#L130

Which appears to be caused by file_or_exe_exists not appending ".exe" to the filename when Sys.os_type = "Cygwin" (which is what I see as os_type when compiling on cygwin):

https://github.com/ocaml/ocaml/blob/trunk/ocamlbuild/command.ml#L128

Additional information

I submitted a simple fix here: #108

It was suggested on the mailing list that a more elaborate fix was necessary, using Filename.check_suffix Config.default_executable_name ".exe" as the condition, but I haven't done that (yet). Let me know if I should.

File attachments

@vicuna
Copy link
Author

vicuna commented Oct 29, 2014

Comment author: @damiendoligez

I don't think it should be keyed on Config.default_executable_name: it's just a default name, not a strong statement about the OS.

@vicuna
Copy link
Author

vicuna commented Nov 5, 2014

Comment author: @dra27

Sorry - uploaded that patch before discovering that it was the same as the one in the pull request (I'd read Damien's note first). :$

My suggestion on the OCaml list is indeed flawed, but not quite for Damien's reasons - Cygwin executables can choose not to have the ".exe" suffix and still be executable.

It would still be useful to have a new Sys.executable_suffix for the native ports - that way MSVC, MSVC64, MinGW & MinGW64 could have ".exe" (i.e. executable files must end with .exe) but Cygwin, like Unix, would remain with "" and simply be an annoying special case in code!

@vicuna
Copy link
Author

vicuna commented Dec 17, 2014

Comment author: @damiendoligez

This patch was applied in trunk (commit 15577) and 4.02 (15578).

@vicuna vicuna closed this as completed Dec 17, 2014
@vicuna
Copy link
Author

vicuna commented Mar 12, 2015

Comment author: @protz

Damien, I'm still seeing this on 4.02.1, am I missing something?

protz@Joprotze-Z420:~/.opam/4.02.1/build/fix.20130611 $ ocamlbuild -use-ocamlfind -cflags "-g" -lflags "-g" -classic-display Fix.cma Fix.cmxa
Failure: ocamlfind not found on path, but -no-ocamlfind not used.

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

1 participant