Search code examples
haskellgtkcabal-install

Installing gtk2hs failure


I followed the instructions to install gtk library on Windows 8.1 x64 using http://wiki.haskell.org/Gtk2Hs/Installation.

I've installed MSYS2 and used it to download and build gtk. Then I've run:

cabal update // ok

cabal install gtk2hs-buildtools // ok

cabal install gtk // failed, 

cabal logs:

  • glib.log

    Building glib-0.13.2.2...
    Preprocessing library glib-0.13.2.2...
    dist\build\System\Glib\StoreValue_hsc_utils.o:StoreValue_hsc_utils.c:(.text+0x0): multiple definition of `__debugbreak'
    dist\build\System\Glib\StoreValue_hsc_make.o:StoreValue_hsc_make.c:(.text+0x0): first defined here
    collect2.exe: error: ld returned 1 exit status
    linking dist\build\System\Glib\StoreValue_hsc_make.o failed (exit code 1)
    command was: C:\Program Files\Haskell Platform\7.10.3\mingw\bin\gcc.exe dist\build\System\Glib\StoreValue_hsc_make.o dist\build\System\Glib\StoreValue_hsc_utils.o -o dist\build\System\Glib\StoreValue_hsc_make.exe -LC:/msys64/mingw64/lib -lgobject-2.0 -lglib-2.0 -lintl -LC:\Users\Lexa27\AppData\Roaming\cabal\x86_64-windows-ghc-7.10.3\utf8-string-1.0.1.1-L8eKHa7Iv9q7FVKUYW6u4b -LC:\Program Files\Haskell Platform\7.10.3\lib\extralibs\text-1.2.1.3 -LC:\Program Files\Haskell Platform\7.10.3\lib\binar_3uXFWMoAGBg0xKP9MHKRwi -LC:\Program Files\Haskell Platform\7.10.3\lib\conta_2C3ZI8RgPO2LBMidXKTvIU -LC:\Program Files\Haskell Platform\7.10.3\lib\bytes_6VWy06pWzJq9evDvK2d4w6 -LC:\Program Files\Haskell Platform\7.10.3\lib\deeps_6vMKxt5sPFR0XsbRWvvq59 -LC:\Program Files\Haskell Platform\7.10.3\lib\array_67iodizgJQIIxYVTp4emlA -LC:\Program Files\Haskell Platform\7.10.3\lib\base_HQfYBxpPvuw8OunzQu6JGM -lwsock32 -luser32 -lshell32 -LC:\Program Files\Haskell Platform\7.10.3\lib\integ_2aU3IZNMF9a7mQ0OzsZ0dS -LC:\Program Files\Haskell Platform\7.10.3\lib\ghcpr_8TmvWUcS1U1IKHT0levwg3 -LC:\Program Files\Haskell Platform\7.10.3\lib/rts -lm -lwsock32 -lgdi32 -lwinmm

  • build.log https://drive.google.com/file/d/0B9t961_0P4GbMWhhMklSMDlpRkE/view?usp=sharing
  • gtk2hs-buildtools https://drive.google.com/file/d/0B9t961_0P4GbdXpGT081V0hHeFE/view?usp=sharing

Solution

  • I am suffering from the same error message for the last two days and finally got a work-around (though I am using win7 -x64).

    You need to download glib separately from https://hackage.haskell.org/package/glib. Then you need to adjust glib.cabal as described here: https://mail.haskell.org/pipermail/haskell-cafe/2015-October/121935.html (you have to remove the cpp-option: '-D__attribute__(A)=')

    Finally, switch to your glib directory and run:

    cabal install glib.cabal
    

    This should work. You may have to do the same steps with the other gtk+ dependencies.