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
ocamlopt -cc "cc" fails when "cc" is a symbolic link #6114
Comments
Comment author: @lefessan The problem is not that ocamlopt does not follow symbolic links, it is that it does not see it as a symbolic link. Indeed, in your case, "cc" is a Cygwin symbolic link, while ocamlopt is a native Windows program (mingw), so it cannot access at all the Cygwin hierarchy, unless you provide native Windows paths. This is usually not a problem with relative paths, but you may get the same problem if you try : ocamlopt /home/user/foo.ml as ocamlopt won't be able to determine the correct Cygwin root. I don't think this is an issue with OCaml, but with mixing Cygwin and Mingw programs. Actually, what you need is a Cygwin ocamlopt cross-compiling to Mingw... |
Comment author: @protz I'd be happy to hear about what is broken, since I plan to refresh the installer. Fabrice, I believe in your example cygwin will perform an automated conversion (with a warning the first time) of a cygwin-style path into a windows-style one. |
Comment author: @johnwhitington Thanks for the clarification. So here's a summary of what I had to do to get windows OCaml installed on a virgin Windows 7 VM:
And now it seems to be working. Thanks for the hard work keeping OCaml windows support working! |
Comment author: @protz Thanks for the information. I have had other reports of the cygwin installer no longer working properly, which is strange, since last time I checked, it did install probably everything. I'll look into it. I also plan to upgrade flexdll. I don't understand however why you had to rename the gcc executable. Both the verison of OCaml and of Flexdll that I bundle harcode, I believe, the mingw-w64-i686- prefix. Have you figured out who exactly needed an executable called gcc? |
Comment author: @johnwhitington
ocamlopt -cc "cc" for me. I assumed that "cc" would just work -- I'm sure I can tell OCamlmakefile where to find CC, but I'd hoped it would be automatic.
|
Comment author: @protz The naming is intentional. In cygwin, mingw-w64-i686- is a native windows program that compiles native windows programs, while gcc is a cygwin program (found in another package) that compiles cygwin programs, that is, programs that depend on cygwin1.dll. Cygwin packages both, and offers a prefix for the mingw variant. I think you should tweak your OCamlMakefile to build: ocamlopt -cc "mingw-w64-i686-gcc" since you are, indeed, using, from the point of view of cygwin, a compiler that is not the "native" one, hence not called "cc". |
Comment author: nlucaroni John, I would strongly suggest using i686-w64-mingw32-gcc instead of shortening it to gcc or cc. In my experience in compiling a large software package on windows with C and external libraries, we had to be very careful in what we were linking in the environment --basically ensuring we were using the i686-w64-mingw32- tools instead of the cygwin tools. This made it clear why errors were occurring. A number of times we would check what shared libraries were required by the executable or what libraries were linked in and noticed cygwin1.dll replacing libmoldname.a with another library is something I had to do on a 32bit cygwin environment. That is a real problem. Has that been reported anywhere else? It is probably an issue with FlexDLL not being able to link empty library files. On my system the file just contained, <!arch>. |
Comment author: @protz Linking empty files has been fixed in the latest version of flexdll (which is bundled in the "new iteration of the windows installer", per my message on the caml-list). |
Comment author: @johnwhitington Thanks for the fixes and the advice. The bug can be closed now. |
Original bug ID: 6114
Reporter: @johnwhitington
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2015-12-11T18:23:47Z)
Resolution: not a bug
Priority: normal
Severity: minor
Platform: Windows
Version: 4.00.1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @gasche
Bug description
In order to get OCaml working on cygwin from protz's installer (which is slightly broken at the moment with respect to the latest cygwin), I had to symbolically link "gcc" and "cc" to the actual implementation, for example to gcc-mingw-w64-i686.exe
So then, ocamlopt -cc "cc" gives "Access denied" because one can't execute a symbolic link. So, I had to actually rename the executables.
Should tools like ocamlopt follow symbolic links when calling external programs, or is that bad style?
The text was updated successfully, but these errors were encountered: