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

opam install lablgtk → pkg-config #32

Closed Chris00 closed 7 years ago

Chris00 commented 7 years ago

Performing opam install lablgtk seem to use the wrong pkg-config (line 690) — in the .opam dir — although launching pkg-config from bash works.

fdopen commented 7 years ago

Short version: Try to add lablgtk to EXTRA_DEPS or DEPOPTS (see https://github.com/ocaml/ocaml-ci-scripts/blob/master/README-travis.md#optional-dependencies ). It will hopefully work for AppVeyor, too.

Long version: There are (at least) three sets of tools and libraries provided by cygwin:

1) pkg-config and libgtk2.0-devel (for libraries linked against cygwin1.dll, not supported by this repo, so you are installing the wrong one here: https://github.com/Chris00/ocaml-cairo/blob/d43d96a69cce32b51638b3c416ccc9bebdcdffd4/appveyor.yml#L17 ) 2) i686-w64-mingw32-pkg-config and mingw64-i686-gtk2.0 for native 32-bit windows applications 3) x86_64-w64-mingw32-pkg-config and mingw64-x86_64-gtk2.0 for native 64-bit windows applications.

The confusion is largely hidden by depext-cygwinports. It will install a wrapper for pkg-config to $(opam config var bin) - so you neither need to set any environment variables for pkg-config nor manually add a prefix to pkg-config. And it will install anything necessary for opam depext.

So opam install depext-cygwinports depext && opam depext -i lablgtk should work. It will install either mingw64-i686-gtk2.0 or mingw64-x86_64-gtk2.0 (depending on your switch) from cygwin's repo and lablgtk from this repo. (There is only one caveat: You need to manually add either /usr/i686-w64-mingw32/sys-root/mingw/bin or /usr/x86_64-w64-mingw32/sys-root/mingw/bin to your PATH. See: https://github.com/fdopen/opam-repository-mingw#things-to-remember ; opam.1.x doesn't allow packages like depext-cygwinports to add something to the environment.)

ocaml-ci-scripts normally will do all these steps for you. It will install depext-cygwinports and depext and configure your environment. However, if you use a PREINSTALL_HOOK (like https://github.com/Chris00/ocaml-cairo/blob/d43d96a69cce32b51638b3c416ccc9bebdcdffd4/appveyor.yml#L10 ), you have do it manually.

Chris00 commented 7 years ago

Thank you for this very clear explanation. Maybe some of this advice should be given in the README? That way, it would also be possible to point it from ocaml-ci-scripts.

fdopen commented 7 years ago

The information and the link to depext-cygwinports are no mentioned inside Appveyor's README: https://github.com/ocaml/ocaml-ci-scripts/blob/master/README-appveyor.md