-
Notifications
You must be signed in to change notification settings - Fork 36
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
Build failure with OCaml 4.02.0 MinGW #41
Comments
So far, I use the following workaround but it is too dirty. Do not ask me why we need 6 backslashes: Not sure this is a bug of p4 or ocamlbuild.
|
I would say it's an ocamlbuild problem: |
I've run into the issue as well while re-generating the windows installer. More precisely, the issue lies with the command
This command uses forward-slashes, which is fine for both the windows kernel and the unixy environment that camlp4 expects for its build to happen properly. What happens, however, is that ocamldep calls (probably) into What I'm not getting is: how that did even work properly in 4.01? I'll try to apply Jun's workaround. CC @planar |
For the record, |
In 4.01 the myocamlbuild.ml was always using I'll add a fix in camlp4 in the meantime. |
That explains it. I'll try to run an experiment and see if, by any chance, dropping ocamlbuild's custom implementation of filename concatenation would work. |
4.02.0 is released and the failure becomes now a bit different: ''C:/ocamlmgw/bin/ocamldep.opt -pp ''''camlp4\boot\camlp4boot.native' -D OPT' -modules camlp4/Camlp4/Debug.mli > camlp4/Camlp4/Debug.mli.depends
'camlp4bootcamlp4boot.native' is not recognized as an internal or external command,
operable program or batch file.
File "camlp4/Camlp4/Debug.mli", line 1:
Error: Error while running external preprocessor
Command line: camlp4bootcamlp4boot.native -D OPT "camlp4/Camlp4/Debug.mli" > C:\cygwin\tmp\ocamlpp241848
Exit code 2 while executing this command:
''C:/ocamlmgw/bin/ocamldep.opt -pp ''''camlp4\boot\camlp4boot.native' -D OPT' -modules camlp4/Camlp4/Debug.mli > camlp4/Camlp4/Debug.mli.depends
Makefile:9: recipe for target 'byte' failed
Now
|
The previous workaround still works somehow:
|
Reason is an over quoting. camlp4\boot\camlp4boot.native should not be quoted since a quote is applied to its external including -D OPT. |
Note that the quoting is not done properly either: it fails to quote the quotes. |
I'm having the same problem when building the MSVC port. The workaround works as well. |
The problem is clearly ocamlbuild - invoking cmd.exe (via Sys.command) in order to invoke bash -c is a special kind of self-flagellation; it would clearly be much better if ocamlbuild on Windows used CreateProcessEx directly to call bash and at least avoid one worry for escaping. But the number of single quote marks suggest that escaping is being done incorrectly anyway (see dubious comment in Command.string_of_command_spec_with_calls). However, it's irritating (to be as polite as possible) that camlp4 doesn't build out of the box for Windows. The following patch to myocamlbuild.ml 4.01.1+3 is working well for me: @@ -86,7 +86,7 @@
let dep = "camlp4"/"boot"/exe in
let cmd =
let ( / ) = Filename.concat in
- "camlp4"/"boot"/exe
+ String.escaped (String.escaped ("camlp4"/"boot"/exe))
in
(Some dep, cmd)
in Can this be incorporated? It's totally clear in the context that for non-Windows platforms the calls to String.escaped will do nothing (so we don't break other platforms) and even if/when ocamlbuild is fixed, multiple backslashes are not an error in Windows paths (i.e. C:\\\Windows\\system32 is perfectly valid) |
@dra27 the patch looks good. Can you create a pull-request? |
Yes - which branch would you prefer it in - 4.02 or trunk? |
@dra27 any will do, you can do it on trunk |
I applied @dra27's patch. I'll do a minor release for windows next week unless someone complains |
Looks like this problem just got worse.
This is with a freshly-built
|
the |
The following build trial fails with OCaml 4.02.0 MinGW:
The string "camlp4/boot/camlp4boot.native" is sent to Sys.command and cmd.exe does not understand it. It must be "camlp4\boot\camlp4boot.native":
Using "_build\camlp4\boot\camlp4boot.native" resolves the problem:
The text was updated successfully, but these errors were encountered: