[Haskell-cafe] Haskellers hate GUIs!!
Jürgen Nicklisch-Franken
jnf at arcor.de
Fri Apr 2 08:31:15 EDT 2010
I am in the damned position to have tried to develop a GUI app in
Haskell. I'm building on top of gtk2hs, now we have a new compiler
version a new Platform release and no gtk2hs release, so
I cite from a mail from a potential user/contributor for my GUI app.
What shall I say, how should he install gtk2hs? Is their a way to get a
stable version from a changing darcs repo?
If not all Haskellers were such GUI haters, we would have GUI libs with
the platform.
Jürgen
"
...
Each gtk2hs package (like glib-0.10.1) installed in that
non-standard
location by Ubuntu apt-get does at least have a package.conf
file, like
glib.package.conf. However, on inspection, the "id" fields are
missing,
and the "depends" fields look more like .cabal file "depends"
fields (no
ABI ID).
I tried an experiment on my glib.package.conf, used "ghc
--abi-hash" to
generate an ID, so eventually creating a new line something like
id: glib-0.10.1-d41d8cd98f00b204e9800998ecf8427e
and then set up the "depends" properly by getting the real
dependencies
using "ghc-pkg -v list".
After doing this then
ghc-pkg register glib.package.conf
worked just fine, and I see it in my global DB. It's cool that
this
works but it seems highly roundabout. :-)
Building gtk2hs from source is broken. Not sure why - I did it
OK with
ghc-6.10.3. I can run ./configure no problem with
./configure --with-hcflags=-O0 --disable-split-objs
--with-ghc=/usr/local/lib/ghc-6.12.1
and it claims that it will build:
* The following packages will be built:
*
* glib : yes
* gtk : yes
* gio : yes
* glade : yes
* cairo : yes
* svgcairo : yes
* gtkglext : no
* gconf : yes
* sourceview : no
* gtksourceview2 : yes
* mozembed : no
* soegtk : yes
* gnomevfs : no
* gstreamer : yes
* documentation : no
But "make" fails horribly...can't find any packages like "base"
that
configure had no problems finding, so I have no idea what the
problem is
there. Which is why I'd rather figure out a way to make
ghc-6.12.1
recognize the gtk2hs packages that I have in that non-standard
location.
It works but it's awkward. :-)
Each gtk2hs package (like glib-0.10.1) installed in that
non-standard
location by Ubuntu apt-get does at least have a package.conf
file, like
glib.package.conf. However, on inspection, the "id" fields are
missing,
and the "depends" fields look more like .cabal file "depends"
fields (no
ABI ID).
I tried an experiment on my glib.package.conf, used "ghc
--abi-hash" to
generate an ID, so eventually creating a new line something like
id: glib-0.10.1-d41d8cd98f00b204e9800998ecf8427e
and then set up the "depends" properly by getting the real
dependencies
using "ghc-pkg -v list".
After doing this then
ghc-pkg register glib.package.conf
worked just fine, and I see it in my global DB. It's cool that
this
works but it seems highly roundabout. :-)
I think I'll pack it in for the evening. The procedure I
described works
well in theory, but apparently if the "depends" field in the
"package
conf" files says something like foo-2.0.1.0, it's not OK to use
an
existing registered "foo" that has a higher version number...I
registered everything in gtk2hs manually but when building ltk
it
complains with
Bad interface
file: /usr/lib/haskell-packages/ghc6/lib/gtk-0.10.1/imports/Graphics/UI/Gtk.hi
mismatched interface file versions (wanted "6121", got
"")
Unfortunately when using these package configuration files one
has to
use the ABI ID - "ghc-pkg register" won't work otherwise - so
it's very
finicky.
I'll have to un-register all my gtk2hs packages, and start again
from
scratch.
Anyway, back to Ubuntu, Haskell and Leksah. :-)
I am removing vestiges of ghc-6.10.3 off my Ubuntu system as I
encounter
them, although I have no reason to believe that the presence of
directories and files for that old version are causing me any
harm. I am
keeping ghc-6.10.4 around, in parallel with ghc-6.12.1.
In any case, to the degree that I have exercised it, ghc-6.12.1
is
apparently OK. I have done some "cabal install"s on a few
executables
and libraries, both into user and global, and things seem OK as
evidenced by "ghc-pkg list".
Now, to gtk2hs and ltk and Leksah. After having initial problems
with
building gtk2hs from source, for reasons I don't want to spend
time
investigating (yet), I am returning to the apt package approach,
command-line this time instead of through the Synaptic GUI.
Running
sudo apt-get install libghc6-gtk-dev
partially returns
---------------
Selecting previously deselected package libghc6-glib-dev.
(Reading database ... 257458 files and directories currently
installed.)
Unpacking libghc6-glib-dev
(from .../libghc6-glib-dev_0.10.1-1ubuntu2_i386.deb) ...
Selecting previously deselected package libghc6-cairo-dev.
Unpacking libghc6-cairo-dev
(from .../libghc6-cairo-dev_0.10.1-1ubuntu2_i386.deb) ...
Selecting previously deselected package libghc6-gtk-dev.
Unpacking libghc6-gtk-dev
(from .../libghc6-gtk-dev_0.10.1-1ubuntu2_i386.deb) ...
Setting up libghc6-glib-dev (0.10.1-1ubuntu2) ...
Reading package info from
"/usr/lib/haskell-packages/ghc6/lib/glib-0.10.1/glib.package.conf" ...
done.
Writing new package config file... done.
Setting up libghc6-cairo-dev (0.10.1-1ubuntu2) ...
Reading package info from
"/usr/lib/haskell-packages/ghc6/lib/cairo-0.10.1/cairo.package.conf" ...
done.
Writing new package config file... done.
Setting up libghc6-gtk-dev (0.10.1-1ubuntu2) ...
Reading package info from
"/usr/lib/haskell-packages/ghc6/lib/gtk-0.10.1/gtk.package.conf" ...
done.
Writing new package config file... done.
---------------
You'll see the files I was talking about, the *.package.conf
files. I've
attached the one for cairo, so you can also see what I was
talking
about: these files are real close to the *.conf files in the
user and
global package.conf.d databases, but they are missing the "id"
field,
and the "depends" field entries are like
base-4.1.0.0
as opposed to a full
base-3.0.3.2-52acef427378232ec569bca0486ee48f
In other words, as is, "ghc-pkg register" can't use these files.
Which
is why I manually edited them.
I still see no reason why my manual approach will not work
(although
figuring out how to build from source would be even better), but
I'll
have to keep the exact versions specified in these
*.package.conf files.
Much obliged for the tip about using darcs for the gtk2hs build.
Worked
like a charm. Combined with that, and doing occasional "cabal
install"'s
along the way, I have ltk and haddock-leksah-6.12 now built.
I don't consider the 5 or 6 hours I spent on all this (which
includes
building ghc-6.12.1 from source) to be wasted; I learned a lot
more
about GHC package management.
Bit of a snag now with leksah-server (the version in
leksah-server.cabal
is 0.8.0.5). I've included the console output of the build.
Looking at that very first problem:
/home/arved/.cabal/lib/ltk-0.8/ghc-6.12.1/libHSltk-0.8.a(Parameters.o):
In function `s9Ao_info':
(.text+0x28b9): undefined reference to
`gtkzm0zi10zi1_GraphicsziUIziGtkziGeneralziEnums_zdfShowShadowType_closure'
I can sort of parse this. I see code concerning ShadowType in
ltk/Graphics.UI.Editor.Parameters.hs, and I can see that a
complaint is
being made about something related to ShadowType not being found
(I
believe) in gtk/Graphics.UI.Gtk.General.Enums.
With the
{-- #if MIN_VERSION_gtk(0,9,13)
-- now defined in gtk
#else
instance Show ShadowType
where show _ = "Any Shadow"
#endif
--}
in Parameters.hs, and seeing as how gtk is 0.10.1, I would
expect us to
be using gtk code to provide that Show instance for ShadowType,
no?
Any ideas?
...
"
More information about the Haskell-Cafe
mailing list