[fpc-devel]Gnome gtk freepascal bindings.

Marco van de Voort marcov at stack.nl
Sat Aug 16 16:13:06 CEST 2003


You seem to have figured out most of it, but..

> There seem to be some problems about the usage of the free pascal
> compiler for freeBSD. An application that once was written for windows
> 3.1 in turbo pascal needs to be ported to freeBSD and linux. In order
> to be able to keep the recoding effort to a minimal level , programming
> tools were sought that are compatible to turbo pascal as much as
> possible. Free pascal was the answer to that. I choose to use free
> pascal 1.0.6.

You are aware that there is a version 1.0.10? The ports tree maintainer
is a bit slow sometimes. At least for Lazarus development 1.0.10 is
required (a gtk based RAD, lazarus.freepascal.org)

> I use gnome 1-2a on my freeBSD machine and my slackware machine runs
> gnome 1.4 upon slackware version 8.0. The version of freeBSD I use is
> 4.8. The first problem arose when free pascal tried to link the
> application. It didn't find the necessary libraries. So I made the
> following symlinks:

GTK works fine. as long as you use the gtk12 port (you must see
a gtk-1.2.<something> fileentry in /var/db/pkg). In my 1.0.10 FreeBSD
explicitely links to libgtk12 ( a change that dates to 31-08-2002)

The problem is that there is some difference sometimes
between what's in libc. IIRC glibc includes gettext, while FPC doesn't.

So under Linux a {$linklib c} can use gettext functions while under FreeBSD
you can't.

The same way you can use dl_open and such on FreeBSD if you include libc,
but for Linux you need to add a {$linklib dl} (which makes it a good habit
to use unit dynlibs for this)
 
> Then those libraries were found , but the linker issued a whole bunch
> of linker errors:
> 
> Linking coll
> /usr/X11R6/lib//libgtk.a(gtkcolorsel.o): In function 
> `gtk_color_selection_init':

That's because it is a dependancy on the gtkcolorsel file that fails on the
line below. when that is fixed, this will be fixed.

> gtkcolorsel.o(.text+0x738): undefined reference to `libintl_dgettext'

All these (dgettext references) are simply fixed by adding

{$ifdef FreeBSD}
 {$linklib intl}
{$endif}

in your main program (provided that /usr/local/lib is in your FPC library
path)

> So one feels the need to add the linker option "-lintl" to resolve
> this one. And yes , all linker errors are gone afterwards!

See above for an in-source code fix.
 
> But when one tries to run the application in gnome under the pixmap
> theme one receives a true shopping-list of gtk errors and warnings :
> 
> gdk_imlib ERROR: gdk has not connected to the display

> When one changes the theme to the default theme , then suddenly whoosh
> , those pesky gtk warnings are gone ...
> And yes , those images are correctly located according to my
> "/usr/X11R6/share/themes/Pixmap/gtk/gtkrc" !

No idea. I use GTK, but not GNOME. In general, there is a lot of GTK
knowledge on the lazarus maillist. If you interested in GTK, joining
that list would certainly be a plus.
 




More information about the fpc-devel mailing list