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

Compilation fail with opam-putenv in MSYS2+MinGW #4104

Closed
MisterDA opened this issue Mar 4, 2020 · 5 comments
Closed

Compilation fail with opam-putenv in MSYS2+MinGW #4104

MisterDA opened this issue Mar 4, 2020 · 5 comments
Assignees

Comments

@MisterDA
Copy link
Contributor

MisterDA commented Mar 4, 2020

Hi! I’m compiling OCaml 4.10 and Opam's master (8da623a) on MSYS2 with MinGW.
This is an excerpt of the script I’m using to compile:

PREFIX=/opt/ocaml-platform/
BUILD=x86_64-pc-msys
HOST=x86_64-w64-mingw32

curl -SLfs "https://github.com/ocaml/opam/archive/master.zip" -o opam.zip
unzip opam.zip

cd opam-master || exit
sed -e 's|^URL_mccs.*|URL_mccs = https://github.com/AltGr/ocaml-mccs/archive/1.1+11.tar.gz|' \
    -e 's|^MD5_mccs.*|MD5_mccs = 9c0038d0e945f742b9320a662566288b|' \
    -i src_ext/Makefile.sources
./configure --build="$BUILD" --host="$HOST"  --prefix="$PREFIX"
make lib-ext all -j1 DUNE_ARGS='--verbose '
$ ./configure --build="$BUILD" --host="$HOST" --prefix="$PREFIX"
configure: loading site script /mingw64/etc/config.site
checking for x86_64-w64-mingw32-ocamlc... no
checking for ocamlc... ocamlc
configure: WARNING: using cross tools not prefixed with host triplet
OCaml version is 4.10.0
OCaml library path is C:/msys64/opt/ocaml-platform/lib/ocaml
checking for x86_64-w64-mingw32-ocamlopt... no
checking for ocamlopt... ocamlopt
checking for x86_64-w64-mingw32-ocamlc.opt... no
checking for ocamlc.opt... ocamlc.opt
checking for x86_64-w64-mingw32-ocamlopt.opt... no
checking for ocamlopt.opt... ocamlopt.opt
checking for x86_64-w64-mingw32-ocaml... no
checking for ocaml... ocaml
checking for x86_64-w64-mingw32-ocamldep... no
checking for ocamldep... ocamldep
checking for x86_64-w64-mingw32-ocamldep.opt... no
checking for ocamldep.opt... ocamldep.opt
checking for x86_64-w64-mingw32-ocamlmktop... no
checking for ocamlmktop... ocamlmktop
checking for x86_64-w64-mingw32-ocamlmklib... no
checking for ocamlmklib... ocamlmklib
checking for x86_64-w64-mingw32-ocamldoc... no
checking for ocamldoc... ocamldoc
checking for x86_64-w64-mingw32-ocamldoc.opt... no
checking for ocamldoc.opt... ocamldoc.opt
checking for x86_64-w64-mingw32-ocamlbuild... no
checking for ocamlbuild... no
checking OCaml Sys.os_type... Win32
checking for gawk... gawk
checking for compiler type... cc
checking for compiler architecture... amd64
checking for compiler system... mingw64
checking for x86_64-w64-mingw32-x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc.exe
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-w64-mingw32-gcc.exe accepts -g... yes
checking for x86_64-w64-mingw32-gcc.exe option to accept ISO C89... none needed
checking for x86_64-w64-mingw32-i686-w64-mingw32-gcc... no
checking for i686-w64-mingw32-gcc... no
configure: WARNING: Complementary C compiler not found - opam-putenv will not be built
checking for x86_64-w64-mingw32-ocamlobjinfo... no
checking for ocamlobjinfo... ocamlobjinfo
checking for x86_64-w64-mingw32-ocamlfind... no
checking for ocamlfind... no
checking for curl... curl
checking for x86_64-w64-mingw32-dune... no
checking for dune... no
checking for x86_64-w64-mingw32-cppo... no
checking for cppo... no
checking for x86_64-w64-mingw32-patch... no
checking for patch... patch
checking for x86_64-w64-mingw32-bunzip2... no
checking for bunzip2... bunzip2
checking for a workable solution for ln -s... cp -a

checking for OCaml findlib package unix... not found
checking for OCaml findlib package bigarray... not found
checking for OCaml findlib package extlib... not found
checking for OCaml findlib package re... not found
checking for OCaml findlib package re.glob... not found
checking for OCaml findlib package cmdliner... not found
checking for OCaml findlib package ocamlgraph... not found
checking for OCaml findlib package cudf... not found
checking for OCaml findlib package dose3.common... not found
checking for OCaml findlib package dose3.algo... not found
checking for OCaml findlib package opam-file-format... not found
checking for OCaml findlib package mccs... not found
checking for x86_64-w64-mingw32-g++... x86_64-w64-mingw32-g++
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-w64-mingw32-g++ accepts -g... yes

============================================================================
Some dependencies are missing. If you are just interested in the stand-alone
'opam' binary, run 'make lib-ext' to download and include them.
============================================================================

configure: creating ./config.status
config.status: creating Makefile.config
config.status: creating src/ocaml-flags-configure.sexp
config.status: creating src/stubs/c-flags.sexp

Opam will be built WITH a built-in solver

Executables will be installed in /opt/ocaml-platform/bin
Manual pages will be installed in /opt/ocaml-platform/share/man

Note the line configure: WARNING: Complementary C compiler not found - opam-putenv will not be built. This is the error:

Command [1] exited with code 2:
$ (cd _build/default/src/stubs && C:\msys64\opt\ocaml-platform\bin\ocaml.exe build-putenv.ml opam-putenv.exe opam-putenv.c cc64)
Exception: End_of_file.
make: *** [Makefile:117: build-opam] Error 1

This may be related to

There are two problems which this highlights, thanks:

  • We need to wind the src_ext version of Dune forward to at least 1.6.0, since versions prior to this are not compatible with OCaml 4.08.0+
  • opam-putenv is unconditionally built on the Windows branch (I haven't checked as to whether enabled_if has been merged into dune yet for the executable stanza, though there's a workaround if not)

Originally posted by @dra27 in #3834 (comment)

Any help would be greatly appreciated.

@MisterDA
Copy link
Contributor Author

MisterDA commented Mar 10, 2020

I still have this error on Cygwin+mingw64, and msys2+mingw64. I think that I’ve eliminated what I was doing wrong in my build script. I’m using OCaml 4.10 and Opam’s master.

@MisterDA
Copy link
Contributor Author

I’m still having this error. The file cc64 is empty.

Command [2] exited with code 2:
$ (cd _build/default/src/stubs && C:\Users\User\Downloads\ocaml-platform-master\opam-def89fc4fc1af53bf1f8d420129abc398751
cd6c\bootstrap\ocaml\bin\ocaml.exe build-putenv.ml opam-putenv.exe opam-putenv.c cc64)
Exception: End_of_file.
Raised at file "stdlib.ml", line 441, characters 20-31
Called from file "stdlib.ml", line 456, characters 28-39
Called from file ".\build-putenv.ml", line 8, characters 14-26
Re-raised at file ".\build-putenv.ml", line 11, characters 49-50
Called from file "toplevel/toploop.ml", line 180, characters 17-56

Instructions to reproduce are here.

@dra27
Copy link
Member

dra27 commented Jun 7, 2021

The problem is noted here:

configure: WARNING: Complementary C compiler not found - opam-putenv will not be built

the bug is that Dune is then trying to build opam-putenv!

@dra27
Copy link
Member

dra27 commented Jun 7, 2021

(the workaround is to install mingw64-i686-gcc-core)

@dra27 dra27 added the KIND: BUG label Jul 8, 2021
@dra27 dra27 added this to the 2.2.0~alpha milestone Jul 8, 2021
@dra27 dra27 removed this from the 2.2.0~alpha milestone Jan 23, 2023
@kit-ty-kate
Copy link
Member

Fixed by #5522. If you're still having the issue, please feel free to reopen.

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

3 participants