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

Opam compilation on Cygwin fails (opam-admin-cache) #4090

Closed
MisterDA opened this issue Feb 18, 2020 · 4 comments · Fixed by #4129
Closed

Opam compilation on Cygwin fails (opam-admin-cache) #4090

MisterDA opened this issue Feb 18, 2020 · 4 comments · Fixed by #4129

Comments

@MisterDA
Copy link
Contributor

Hi!

I’m trying to bootstrap OCaml+Opam in Cygwin.
I’ve set up the environment as described in the readme.

setup-x86_64 --root=C:\cygwin64 --quiet-mode --no-desktop --no-startmenu --packages=make,mingw64-i686-gcc-core,mingw64-x86_64-gcc-core,m4,patch

Then ran:

make compiler
make lib-pkg
./configure
make 

But I got this error in the last step:

dune build --profile=release  opam-installer.install opam.install
Done: 899/902 (jobs: 1)File "doc/man/opam-admin-cache.err", line 1, characters 0-0:
        diff (internal) (exit 1)
(cd _build/default && C:\cygwin64\bin\diff.exe -u --strip-trailing-cr doc/man/opam-admin-cache.err doc/man/opam-admin-cache.0)
--- doc/man/opam-admin-cache.err        2020-02-18 18:27:56.968589100 +0100
+++ doc/man/opam-admin-cache.0  2020-02-18 18:25:52.391389600 +0100
@@ -1,6 +0,0 @@
-cmdliner error: Illegal escape char 'o' in "$(i,DIR) (absent=~\\opam-2.0.6\\_build\\default\\doc\\man\\cache)"
-cmdliner error: Illegal escape char '_' in "$(i,DIR) (absent=~\\opam-2.0.6\\_build\\default\\doc\\man\\cache)"
-cmdliner error: Illegal escape char 'd' in "$(i,DIR) (absent=~\\opam-2.0.6\\_build\\default\\doc\\man\\cache)"
-cmdliner error: Illegal escape char 'd' in "$(i,DIR) (absent=~\\opam-2.0.6\\_build\\default\\doc\\man\\cache)"
-cmdliner error: Illegal escape char 'm' in "$(i,DIR) (absent=~\\opam-2.0.6\\_build\\default\\doc\\man\\cache)"
-cmdliner error: Illegal escape char 'c' in "$(i,DIR) (absent=~\\opam-2.0.6\\_build\\default\\doc\\man\\cache)"
make: *** [Makefile:114: build-opam] Error 1

What can be done to fix this?

Thanks!

@rjbou
Copy link
Collaborator

rjbou commented Feb 18, 2020

I'll ping @dra27 and maybe @dbuenzli on this one.

@MisterDA
Copy link
Contributor Author

This is the script I’m using to compile on Windows.

#!/bin/sh

# setup-x86_64 --root=C:\cygwin64 --quiet-mode --no-desktop --no-startmenu --packages=make,mingw64-x86_64-gcc-core,m4,patch --site "http://mirrors.kernel.org/sourceware/cygwin/"
# C:\cygwin64\bin\mintty -
# echo "none /cygdrive cygdrive noacl,binary,posix=0,user 0 0" > /etc/fstab

OCAML_VERSION=4.09.0
OCAML_PATH=ocaml-${OCAML_VERSION}
OPAM_VERSION=2.0.6
FLEXDLL_VERSION=0.37

PREFIX=/usr/local
BUILD=x86_64-pc-cygwin
HOST=x86_64-w64-mingw32

BUILDDIR=/cygdrive/c/ocaml_platform_build

MAKEFLAGS=-j$(nproc)
export MAKEFLAGS

CYGWIN="nodosfilewarning winsymlinks:native"
export CYGWIN

mkdir -p "$BUILDDIR"
cd "$BUILDDIR" || exit 1

curl -SLfs "https://github.com/ocaml/ocaml/archive/${OCAML_VERSION}.tar.gz" -o "${OCAML_VERSION}.tar.gz"
tar xf "${OCAML_VERSION}.tar.gz"

curl -SLfs "https://github.com/alainfrisch/flexdll/archive/${FLEXDLL_VERSION}.tar.gz" -o "${FLEXDLL_VERSION}.tar.gz"
tar xf "${FLEXDLL_VERSION}.tar.gz"
mv "flexdll-${FLEXDLL_VERSION}"/* "${OCAML_PATH}/flexdll/"

cd "${OCAML_PATH}" || exit 1
./configure --build="$BUILD" --host="$HOST" --prefix="$PREFIX"
make flexdll
make world.opt
make flexlink.opt
make install

cd "$BUILDDIR" || exit 1

curl -SLfs "https://github.com/ocaml/opam/releases/download/${OPAM_VERSION}/opam-full-${OPAM_VERSION}.tar.gz" -o "opam-full-${OPAM_VERSION}.tar.gz"
tar xf "opam-full-${OPAM_VERSION}.tar.gz"

OCAMLLIB="C:/cygwin64$PREFIX/lib/ocaml"
CAML_LD_LIBRARY_PATH="$OCAMLLIB/stublibs;$OCAMLLIB"
export OCAMLLIB
export CAML_LD_LIBRARY_PATH

cd "opam-full-${OPAM_VERSION}" || exit 1
./configure --build="$BUILD" --host="$HOST" --prefix="$PREFIX"
make lib-ext all -j1 OCAMLC='ocamlc -unsafe-string' OCAMLOPT='ocamlopt -unsafe-string'
make install

cd "$BUILDDIR" || exit 1

OPAMYES=true
export OPAMYES

opam --init -a --disable-sandboxing
eval $(opam env)

It still fails on the same error.

MisterDA added a commit to MisterDA/ocaml-platform that referenced this issue Feb 26, 2020
Currently has a bug in the compilation of cmdliner, a dependency of
Opam.  See ocaml/opam#4090.
@MisterDA
Copy link
Contributor Author

MisterDA commented Mar 4, 2020

The error disappears when using master (8da623a).

@MisterDA MisterDA closed this as completed Mar 4, 2020
@rjbou
Copy link
Collaborator

rjbou commented Apr 9, 2020

Finally found out! It was resolved with #3911

@rjbou rjbou linked a pull request Apr 16, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants