fdopen / opam-repository-mingw

windows package repository for OPAM (mingw and msvc)
https://fdopen.github.io/opam-repository-mingw/
Creative Commons Zero v1.0 Universal
96 stars 33 forks source link

ocurl not installable #12

Closed talex5 closed 8 years ago

talex5 commented 8 years ago

I'm trying to use @samoht's Appveyor scripts to build 0install on Windows. All the dependencies install except for ocurl. Any chance of getting that supported? I get:

#=== ERROR while compiling conf-libcurl.1 =====================================#
# opam-version         1.3.0~dev (308be376d177c155c1f7f86a8ffaf621c9029836)
# os                   win32
# command              pkg-config libcurl
# path                 C:/cygwin/home/appveyor/.opam/4.02.3+mingw64c/build/conf-libcurl.1
# exit-code            1
# env-file             C:/cygwin/home/appveyor/.opam/4.02.3+mingw64c/build/conf-libcurl.1\conf-libcurl-268-af57d6.env
# stdout-file          C:/cygwin/home/appveyor/.opam/4.02.3+mingw64c/build/conf-libcurl.1\conf-libcurl-268-af57d6.out
# stderr-file          C:/cygwin/home/appveyor/.opam/4.02.3+mingw64c/build/conf-libcurl.1\conf-libcurl-268-af57d6.err

=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
  ∗  install my-pkg ~unknown
  ∗  install ocurl  0.7.6   
The following actions failed
  λ  build conf-libcurl 1
The following changes have been performed
  ∗  install biniou          1.0.9 
  ∗  install camlp4          4.02+7
  ∗  install conf-pkg-config 1.0   
  ∗  install conf-which      1     
  ∗  install cppo            1.3.1 
  ∗  install easy-format     1.2.0 
  ∗  install extlib          1.7.0 
  ∗  install lwt             2.5.1 
  ∗  install ounit           2.0.0 
  ∗  install ppx_tools       0.99.3
  ∗  install react           1.2.0 
  ∗  install sha             1.9   
  ∗  install xmlm            1.2.0 
  ∗  install yojson          1.3.1 

=-=- conf-libcurl.1 troubleshooting -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=> This package relies on external (system) dependencies that may be missing.
   `opam depext conf-libcurl.1' may help you find the correct installation for
   your system.

The former state can be restored with:
C:\cygwin\usr\local\bin\opam.exe switch import
"C:/cygwin/home/appveyor/.opam/4.02.3+mingw64c/backup/state-20160203103701.export"

Thanks!

fdopen commented 8 years ago

The linked scripts probably just forgot the load the initial environment. Try this version: https://github.com/fdopen/ocaml-ci-scripts https://raw.githubusercontent.com/fdopen/ocaml-ci-scripts/master/appveyor.yml https://raw.githubusercontent.com/fdopen/ocaml-ci-scripts/master/appveyor-opam.sh

talex5 commented 8 years ago

That fixes it for me - thanks!

samoht commented 8 years ago

Can you make a patch to upstream (to the appveyor scripts)? that looks like a nice fix :-)

talex5 commented 8 years ago

However, although ocurl now installs, it doesn't run for me. I tried with 0install, and also with the ocurl examples. I get:

C:/OCaml64/home/User/ocurl.0.7.6/examples/ocurl.exe: error while loading shared libraries: libcurl-4.dll: cannot open shared object file: No such file or directory

What do I need to do to let it find the libraries it needs?

fdopen commented 8 years ago

The dlls are inside C:/OCaml64/usr/x86_64-w64-mingw32/sys-root/mingw/bin. Windows won't find them there by default. You must either add this folder to your PATH or copy the used dlls from there to the folder of your binary.

The cygwin maintainer use this convention to avoid name clashes. There is one curl-config script at /usr/bin (for cygwin's version of libcurl), one in /usr/x86_64-w64-mingw32/sys-root/mingw/bin (64-bit native windows) and one in /usr/i686-w64-mingw32/sys-root/mingw/bin (32-bit native windows). The dll at /usr/x86_64-w64-mingw32/sys-root/mingw/bin and /usr/i686-w64-mingw32/sys-root/mingw/bin usually have identical names.

If your cygwin version has the same word size as your compiled program, cygcheck examples/ocurl.exe will output a dependency graph and complain about missing dlls. Otherwise, you can use something like x86_64-w64-mingw32-objdump.exe -p examples/ocurl.exe | grep -i 'DLL Name:' and repeat it recursively for each listed dll. However, it won't work for complex libraries that decide at runtime, which libraries to load (gtk2+, qt, ... ).

talex5 commented 8 years ago

Thanks - that fixed it!