ocaml / flexdll

a dlopen-like API for Windows
Other
98 stars 30 forks source link

Command line too long #7

Open gares opened 9 years ago

gares commented 9 years ago

I'm using cygwin, the mingw64 toolchain and I get the error. It comes from Reloc.cygpath, that in turns calls get_output with use_bash:false. The quick hack was to force it to use bash, but what could be done (in the non use_bash case) is to use Unix.create_process instead of Sys.command, since the former does not use a shell (no cmd.exe, so more than 8k for argv). See for example sys_command in https://github.com/coq/coq/blob/trunk/lib/cUnix.ml

Best,

alainfrisch commented 9 years ago

It was initially planned that flexdll should not depend on Unix, to make it easier to integrate it directly in OCaml's bootstrap cycle, but since this is not going to happen, there is no reason not to use it.

I won't have much time to work on that soon, so if you feel like suggesting a patch, I'll happily include it.

gasche commented 8 years ago

@gares , I opened an issue in the OCaml bugtracker #7050 to be able to pass command-line arguments for the OCaml compiler in a file, to avoid argv size limitations. The two issues seem independent, but are in fact related if the command that is called in the present PR is an invocation of the OCaml compiler (or a tool distributed in the OCaml compiler distribution). Is it?

dra27 commented 7 years ago

Update for 2016: FlexDLL is now an optional part of OCaml's bootstrap cycle, so a hard dependency on Unix would be upsetting (for at least two developers...!). However, it sounds as though this could be done in a way which could be easily disabled at build time in the bootstrap (similarly to the shims already in place for building with OCaml < 4.03.0)

bschommer commented 7 years ago

I also will submit a PR in the next few days which allows flexdll to parse responsefiles produced by the new ocaml functions write_arg and write_arg0. But I'm not that familiar with the bootstrap mechanism to add a check if the flexdll support this..

dra27 commented 7 years ago

The FlexDLL bootstrap in OCaml is only normally something you have to worry about if you're altering the OCaml side - feel free to cc me when you submit the PR and I'll happily test it. If you want to have a go, it's an easy enough procedure: from a git clone of OCaml (you can do it from a tarball of the sources, but it's easier to use a clone):

Step one initialises the flexdll directory of the OCaml source tree, clones this repo and checks out the 0.35 commit (assuming you are on trunk or 4.04). The flexdll directory itself is then to all intents and purposes a separate git clone, so you can add your remote and checkout your branch - you can use -b your-new-flexdll-branch if you want to work on the clone within that directory and you can also push back to your GitHub repo from it but it's also OK (and commonplace with submodules) to work with a "detached HEAD".

Note that OCaml will show that the 'flexdll' file has changed if you do git status from there which is correct - but you should not try to commit that change (if you say git submodule update then git will checkout the 0.35 commit in the flexdll directory again).

Hope that helps - but as I said, I'm quite happy to test and comment on that side too!

bschommer commented 7 years ago

I think the PR on the flexdll side should not be that complicated, I will only have to copy the read_arg and read_arg0 function from the arg module for compatibility. My problem is more how on the ocaml side one could notice that the flexdll version is new enough to allow this.

dra27 commented 7 years ago

You don't have to worry on the OCaml side - for bootstrapping, when FlexDLL 0.36 is released (with it), we update the SHA stored for the submodule in the OCaml repo. For users pre-installing FlexDLL, we change the README to state the new minimum version.