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

Cannot compile ocaml-base-compiler.4.10.0 under MSVC+Cygwin #24186

Open
MisterDA opened this issue May 19, 2020 · 7 comments
Open

Cannot compile ocaml-base-compiler.4.10.0 under MSVC+Cygwin #24186

MisterDA opened this issue May 19, 2020 · 7 comments
Assignees

Comments

@MisterDA
Copy link
Contributor

Hi,
I’m using Opam under Cygwin with the MSVC64 compiler. When initializing Opam, I configure it to build the ocaml-base-compiler.4.10.0 package. The build script I’m using is essentially the same as Opam CI.
You can see the build log on AppVeyor and the code that produced it.

The command is essentially:

OPAMROOT="$(cygpath -m "${PREFIX}/opam")"; export OPAMROOT
OPAMSWITCH=default; export OPAMSWITCH

opam init -y -a --disable-sandboxing \
    -c "ocaml-base-compiler.${OCAML_VERSION}" \
    "$OPAM_REPO"

However, I have two issues:

  1. OCAML_STDLIB_DIR

    This variable seems to be generated from OCaml's configure script. The problem is that the path is in the Windows format. The backlash are not escaped and are considered as 'unknown escape sequences' in C code. I have not been able to override this variable. I tried setting OCAMLLIB with mixed path style (Windows path with forward slashes), to no avail.
    An excerpt of the error:

    gcc -c -O2 -fno-strict-aliasing -fwrapv -Wall -fno-common -fno-tree-vrp -g -D_FILE_OFFSET_BITS=64 -U_WIN32 -D_REENTRANT -DCAML_NAME_SPACE   -DOCAML_STDLIB_DIR='"C:\cygwin64\opt\OCamlPlatform\opam\ocaml-base-compiler.4.10.0/lib/ocaml"' -o dynlink_b.o dynlink.c
    - dynlink.c: In function ‘parse_ld_conf’:
    - dynlink.c:91:32: warning: unknown escape sequence: '\c'
    -    91 |   if (stdlib == NULL) stdlib = OCAML_STDLIB_DIR;
    -       |                                ^~~~~~~~~~~~~~~~
    - dynlink.c:91:32: warning: unknown escape sequence: '\o'
    - dynlink.c:91:32: warning: unknown escape sequence: '\O'
    - dynlink.c:91:32: warning: unknown escape sequence: '\o'
    - dynlink.c:91:32: warning: unknown escape sequence: '\o'
    
  2. flexdll.h: No such file or directory

    My guess is that it is possible that during the compilation of ocaml-compiler-base, the flexdll directory of the OCaml sources is not populated with Flexdll, or that the compiler gets wrong paths to the flexdll installation. What’s the play here? Should Flexdll be installed globally?

    - gcc -c -O2 -fno-strict-aliasing -fwrapv -Wall -fno-common -fno-tree-vrp -g -D_FILE_OFFSET_BITS=64 -U_WIN32 -D_REENTRANT -DCAML_NAME_SPACE   -o unix_b.o unix.c
    - unix.c:35:10: fatal error: flexdll.h: No such file or directory
    -    35 | #include "flexdll.h"
    -       |          ^~~~~~~~~~~
    - compilation terminated.
    - make[1]: *** [Makefile:341: unix_b.o] Error 1
    

Thanks!

@dra27
Copy link
Member

dra27 commented May 19, 2020

You're doing this with normal opam-repository, right? This simply doesn't work at the moment - opam-repository doesn't support building ocaml-base-compiler on MSVC.

@MisterDA
Copy link
Contributor Author

Oh, thanks.

@MisterDA
Copy link
Contributor Author

Why doesn’t opam-repository support MSVC? What can be done to fix that?

@dra27
Copy link
Member

dra27 commented May 19, 2020

Start in ocaml/opam#246 and go from there 🙂

@dra27
Copy link
Member

dra27 commented May 19, 2020

(also https://fdopen.github.io/opam-repository-mingw/ if you're not already aware)

@dra27 dra27 self-assigned this Jul 8, 2021
@dra27
Copy link
Member

dra27 commented Jul 8, 2021

I'm on in this as part of the upgrade of ocaml-base-compiler packages to support Windows for 2.2.0

@kit-ty-kate kit-ty-kate transferred this issue from ocaml/opam Jul 31, 2023
@kit-ty-kate
Copy link
Member

i moved this issue to opam-repository as it is now mostly an opam-repository issue since the release of opam.2.2.0~alpha

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

No branches or pull requests

3 participants