# Toy GUI project

**URL:** <https://discourse.haskell.org/t/toy-gui-project/9047>\
**Category:** Uncategorized\
**Created:** [March 13, 2024, 11:03pm UTC](https://discourse.haskell.org/t/toy-gui-project/9047 "2024-03-13T23:03:27Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![bearhug](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bearhug](https://discourse.haskell.org/u/bearhug)\
**Post date:** [March 13, 2024, 11:03pm UTC](https://discourse.haskell.org/t/toy-gui-project/9047/1 "2024-03-13T23:03:27Z")

</div>

I’m trying to build a little toy GUI app depending on `gi-gtk`. I’m on Fedora 39. AFAICT I have all the required dependencies installed but I can’t get it to compile. I always get

```haskell
cabal build
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: gtk-intro-0.1.0.0 (user goal)
[__1] next goal: gi-gtk (dependency of gtk-intro)
[__1] rejecting: gi-gtk-4.0.8, gi-gtk-4.0.6, gi-gtk-4.0.5, gi-gtk-4.0.4,
gi-gtk-4.0.3, gi-gtk-4.0.2, gi-gtk-4.0.1 (conflict: pkg-config package
gtk4-any, not found in the pkg-config database)
[__1] rejecting: gi-gtk-3.0.41, gi-gtk-3.0.39, gi-gtk-3.0.38, gi-gtk-3.0.37,
gi-gtk-3.0.36, gi-gtk-3.0.35, gi-gtk-3.0.34, gi-gtk-3.0.33, gi-gtk-3.0.32,
gi-gtk-3.0.31, gi-gtk-3.0.30, gi-gtk-3.0.29, gi-gtk-3.0.28, gi-gtk-3.0.27,
gi-gtk-3.0.26, gi-gtk-3.0.25, gi-gtk-3.0.24, gi-gtk-3.0.23, gi-gtk-3.0.22,
gi-gtk-3.0.21, gi-gtk-3.0.20, gi-gtk-3.0.19, gi-gtk-3.0.18, gi-gtk-3.0.17,
gi-gtk-3.0.16, gi-gtk-3.0.15, gi-gtk-3.0.14, gi-gtk-3.0.13, gi-gtk-3.0.12,
gi-gtk-3.0.11, gi-gtk-3.0.10, gi-gtk-3.0.9, gi-gtk-3.0.8, gi-gtk-3.0.7,
gi-gtk-3.0.6, gi-gtk-3.0.5, gi-gtk-3.0.4, gi-gtk-3.0.3, gi-gtk-3.0.2,
gi-gtk-3.0.1 (conflict: pkg-config package gtk+-3.0-any, not found in the
pkg-config database)
[__1] rejecting: gi-gtk-0.3.18.15, gi-gtk-0.3.18.14, gi-gtk-0.3.18.13,
gi-gtk-0.3.18.12 (conflict: pkg-config package gtk+-3.0>=3.18, not found in
the pkg-config database)
[__1] rejecting: gi-gtk-0.3.16.12 (conflict: pkg-config package
gtk+-3.0>=3.16, not found in the pkg-config database)
[__1] rejecting: gi-gtk-0.3.18.10 (conflict: pkg-config package
gtk+-3.0>=3.18, not found in the pkg-config database)
[__1] rejecting: gi-gtk-0.3.16.11, gi-gtk-0.3.16.10, gi-gtk-0.3.16.9,
gi-gtk-0.3.16.8 (conflict: pkg-config package gtk+-3.0>=3.16, not found in the
pkg-config database)
[__1] fail (backjumping, conflict set: gi-gtk, gtk-intro)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: gi-gtk, base, gtk-intro

```

`pkg-config` seems to indicate that I have those dependencies installed:

```haskell
pkg-config --list-all | grep gtk
javascriptcoregtk-4.0 JavaScriptCoreGTK+ - GTK+ version of the JavaScriptCore engine
gtk+-3.0 GTK+ - GTK+ Graphical UI Library
gtk+-broadway-3.0 GTK+ - GTK+ Graphical UI Library
gtk+-unix-print-3.0 GTK+ - GTK+ Unix print support
gtk+-wayland-3.0 GTK+ - GTK+ Graphical UI Library
gtk+-x11-3.0 GTK+ - GTK+ Graphical UI Library
gtksourceview-3.0 gtksourceview - Source code editing widget
webkit2gtk-4.0 WebKitGTK - Web content engine for GTK
webkit2gtk-web-extension-4.0 WebKitGTK web process extensions - Web content engine for GTK - web process extensions
gtk+ GTK+ - GIMP Tool Kit
gtk4-broadway GTK - GTK Graphical UI Library
gtk4-unix-print GTK - GTK Unix print support
gtk4-wayland GTK - GTK Graphical UI Library
gtk4-x11 GTK - GTK Graphical UI Library
gtk4 GTK - GTK Graphical UI Library

```

Any suggestions?

---

<div class="post-metadata">

**Author:** ![jaror](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/jaror/32/3271_2.png) [@jaror](https://discourse.haskell.org/u/jaror)\
**Post date:** [March 14, 2024, 12:31am UTC](https://discourse.haskell.org/t/toy-gui-project/9047/2 "2024-03-14T00:31:59Z")

</div>

The [haskell-gi readme](https://github.com/haskell-gi/haskell-gi?tab=readme-ov-file#fedora) lists this as the required dependencies:

> ```haskell
> sudo dnf install gobject-introspection-devel webkitgtk4-devel gtksourceview3-devel
> 
> ```

Maybe you’re missing the `-devel` versions?

---

<div class="post-metadata">

**Author:** ![bearhug](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bearhug](https://discourse.haskell.org/u/bearhug)\
**Post date:** [March 14, 2024, 8:02am UTC](https://discourse.haskell.org/t/toy-gui-project/9047/3 "2024-03-14T08:02:05Z")

</div>

Yes, I’ve done that already (and I double checked, again). They’re all installed.

---

<div class="post-metadata">

**Author:** ![tomjaguarpaw](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tomjaguarpaw/32/1230_2.png) [@tomjaguarpaw](https://discourse.haskell.org/u/tomjaguarpaw)\
**Post date:** [March 14, 2024, 8:31am UTC](https://discourse.haskell.org/t/toy-gui-project/9047/4 "2024-03-14T08:31:00Z")

</div>

What does this say? Is the result \>= 3.18?

```nohighlight
pkg-config --modversion gtk+-3.0 

```

(That wouldn’t explain why it can’t satisfy `gtk+-3.0-any`, but I think it would be interesting to know anyway.)

---

<div class="post-metadata">

**Author:** ![bearhug](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bearhug](https://discourse.haskell.org/u/bearhug)\
**Post date:** [March 14, 2024, 8:33am UTC](https://discourse.haskell.org/t/toy-gui-project/9047/5 "2024-03-14T08:33:56Z")

</div>

It says:

```haskell
pkg-config --modversion gtk+-3.0 
3.24.41

```

---

<div class="post-metadata">

**Author:** ![duplode](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/duplode/32/456_2.png) [@duplode](https://discourse.haskell.org/u/duplode)\
**Post date:** [March 14, 2024, 10:50am UTC](https://discourse.haskell.org/t/toy-gui-project/9047/6 "2024-03-14T10:50:55Z")

</div>

This sounds rather like [Cabal 3.10.2.1 cannot parse `pkg-config`: `hGetContents: invalid argument (invalid byte sequence)` · Issue #9608 · haskell/cabal · GitHub](https://github.com/haskell/cabal/issues/9608) . If that’s actually the problem, updating libvpl in your system should solve it, as the upstream fix in [libvpl 2.10.2](https://github.com/intel/libvpl/releases) has landed in Fedora [a couple weeks ago](https://packages.fedoraproject.org/pkgs/libvpl/libvpl/).

---

<div class="post-metadata">

**Author:** ![bearhug](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bearhug](https://discourse.haskell.org/u/bearhug)\
**Post date:** [March 14, 2024, 11:47am UTC](https://discourse.haskell.org/t/toy-gui-project/9047/7 "2024-03-14T11:47:00Z")

</div>

I don’t have `libvpl` on my system so the non-unicode character issue afflicting Cabal doesn’t seem likely.

Looking through that ticket, I see I can make Cabal more verbose. It outputs:

```haskell
...
Resolving dependencies...                                                       
CallStack (from HasCallStack):                                                  
  withMetadata, called at src/Distribution/Simple/Utils.hs:368:14 in Cabal-3.10.2.1-inplace:Distribution.Simple.Utils
Error: cabal: Could not resolve dependencies:                             
[__0] trying: gtk-intro-0.1.0.0 (user goal)                                                                                                                     
[__1] next goal: gi-gtk (dependency of gtk-intro)                                                                                                               
[__1] rejecting: gi-gtk-4.0.8, gi-gtk-4.0.6, gi-gtk-4.0.5, gi-gtk-4.0.4,
gi-gtk-4.0.3, gi-gtk-4.0.2, gi-gtk-4.0.1 (conflict: pkg-config package   
gtk4-any, not found in the pkg-config database)     
[__1] rejecting: gi-gtk-3.0.41, gi-gtk-3.0.39, gi-gtk-3.0.38, gi-gtk-3.0.37,
gi-gtk-3.0.36, gi-gtk-3.0.35, gi-gtk-3.0.34, gi-gtk-3.0.33, gi-gtk-3.0.32, 
gi-gtk-3.0.31, gi-gtk-3.0.30, gi-gtk-3.0.29, gi-gtk-3.0.28, gi-gtk-3.0.27,
gi-gtk-3.0.26, gi-gtk-3.0.25, gi-gtk-3.0.24, gi-gtk-3.0.23, gi-gtk-3.0.22,
gi-gtk-3.0.21, gi-gtk-3.0.20, gi-gtk-3.0.19, gi-gtk-3.0.18, gi-gtk-3.0.17,      
gi-gtk-3.0.16, gi-gtk-3.0.15, gi-gtk-3.0.14, gi-gtk-3.0.13, gi-gtk-3.0.12,      
gi-gtk-3.0.11, gi-gtk-3.0.10, gi-gtk-3.0.9, gi-gtk-3.0.8, gi-gtk-3.0.7,                                                                                         
gi-gtk-3.0.6, gi-gtk-3.0.5, gi-gtk-3.0.4, gi-gtk-3.0.3, gi-gtk-3.0.2,                                                                                           
gi-gtk-3.0.1 (conflict: pkg-config package gtk+-3.0-any, not found in the                                                                                       
pkg-config database)                                                                                                                                            
[__1] rejecting: gi-gtk-0.3.18.15, gi-gtk-0.3.18.14, gi-gtk-0.3.18.13,                                                                                          
gi-gtk-0.3.18.12 (conflict: pkg-config package gtk+-3.0>=3.18, not found in                                                                                     
the pkg-config database)                                                                                                                                        
[__1] rejecting: gi-gtk-0.3.16.12 (conflict: pkg-config package                                                                                                 
gtk+-3.0>=3.16, not found in the pkg-config database)                                                                                                           
[__1] rejecting: gi-gtk-0.3.18.10 (conflict: pkg-config package                                                                                                 
gtk+-3.0>=3.18, not found in the pkg-config database)                                                                                                           
[__1] rejecting: gi-gtk-0.3.16.11, gi-gtk-0.3.16.10, gi-gtk-0.3.16.9,                                                                                           
gi-gtk-0.3.16.8 (conflict: pkg-config package gtk+-3.0>=3.16, not found in the                                                                                  
pkg-config database)                                                                                                                                            
[__1] fail (backjumping, conflict set: gi-gtk, gtk-intro)                                                                                                       
After searching the rest of the dependency tree exhaustively, these were the                                                                                    
goals I've had most trouble fulfilling: gi-gtk (58), gtk-intro (2)                              
...

```

BTW I’m using

```haskell
cabal --version
cabal-install version 3.10.2.1
compiled using version 3.10.2.1 of the Cabal library 

```

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [March 14, 2024, 1:22pm UTC](https://discourse.haskell.org/t/toy-gui-project/9047/8 "2024-03-14T13:22:35Z")

</div>

Does anything mentioned here help?

> [@Installing a library with C dependencies on Windows](http://discourse.haskell.org/t/installing-a-library-with-c-dependencies-on-windows/8557/):
>
> This is a short description of how I managed to install a cabal package with C library dependencies on Windows. I hope this is useful information for others and for myself in the future. Just now I wanted to install the hackage-cli package under windows. Normally that should be as simple as opening powershell and running cabal install hackage-cli but doing that result in an error: Resolving dependencies... Error: cabal-3.10.2.1.exe: Could not resolve dependencies: [\_\_0] trying: hackage-cli-0.1…

---

<div class="post-metadata">

**Author:** ![bearhug](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bearhug](https://discourse.haskell.org/u/bearhug)\
**Post date:** [March 16, 2024, 1:04pm UTC](https://discourse.haskell.org/t/toy-gui-project/9047/9 "2024-03-16T13:04:52Z")

</div>

I traced (using `strace`) what Cabal is doing behind the scenes and I see that Cabal executes:

```bash
/usr/bin/x86_64-redhat-linux-gnu-pkg-config --modversion libfolly fmt rocksdb fwupd-efi grilo-plugins-0.3 libcrypt libxcrypt gmp gmpxx libzstd zlib bzip2 xau pthread-stubs xcb-composite xcb-damage xcb-dpms xcb-dri2 xcb-dri3 xcb-glx xcb-present xcb-randr xcb-record xcb-render xcb-res xcb-screensaver xcb-shape xcb-shm xcb-sync xcb-xf86dri xcb-xfixes xcb-xinerama xcb-xinput xcb-xkb xcb-xselinux xcb-xtest xcb-xv xcb-xvmc xcb libglvnd egl gl glesv1_cm glesv2 glx opengl glu glew pciaccess xext xrender xfixes xcursor xi xinerama glfw3 x11-xcb x11 xrandr gflags icu-i18n icu-io icu-uc libpcre libpcre16 libpcre32 libpcrecpp libpcreposix libglog libxxhash snappy libcrypto libssl openssl liblz4 libunwind-coredump libunwind-generic libunwind-ptrace libunwind libevent libevent_core libevent_extra libevent_openssl libevent_pthreads sqlite3 wayland-eglstream tcl libpcre2-16 libpcre2-32 libpcre2-8 libpcre2-posix sysprof-capture-4 liblzma libxml-2.0 libsepol libselinux libpng libpng16 libffi graphite2 libbrotlicommon libbrotlidec libbrotlienc harfbuzz-cairo harfbuzz-gobject harfbuzz-icu harfbuzz-subset harfbuzz freetype2 xft tk libsodium gio-2.0 gio-unix-2.0 glib-2.0 gmodule-2.0 gmodule-export-2.0 gmodule-no-export-2.0 gobject-2.0 gthread-2.0 sdl2 sdl12_compat SDL_ttf gtest gtest_main gmock gmock_main fmt python-2.7 python2 libdrm libdrm_amdgpu libdrm_intel libdrm_nouveau libdrm_radeon fftw3 fftw3f fftw3l fftw3q alsa-topology alsa fontconfig expat dri blkid mount form formw menu menuw ncurses++ ncurses++w ncurses ncursesw panel panelw tic tinfo z3 libsystemd libudev pixman-1 cairo-fc cairo-ft cairo-pdf cairo-png cairo-ps cairo-script-interpreter cairo-script cairo-svg cairo-tee cairo-xcb-shm cairo-xcb cairo-xlib-xrender cairo-xlib cairo cairo-gobject atk fribidi dbus-1 javascriptcoregtk-4.0 libpsl libsoup-2.4 libsoup-gnome-2.4 xkbcommon xkbregistry cloudproviders wayland-client wayland-cursor wayland-egl-backend wayland-egl wayland-scanner wayland-server libtiff-4 libjpeg gdk-pixbuf-2.0 epoxy datrie-0.2 libthai pango pangocairo pangofc pangoft2 pangoot pangoxft xtst atspi-2 atk-bridge-2.0 xdamage xcomposite gail-3.0 gdk-3.0 gdk-broadway-3.0 gdk-wayland-3.0 gdk-x11-3.0 gtk+-3.0 gtk+-broadway-3.0 gtk+-unix-print-3.0 gtk+-wayland-3.0 gtk+-x11-3.0 gtksourceview-3.0 webkit2gtk-4.0 webkit2gtk-web-extension-4.0 gobject-introspection-1.0 gobject-introspection-no-export-1.0 ice glib gmodule gthread sm xt gdk gtk+ graphene-1.0 graphene-gobject-1.0 gtk4-broadway gtk4-unix-print gtk4-wayland gtk4-x11 gtk4 plasma-key-data bash-completion gnome-video-effects shared-mime-info bigreqsproto compositeproto damageproto dmxproto dpmsproto dri2proto dri3proto fixesproto fontsproto glproto inputproto kbproto presentproto randrproto recordproto renderproto resourceproto scrnsaverproto videoproto xcmiscproto xextproto xf86bigfontproto xf86dgaproto xf86driproto xf86vidmodeproto xineramaproto xproto xwaylandproto eglexternalplatform wayland-eglstream-protocols dracut emacs wayland-protocols systemd udev gnome-keybindings

```

I then ran this directly on a command line and it prints a single version

```haskell
0.58.0-dev 

```

The command line seems to “hope” that this single invocation of `pkg-config` would yield all the versions of this multitude of packages but it clearly doesn’t.

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [March 16, 2024, 1:25pm UTC](https://discourse.haskell.org/t/toy-gui-project/9047/10 "2024-03-16T13:25:58Z")

</div>

What happens if shorter argument lists are given? For example:

1. `...pkg-config --modversion libfolly fmt rocksdb`

2. `...pkg-config --modversion libfolly fmt`

3. `...pkg-config --modversion libfolly`

4. `...pkg-config --modversion`

---

<div class="post-metadata">

**Author:** ![bearhug](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bearhug](https://discourse.haskell.org/u/bearhug)\
**Post date:** [March 16, 2024, 1:29pm UTC](https://discourse.haskell.org/t/toy-gui-project/9047/11 "2024-03-16T13:29:31Z")

</div>

```bash
pkg-config --modversion libfolly fmt
0.58.0-dev
pkg-config --modversion libfolly 
0.58.0-dev
pkg-config --modversion fmt
9.1.0
pkg-config --modversion 
Please specify at least one package name on the command line.

```

---

<div class="post-metadata">

**Author:** ![atravers](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@atravers](https://discourse.haskell.org/u/atravers)\
**Post date:** [March 16, 2024, 1:39pm UTC](https://discourse.haskell.org/t/toy-gui-project/9047/12 "2024-03-16T13:39:14Z")

</div>

So `pkg-config --modversion` alone only provides the current version of the first given package argument and ignores the rest - that suggests an extra command-line option is needed to tell `pkg-config` to do that for all the remaining arguments. To find out what other options your version of `pkg-config` supports, you can try either `--help` or `-?` (or something similar).

---

<div class="post-metadata">

**Author:** ![bearhug](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bearhug](https://discourse.haskell.org/u/bearhug)\
**Post date:** [March 16, 2024, 3:10pm UTC](https://discourse.haskell.org/t/toy-gui-project/9047/13 "2024-03-16T15:10:08Z")

</div>

I’ve compiled the HEAD of the Cabal repo and I can compile my toy program with that (unreleased) version. I suspect that [this commit](https://github.com/haskell/cabal/commit/3afd3a3920b999f795ec73e6c9a9740b1eff132b) fixed the issue.
