[Gtk-sharp-list] Cannot compile Gtk# 2.8.5 source

Orton, Steven J (IS) steve.orton at ngc.com
Wed Jun 26 13:57:49 UTC 2013


Hello listers,



This is my first post here.  I'll explain my situation, while trying not to forget any important details.  Then I'll pose my question.



I am on a project that has many GUIs running on Linux boxes written in Motif.  We are switching everything to Windows and C#.  The look and feel of the GUIs must remain the same.  My task is to find a way to recreate these GUIs in C# with a Motif look and feel.  This led me to GTK#.



Here are the following requirements for our development environment.



Visual Studio 2008

64bit

C#



I had good success with the latest version running in VS 2010, 32-bit, but our requirements led me to download v2.8.5 and try to compile.  I'm compiling in the current version of Cygwin and the 64-bit version of GTK+ v2.16.  I opened a "VS2008 x64 Cross Tools" command window to do the compile in.  I currently have to alter the makefiles in the source to run the 64-bit toolchain and also cut out the pkg-config calls as they are not working for me for some reason.



I've been successful in creating the objects until I get to the gtk folder.  I basically am getting linker errors with trying to find many methods starting with "_gtk".  I also tried compiling against v2.22 of GTK+ 64-bit with similar results.  I looked at the required libraries and found the method signatures in gtk-win32-2.0, but without the leading underscore.  So, for example, the linker complains about not finding "_gtk_tree_model_get_type", but the library has "gtk_tree_model_get_type" (no leading underscore).  This confuses me greatly as I cannot find any instances of methods in GTK with leading underscores except ones with a prepended "__impl_gtk_".



Here is my output from the linker:



--------------------------------------------------------------------------------------------

make[2]: Entering directory `/cygdrive/c/dev/GtkSharp/2.8.5/gtk/glue'
i686-w64-mingw32-gcc -mno-cygwin -mms-bitfields -c  -I./ -I/cygdrive/c/dev/Gtk+2
.22/include/gtk-2.0 -I/cygdrive/c/dev/Gtk+2.22/include/glib-2.0 -I/cygdrive/c/de
v/Gtk+2.22/lib/glib-2.0/include  -I/cygdrive/c/dev/Gtk+2.22/include/pango-1.0 -I
/cygdrive/c/dev/Gtk+2.22/lib/gtk-2.0/include -I/cygdrive/c/dev/Gtk+2.22/include/
cairo  -I/cygdrive/c/dev/Gtk+2.22/include/atk-1.0 -I/cygdrive/c/dev/Gtk+2.22/inc
lude/gdk-pixbuf-2.0 -I/cygdrive/c/dev/Gtksharp/include -o generated.o generated.
c
i686-w64-mingw32-dllwrap -mno-cygwin -mms-bitfields --target i386-mingw32 --expo
rt-all-symbols --output-lib=libgtksharpglue-2.a --dllname=gtksharpglue-2.dll --d
river-name=i686-w64-mingw32-gcc --output-def=gtksharpglue-2.def adjustment.o
         cellrenderer.o           clipboard.o              colorseldialog.o
    container.o              generated.o              nodestore.o              o
bject.o                 selectiondata.o          style.o                  target
list.o           widget.o                 win32dll.o -L/cygdrive/c/cygwin/lib -L
/cygdrive/c/dev/Gtk+2.22/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0
 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo
-lpixman-1 -lfontconfig  -lexpat -lfreetype -lpng14 -lz -lgobject-2.0 -lgmodule-
2.0 -lgthread-2.0 -lglib-2.0 -lintl -lglade-2.0
i686-w64-mingw32-dllwrap: no export definition file provided.
Creating one, but that may not be what you want
nodestore.o:nodestore.c:(.text+0x43e): undefined reference to `_gtk_tree_model_g
et_type'
object.o:object.c:(.text+0x42): undefined reference to `_gtk_object_get_type'
object.o:object.c:(.text+0x69): undefined reference to `_gtk_object_sink'
targetlist.o:targetlist.c:(.text+0x4f): undefined reference to `_gdk_atom_name'
widget.o:widget.c:(.text+0x50): undefined reference to `_gtk_widget_get_type'
widget.o:widget.c:(.text+0x73): undefined reference to `_gtk_object_get_type'
widget.o:widget.c:(.text+0x92): undefined reference to `_gtk_object_get_type'
widget.o:widget.c:(.text+0xd0): undefined reference to `_gtk_widget_style_get'
widget.o:widget.c:(.text+0x182): undefined reference to `_gtk_adjustment_get_typ
e'
widget.o:widget.c:(.text+0x189): undefined reference to `_gtk_adjustment_get_typ
e'
widget.o:widget.c:(.text+0x2d0): undefined reference to `_gtk_binding_set_by_cla
ss'
widget.o:widget.c:(.text+0x30a): undefined reference to `_gtk_binding_entry_add_
signal'
widget.o:widget.c:(.text+0x326): undefined reference to `_gtk_widget_class_find_
style_property'
widget.o:widget.c:(.text+0x357): undefined reference to `_gtk_widget_style_get_p
roperty'
collect2: ld returned 1 exit status
i686-w64-mingw32-dllwrap: i686-w64-mingw32-gcc exited with status 1
makefile.win32:35: recipe for target `gtksharpglue-2.dll' failed
make[2]: *** [gtksharpglue-2.dll] Error 1
make[2]: Leaving directory `/cygdrive/c/dev/GtkSharp/2.8.5/gtk/glue'
makefile.win32:8: recipe for target `windows' failed
make[1]: *** [windows] Error 2
make[1]: Leaving directory `/cygdrive/c/dev/GtkSharp/2.8.5/gtk'
makefile.win32:23: recipe for target `windows' failed
make: *** [windows] Error 1

--------------------------------------------------------------------------------------------------



Here is my makefile for the gtk glue directory:



--------------------------------------------------------------------------------------------------

GTK_CFLAGS=-I./ -I/cygdrive/c/dev/Gtk+2.22/include/gtk-2.0 -I/cygdrive/c/dev/Gtk+2.22/include/glib-2.0 -I/cygdrive/c/dev/Gtk+2.22/lib/glib-2.0/include \
-I/cygdrive/c/dev/Gtk+2.22/include/pango-1.0 -I/cygdrive/c/dev/Gtk+2.22/lib/gtk-2.0/include -I/cygdrive/c/dev/Gtk+2.22/include/cairo \
-I/cygdrive/c/dev/Gtk+2.22/include/atk-1.0 -I/cygdrive/c/dev/Gtk+2.22/include/gdk-pixbuf-2.0 -I/cygdrive/c/dev/Gtksharp/include

GTK_LIBS=-lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lpixman-1 -lfontconfig \
-lexpat -lfreetype -lpng14 -lz -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -lglade-2.0

GTK_LIB_PATHS= -L/cygdrive/c/cygwin/lib -L/cygdrive/c/dev/Gtk+2.22/lib
CC=i686-w64-mingw32-gcc -mno-cygwin -mms-bitfields

DLLWRAP=i686-w64-mingw32-dllwrap -mno-cygwin -mms-bitfields --target i386-mingw32 --export-all-symbols

GLUE_OBJS = \
        adjustment.o            \
        cellrenderer.o          \
        clipboard.o             \
        colorseldialog.o        \
        container.o             \
 generated.o             \
        nodestore.o             \
        object.o                \
        selectiondata.o         \
        style.o                 \
 targetlist.o  \
        widget.o                \
 win32dll.o

all: gtksharpglue-2.dll

%.o: %.c
 $(CC) -c $(CFLAGS) $(GTK_CFLAGS) -o $@ $^

gtksharpglue-2.dll: $(GLUE_OBJS)
 $(DLLWRAP) --output-lib=libgtksharpglue-2.a --dllname=gtksharpglue-2.dll --driver-name=i686-w64-mingw32-gcc --output-def=gtksharpglue-2.def $(GLUE_OBJS) $(GTK_LIB_PATHS) $(GTK_LIBS)

clean:
 rm -f gtksharpglue-2.dll *.o libgtksharpglue-2.a

-----------------------------------------------------------------------------------------



Notice the CC and DLLWRAP are using 64-bit versions.  I must mention that I tried compiling this in MinGW and didn't even get as far as I have now.



Any help on this problem will be greatly appreciated.





Steven Orton


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20130626/30ed84b1/attachment.html>


More information about the Gtk-sharp-list mailing list