Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2003-08

Gnome gtk freepascal bindings.

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pascal Pype

Hello ,

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. Within free pascal gtk-gnome is highly supported , so gtk-gnome will serve as toolkit for porting the gui part of the application. On slackware linux there were no problems about using the gtk-gnome freeBSD however there are several problems about using the gtk toolkit via the free pascal bindings to gtk.

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:

/usr/local/lib/libgmodule.a -> /usr/local/lib/libgmodule12.a /usr/local/lib/libglib.a -> /usr/local/lib/libglib12.a /usr/X11R6/lib/libgdk.a -> /usr/X11R6/lib/libgdk12.a /usr/X11R6/lib/libgtk.a -> /usr/X11R6/lib/libgtk12.a

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':
gtkcolorsel.o(.text+0x738): undefined reference to `libintl_dgettext' /usr/X11R6/lib//libgtk.a(gtkcolorsel.o): In function `gtk_color_selection_dialog_init':
gtkcolorsel.o(.text+0x3687): undefined reference to `libintl_dgettext' gtkcolorsel.o(.text+0x3703): undefined reference to `libintl_dgettext' gtkcolorsel.o(.text+0x3771): undefined reference to `libintl_dgettext' /usr/X11R6/lib//libgtk.a(gtkfilesel.o): In function `gtk_file_selection_init':
gtkfilesel.o(.text+0x19f): undefined reference to `libintl_dgettext' /usr/X11R6/lib//libgtk.a(gtkfilesel.o)(.text+0x298): more undefined references to `libintl_dgettext' follow
/usr/X11R6/lib//libgtk.a(gtkmain.o): In function `gtk_init_check': gtkmain.o(.text+0x4b5): undefined reference to `libintl_bindtextdomain' /usr/X11R6/lib//libgtk.a(gtknotebook.o): In function `gtk_notebook_update_labels':
gtknotebook.o(.text+0x3914): undefined reference to `libintl_dgettext' /usr/X11R6/lib//libgtk.a(gtknotebook.o): In function `gtk_notebook_set_tab_label':
gtknotebook.o(.text+0x7672): undefined reference to `libintl_dgettext' /usr/X11R6/lib//libgtk.a(gtkrc.o): In function `gtk_rc_find_pixmap_in_path': gtkrc.o(.text+0x235e): undefined reference to `libintl_dgettext' gtkrc.o(.text+0x2383): undefined reference to `libintl_dgettext' /usr/X11R6/lib//libgtk.a(gtkthemes.o): In function `gtk_theme_engine_get': gtkthemes.o(.text+0x86): undefined reference to `libintl_dgettext' /usr/X11R6/lib//libgtk.a(gtktipsquery.o)(.text+0x1db): more undefined references to `libintl_dgettext' follow
coll.pas(19) Error: Error while linking
Closing script ppas.sh

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

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

Gdk-CRITICAL **: file gdkwindow.c: line 1406 (gdk_window_get_visual): assertion `window != NULL' failed.

Gtk-CRITICAL **: file gtkwidget.c: line 4258 (gtk_widget_push_visual): assertion `visual != NULL' failed.

Gtk-CRITICAL **: file gtkwidget.c: line 4242 (gtk_widget_push_colormap): assertion `cmap != NULL' failed.

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 40

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button4.png" line 58

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button1.png" line 67

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button_def.png" line 89

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button1.png" line 99

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button2.png" line 109

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button4.png" line 119

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button6.png" line 129

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 139

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button4.png" line 149

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button3.png" line 159

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button8.png" line 186

Gtk-WARNING **: Unable to locate image file in pixmap_path: "extension_top1.png" line 194

Gtk-WARNING **: Unable to locate image file in pixmap_path: "extension_bottom1.png" line 203

Gtk-WARNING **: Unable to locate image file in pixmap_path: "extension_left1.png" line 212

Gtk-WARNING **: Unable to locate image file in pixmap_path: "extension_right1.png" line 221

Gtk-WARNING **: Unable to locate image file in pixmap_path: "notebook1.png" line 233

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_top.png" line 236

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_top_start.png" line 238

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_top_end.png" line 240

Gtk-WARNING **: Unable to locate image file in pixmap_path: "notebook1.png" line 248

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_bottom.png" line 251

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_bottom_start.png" line 253

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_bottom_end.png" line 255

Gtk-WARNING **: Unable to locate image file in pixmap_path: "notebook1.png" line 263

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_left.png" line 266

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_left_start.png" line 268

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_left_end.png" line 270

Gtk-WARNING **: Unable to locate image file in pixmap_path: "notebook1.png" line 278

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_right.png" line 281

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_right_start.png" line 283

Gtk-WARNING **: Unable to locate image file in pixmap_path: "gap_right_end.png" line 285

Gtk-WARNING **: Unable to locate image file in pixmap_path: "notebook1.png" line 296

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 313

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button7.png" line 329

Gtk-WARNING **: Unable to locate image file in pixmap_path: "menubar.png" line 345

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button2.png" line 362

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button1.png" line 370

Gtk-WARNING **: Unable to locate image file in pixmap_path: "progressbar.png" line 388

Gtk-WARNING **: Unable to locate image file in pixmap_path: "ruler_vert.png" line 405

Gtk-WARNING **: Unable to locate image file in pixmap_path: "ruler_horiz.png" line 414

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 431

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button2.png" line 439

Gtk-WARNING **: Unable to locate image file in pixmap_path: "brown_bg1.png" line 456

Gtk-WARNING **: Unable to locate image file in pixmap_path: "curve_bg1.png" line 472

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_horiz1.png" line 503

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_thumb2.png" line 506

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_horiz1.png" line 517

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_thumb.png" line 520

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_vert1.png" line 531

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_thumb2.png" line 534

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_vert1.png" line 544

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_thumb.png" line 547

Gtk-WARNING **: Unable to locate image file in pixmap_path: "trough.png" line 560

Gtk-WARNING **: Unable to locate image file in pixmap_path: "ruler_horiz.png" line 572

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 584

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 596

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 609

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button2.png" line 618

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 628

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button2.png" line 637

Gtk-WARNING **: Unable to locate image file in pixmap_path: "brown_bg2.png" line 646

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_up1.png" line 657

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_up2.png" line 666

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_up3.png" line 675

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_down1.png" line 685

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_down2.png" line 694

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_down3.png" line 703

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_left1.png" line 713

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_left2.png" line 722

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_left3.png" line 731

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_right1.png" line 741

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_right2.png" line 750

Gtk-WARNING **: Unable to locate image file in pixmap_path: "arrow_right3.png" line 759

Gtk-WARNING **: Unable to locate image file in pixmap_path: "hline.png" line 770

Gtk-WARNING **: Unable to locate image file in pixmap_path: "vline.png" line 778

Gtk-WARNING **: Unable to locate image file in pixmap_path: "check1.png" line 790

Gtk-WARNING **: Unable to locate image file in pixmap_path: "check2.png" line 798

Gtk-WARNING **: Unable to locate image file in pixmap_path: "option1.png" line 809

Gtk-WARNING **: Unable to locate image file in pixmap_path: "option2.png" line 818

Gtk-WARNING **: Unable to locate image file in pixmap_path: "option_menu.png" line 829

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_horiz1.png" line 839

Gtk-WARNING **: Unable to locate image file in pixmap_path: "scrollbar_vert1.png" line 848

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button5.png" line 860

Gtk-WARNING **: Unable to locate image file in pixmap_path: "handle_vert_thumb.png" line 863

Gtk-WARNING **: Unable to locate image file in pixmap_path: "entry2.png" line 877

Gtk-WARNING **: Unable to locate image file in pixmap_path: "entry1.png" line 885

Gtk-WARNING **: Unable to locate image file in pixmap_path: "focus.png" line 895

Gtk-WARNING **: Unable to locate image file in pixmap_path: "shadow2.png" line 907

Gtk-WARNING **: Unable to locate image file in pixmap_path: "shadow1.png" line 916

Gtk-WARNING **: Unable to locate image file in pixmap_path: "frame1.png" line 925

Gtk-WARNING **: Unable to locate image file in pixmap_path: "frame2.png" line 934

Gtk-WARNING **: Unable to locate image file in pixmap_path: "frame_gap.png" line 945

Gtk-WARNING **: Unable to locate image file in pixmap_path: "frame_gap_top_start.png" line 948

Gtk-WARNING **: Unable to locate image file in pixmap_path: "frame_gap_top_end.png" line 950

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button9.png" line 962

Gtk-WARNING **: Unable to locate image file in pixmap_path: "button7.png" line 970

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" !

If there is no easy solution to that probem , can someone please tell me how to invoke that single app in such a way that none of the gtk resource files are taken into account ? So I can continue to use that app in combination with the pixmap theme that I simply find amazingly beautiful.

My kind regards , Pype Pascal.

Reply by email

Marco van de Voort
to Pascal Pype

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

Show quoted text 7 lines
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)

Show quoted text 5 lines
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)

Show quoted text 6 lines
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.

Show quoted text 9 lines
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.

Reply by email