diskuv / dkml-installer-ocaml

The Windows-friendly distribution of OCaml
Apache License 2.0
62 stars 2 forks source link

`with-dkml opam switch` got flexlink error #53

Closed liweijian closed 1 year ago

liweijian commented 1 year ago

I some how need to switch a private ocaml repo in Windows, I've installed dkml.

PS C:\Users\tli> with-dkml opam switch --repositories=ide-dev create ide-dev ocaml-variants.4.14.1+ide --jobs=1

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-variants" {= "4.14.1+ide"}]
[NOTE] External dependency handling not supported for OS family 'windows'.
       You can disable this check using 'opam option --global depext=false'
[NOTE] External dependency handling not supported for OS family 'windows'.
       You can disable this check using 'opam option --global depext=false'

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
* installed base-bigarray.base
* installed base-threads.base
* installed base-unix.base
▼ retrieved ocaml-variants.4.14.1+ide  (https://github.com/ocaml/ocaml/archive/4.14.1.tar.gz)
[ERROR] The compilation of ocaml-variants.4.14.1+ide failed at "./configure --prefix=C:\\Users\\tli\\AppData\\Local\\opam\\ide-dev
        --docdir=C:\\Users\\tli\\AppData\\Local\\opam\\ide-dev\\doc/ocaml -C --disable-warn-error".

#=== ERROR while compiling ocaml-variants.4.14.1+ide =========================#
# context     2.2.0~alpha0~20221228 | win32/x86_64 |  | git+file://C:/Users/tli/opam-repository
# path        C:\Users\tli\AppData\Local\opam\ide-dev\.opam-switch\build\ocaml-variants.4.14.1+ide
# command     C:\Users\tli\AppData\Local\opam\ide-dev\.opam-switch\build\ocaml-variants.4.14.1+ide\./configure --prefix=C:\Users\tli\AppData\Local\opam\ide-dev --docdir=C:\Users\tli\AppData\Local\opam\ide-dev\doc/ocaml -C --disable-warn-error
# exit-code   1
# env-file    C:\Users\tli\AppData\Local\opam\log\ocaml-variants-4468-1e5556.env
# output-file C:\Users\tli\AppData\Local\opam\log\ocaml-variants-4468-1e5556.out
### output ###
# [...]
# checking how to hardcode library paths into programs... immediate
# checking whether stripping libraries is possible... no
# checking if libtool supports shared libraries... yes
# checking whether to build shared libraries... yes
# checking whether to build static libraries... yes
# checking C compiler vendor... msvc-1926
# checking whether host executables can be run in the build... yes
# checking whether #! works in shell scripts... yes
# checking whether the C compiler supports -d2VolatileMetadata-... yes
# checking for flexdll sources... checking for flexlink... flexlink
# checking whether flexlink works... no
# configure: error: flexlink does not work

I've read this issue, and this issue, but it seems that they are not applying to my specific case, just wondering is there any way to work around?

jonahbeckford commented 1 year ago

That is an interesting way to create a switch. The failure does look very much related to the first issue you mentioned. But even if the first issue you mentioned was fixed (which it will be in the next release), I wouldn't suggest creating a switch that way on Windows. Many tweaks to the switch are needed for OCaml on native Windows.

The only official way to create a switch is typing dkml init in a directory. That will give you OCaml 4.14.0 and do all the tweaks required.

liweijian commented 1 year ago

@jonahbeckford Cool, thanks for your reply. Just wondering when will the next release? I'd like to give it a shot:)

jonahbeckford commented 1 year ago

I am trying to have something ready this week.

liweijian commented 1 year ago

@jonahbeckford Just out of curiosity, if we are gonna to throw opam switch away, how can we applying patch to the 4.14 opam repo in dkml?

jonahbeckford commented 1 year ago

You can:

  1. Fork the dkml-base-compiler at https://github.com/diskuv/dkml-compiler.git. Any patches you need can be added following instructions at https://github.com/diskuv/dkml-compiler#patching. They go here: https://github.com/diskuv/dkml-compiler/tree/main/src/p
  2. Do a dkml init to create a local switch
  3. Update the new opam switch with your patched dkml-base-compiler. Something like: opam pin dkml-base-compiler git+file:///x/y/z/dkml-compiler/.git --no-action && opam install dkml-base-compiler --update-invariant.
jonahbeckford commented 1 year ago

You can try the Windows 64-bit Installer at https://gitlab.com/diskuv-ocaml/distributions/dkml/-/releases/1.2.1-10 which should fix the flexlink issue.

liweijian commented 1 year ago

You can try the Windows 64-bit Installer at https://gitlab.com/diskuv-ocaml/distributions/dkml/-/releases/1.2.1-10 which should fix the flexlink issue.

I tried to build a 4.14.1 opam repo, still got flexlink issue, is it the same thing? https://github.com/diskuv/diskuv-opam-repository/issues/7

jonahbeckford commented 1 year ago

Two issues open. Closing this one; keeping https://github.com/diskuv/diskuv-opam-repository/issues/7 alive.