Re: [gtk-list] Re: gtk+ on non-linux UNIX



On Thu, 27 Aug 1998 11:32:41 -0400, gtk-list@redhat.com (Owen Taylor) wrote:
> 
> Erik Mouw <J.A.K.Mouw@its.tudelft.nl> writes:
>> My experience with GTK+ is that as long as you use gcc, you won't have
>> many problems porting it. I had no problems porting it to SGI IRIX 6.3
>> when I used gcc 2.8.1, but with SGI MipsPRO cc there were some problems.
> 
> But GTK+ is also supposed to be free of any GCC'isms (and has been
> compiled successfully with SGI cc on occasion), so if you have such
> problems, please report them!

I was not completely right, the last time I tried to compile GTK+ on IRIX
with SGI cc was with GTK+ 0.99.old. Because of my bad experiences I didn't
even try to compile GTK+ 1.0.5 with SGI cc and just used GCC 2.8.1.



There is however a problem with the Makefiles in the examples directory.
GCC 2.8.1 on IRIX 6.x uses the IRIX linker (GNU ld is not yet ported to
IRIX 6.x with n32 ABI). IRIX ld must have the libraries _after_ the object
files on the command line, or otherwise it will not find the right
symbols. For example:

  % cd gtk+-1.0.5/examples/helloworld
  % gmake
  gcc `gtk-config --cflags` `gtk-config --libs` helloworld.c -o helloworld
  ld: WARNING 84: /shannon/erik/FASE/gnu-n32/lib/libgtk.so is not used for resolving any symbol.
  ld: ERROR 33: Unresolved text symbol "g_print" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_main_quit" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_init" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_window_new" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_object_check_cast" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_signal_connect" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_container_get_type" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_container_border_width" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_button_new_with_label" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_widget_destroy" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_signal_connect_object" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_container_add" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_widget_show" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: ERROR 33: Unresolved text symbol "gtk_main" -- 1st referenced by /var/tmp/cca001Qx1.o.
  ld: INFO 60: Output file removed because of error.
  gmake: *** [helloworld] Error 1
  %

The rule for "helloworld" is:

  helloworld: helloworld.c
          $(CC) `gtk-config --cflags` `gtk-config --libs` helloworld.c -o helloworld

If I move the library flags after the object files, like this:

  helloworld: helloworld.c
        $(CC) `gtk-config --cflags` helloworld.c -o helloworld `gtk-config --libs`

It compiles without errors.

  % gmake
  gcc `gtk-config --cflags` helloworld.c -o helloworld `gtk-config --libs`
  % 


As SGI cc uses the same linker, it also needs the linker flags after the
object files:

  % cc -n32 `gtk-config --cflags` `gtk-config --libs` helloworld.c -o helloworld
  "/shannon/erik/FASE/gnu-n32/include/gtk/gtklabel.h", line 47:
  warning(1107): 
            signed bit field of length 1
      gint  needs_clear : 1;
            ^

  "/shannon/erik/FASE/gnu-n32/include/gtk/gtkclist.h", line 182:
  warning(1107): 
            signed bit field of length 1
      gint width_set : 1;
           ^

  "/shannon/erik/FASE/gnu-n32/include/gtk/gtkclist.h", line 196:
  warning(1107): 
            signed bit field of length 1
      gint fg_set : 1;
           ^

  "/shannon/erik/FASE/gnu-n32/include/gtk/gtkclist.h", line 197:
  warning(1107): 
            signed bit field of length 1
      gint bg_set : 1;
           ^

  "/shannon/erik/FASE/gnu-n32/include/gtk/gtkscrolledwindow.h", line 52:
  warning(1107): 
            signed bit field of length 1
      gint hscrollbar_visible : 1;
           ^

  "/shannon/erik/FASE/gnu-n32/include/gtk/gtkscrolledwindow.h", line 53:
  warning(1107): 
            signed bit field of length 1
      gint vscrollbar_visible : 1;
           ^

  ld32: WARNING 84: /shannon/erik/FASE/gnu-n32/lib/libgtk.so is not used for resolving any symbol.
  ld32: ERROR 33: Unresolved text symbol "g_print" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_main_quit" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_init" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_window_new" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_object_check_cast" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_signal_connect" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_container_get_type" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_container_border_width" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_button_new_with_label" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_signal_connect_object" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_container_add" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_widget_show" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_main" -- 1st referenced by helloworld.o.
  ld32: ERROR 33: Unresolved text symbol "gtk_widget_destroy" -- 1st referenced by helloworld.o.
  ld32: INFO 60: Output file removed because of error.
  %

Again, if I change the command line layout, the program links without
problems. What's left are some compiler warnings which are more or less
correct.


I think you should change the Makefiles because this is just the way
linkers work: they find some undefined symbols in the object files and try
to resolve them with symbols in other object files or in the libraries. As
the linker doesn't know in advance which symbols it needs, it has to parse
the libraries after the object files, which is achieved by putting the
libaries after the object files on the command line.


IIRC, the Makefiles for the GIMP plugins  have the same bug. The last time
I compiled GIMP on IRIX 6.3 was with GIMP 0.99.16, so things could have
changed.



Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]