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

make use of the cygwin packages instead of custom binaries #1

Open
andyli opened this issue May 12, 2017 · 3 comments
Open

make use of the cygwin packages instead of custom binaries #1

andyli opened this issue May 12, 2017 · 3 comments

Comments

@andyli
Copy link

andyli commented May 12, 2017

Hi,

I'm packaging opam for cygwin, and I believe it will be accepted into the cygwin repo soon. It works nicely with the ocaml cygwin package, but not so much with https://github.com/fdopen/opam-repository-mingw.

I ran the commands as follow:

$ opam repo add mingw 'https://github.com/fdopen/opam-repository-mingw.git'
[mingw] https://github.com/fdopen/opam-repository-mingw.git updated

$ opam switch 4.03.0+mingw32

=-=- Installing compiler 4.03.0+mingw32 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[mingw.comp] http://caml.inria.fr/pub/distrib/ocaml-4.03/ocaml-4.03.0.tar.xz downloaded
Now compiling OCaml. This may take a while, please bear with us...
[ERROR] Compiler build failed at "make -f Makefile.nt world.opt":
        # opam-version 1.2.2
        # os           cygwin
        # command      make -f Makefile.nt world.opt
        # path         /home/andy/.opam/4.03.0+mingw32/build/ocaml
        # exit-code    2
        # env-file     /home/andy/.opam/log/log-265380-335865.env
        # stdout-file  /home/andy/.opam/log/log-265380-335865.out
        # stderr-file  /home/andy/.opam/log/log-265380-335865.err
        ### stdout ###
        # [...]
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c bytecomp/bytelink.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c bytecomp/bytelibrarian.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c bytecomp/bytepackager.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c driver/errors.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c driver/compile.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -a -o compilerlibs/ocamlbytecomp.cmxa
        bytecomp/meta.cmx bytecomp/instruct.cmx bytecomp/bytegen.cmx bytecomp/printinstr.cmx bytecomp/opcodes.cmx
        bytecomp/emitcode.cmx bytecomp/bytesections.cmx bytecomp/dll.cmx bytecomp/symtable.cmx bytecomp/bytelink.cmx
        bytecomp/bytelibrarian.cmx bytecomp/bytepackager.cmx driver/errors.cmx driver/compile.cmx
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c driver/main.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink  -ccopt "" -o ocamlc.opt \
        #           compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \
        #           driver/main.cmx -cclib "-lws2_32"
        ### stderr ###
        # 'flexlink' is not recognized as an internal or external command,
        # operable program or batch file.
        # File "caml_startup", line 1:
        # Error: Error during linking
        # make: *** [Makefile.nt:444: ocamlc.opt] Error 2

It might be due to flexdll is installed in a layout that the ocaml makefile didn't expect.

If I cp /usr/lib/flexdll/* /usr/bin/, I can go a bit further, but got another issue:

[ERROR] Compiler build failed at "make -f Makefile.nt world.opt":
        # opam-version 1.2.2
        # os           cygwin
        # command      make -f Makefile.nt world.opt
        # path         /home/andy/.opam/4.03.0+mingw32/build/ocaml
        # exit-code    2
        # env-file     /home/andy/.opam/log/log-271256-335865.env
        # stdout-file  /home/andy/.opam/log/log-271256-335865.out
        # stderr-file  /home/andy/.opam/log/log-271256-335865.err
        ### stdout ###
        # [...]
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c bytecomp/bytelink.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c bytecomp/bytelibrarian.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c bytecomp/bytepackager.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c driver/errors.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c driver/compile.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -a -o compilerlibs/ocamlbytecomp.cmxa
        bytecomp/meta.cmx bytecomp/instruct.cmx bytecomp/bytegen.cmx bytecomp/printinstr.cmx bytecomp/opcodes.cmx
        bytecomp/emitcode.cmx bytecomp/bytesections.cmx bytecomp/dll.cmx bytecomp/symtable.cmx bytecomp/bytelink.cmx
        bytecomp/bytelibrarian.cmx bytecomp/bytepackager.cmx driver/errors.cmx driver/compile.cmx
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink -strict-sequence -principal -w
        +33..39+48+50 -warn-error A -bin-annot -safe-string -strict-formats -I utils -I parsing -I typing -I bytecomp
        -I middle_end -I middle_end/base_types -I asmcomp -I driver -I toplevel -c driver/main.ml
        # boot/ocamlrun ./ocamlopt -g -nostdlib -I stdlib -I otherlibs/dynlink  -ccopt "" -o ocamlc.opt \
        #           compilerlibs/ocamlcommon.cmxa compilerlibs/ocamlbytecomp.cmxa \
        #           driver/main.cmx -cclib "-lws2_32"
        ### stderr ###
        # Access is denied.
        # File "caml_startup", line 1:
        # Error: Error during linking
        # make: *** [Makefile.nt:444: ocamlc.opt] Error 2

It would be great if the repo can be patched to work with the cygwin packages out of the box.
If the opam.exe is patched in some way, I will see if it is possible to include the patch in the cygwin package.

@fdopen
Copy link
Owner

fdopen commented May 12, 2017

Sorry, I don't think it would be worth the effort. There are too many problems, if you intend to use a opam.exe that is linked against cygwin1.dll with this repo:

  • opam will use path expressions like /home/user/.opam/switch/bin that are only understood by cygwin, not native windows applications.

  • "os" will be "cygwin", so all windows specific patches won't be applied:

patches: [
  "patch-zarith-1.4" { os = "win32" }
  "patch-configure"  { os = "win32" }
]

@andyli
Copy link
Author

andyli commented May 12, 2017

Ummm, so the opam.exe used in this repo is compiled with mingw? How did you build that? Was that building a mingw ocaml compiler first and use that to compile opam?

@fdopen
Copy link
Owner

fdopen commented May 12, 2017

Yes,
it was build with the mingw port of OCaml and the original bootstrapping was annoying because of the long dependency chain. (The patches for opam are available here: https://bitbucket.org/fdopen/ But they are not longer maintained. dra27 will hopefully be able to produce something usable for opam 2.0 and later)

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

2 participants