XBoard (GtkBoard?) pre-alpha

Discussion of chess software programming and technical issues.

Moderator: Ras

JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard (GtkBoard?) pre-alpha

Post by JoshPettus »

well that got rid of that first error nicely :) but the rest is still the same.

Code: Select all

Joshuas-MacBook-Pro:xboard-83f3a4e herecomethej$ gdb ./xboard
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug  5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ................ done

(gdb) run -debug
Starting program: /Users/herecomethej/Downloads/xboard-83f3a4e/xboard -debug
Reading symbols for shared libraries +++++++++++++++...................................................................................................................................................................... done
Assertion failed: (_cairo_status_is_error (status)), function _cairo_error, file cairo-error.c, line 68.

Program received signal SIGABRT, Aborted.
0x00007fff8f9e0d46 in __kill ()
(gdb) bt
#0  0x00007fff8f9e0d46 in __kill ()
#1  0x00007fff88b0bdf0 in abort ()
#2  0x00007fff88b0ce2a in __assert_rtn ()
#3  0x00000001009ea2ce in _cairo_error ()
#4  0x00000001009e292b in _cairo_set_error ()
#5  0x0000000100548c5a in rsvg_cairo_render_path ()
#6  0x0000000100546255 in rsvg_render_path ()
#7  0x000000010053dff0 in rsvg_node_draw ()
#8  0x000000010053e08a in _rsvg_node_draw_children ()
#9  0x000000010053dff0 in rsvg_node_draw ()
#10 0x000000010053e78d in rsvg_node_svg_draw ()
#11 0x000000010053dff0 in rsvg_node_draw ()
#12 0x000000010054a448 in rsvg_handle_render_cairo_sub ()
#13 0x0000000100078423 in LoadSVG ()
#14 0x000000010007891d in ScaleOnePiece ()
#15 0x00000001000790f2 in CreatePNGPieces ()
#16 0x000000010007915d in CreateAnyPieces ()
#17 0x0000000100071ddb in main ()
(gdb) 
User avatar
hgm
Posts: 28451
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard (GtkBoard?) pre-alpha

Post by hgm »

Hmm, it crashes in rsvg_handle_render_cairo this time. Can you try it with the following printfs added?

Code: Select all

LoadSVG (char *dir, int color, int piece)
{
    char buf[MSG_SIZ];
  RsvgHandle *svg=svgPieces[color][piece];
  RsvgDimensionData svg_dimensions;
  GError *svgerror=NULL;
  cairo_surface_t *img;
  cairo_t *cr;

    snprintf(buf, MSG_SIZ, "%s/%s%s.svg", dir, color ? "Black" : "White", pngPieceNames[piece]);

    if(svg || *dir && (svg = rsvg_handle_new_from_file(buf, &svgerror))) {
if(svgerror) fprintf(debugFP, "rsvg: %s\n", svgerror->message);
      rsvg_handle_get_dimensions(svg, &svg_dimensions);
fprintf(debugFP, "dimensions %dx%d\n",  svg_dimensions.width,  svg_dimensions.height);
      img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, squareSize,  squareSize);

      cr = cairo_create(img);
      cairo_scale(cr, squareSize/(double) svg_dimensions.width, squareSize/(double) svg_dimensions.height);
      rsvg_handle_render_cairo(svg, cr);
      if(cairo_surface_status(img) == CAIRO_STATUS_SUCCESS) {
        if(pngPieceImages[color][piece]) cairo_surface_destroy(pngPieceImages[color][piece]);
        pngPieceImages[color][piece] = img;
      }
else fprintf(debugFP, "could not render svg for %s (%dx%d)\n", buf, svg_dimensions.width, svg_dimensions.height);
      cairo_destroy(cr);

      return svg;
    }
    if(svgerror)
fprintf(debugFP, "errorloading svg %s: %s\n", buf, svgerror->message);
        g_error_free(svgerror);
    return NULL;
}
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard (GtkBoard?) pre-alpha

Post by JoshPettus »

Sorry for the wait. Yah hopefully I'm starting from a clean slate now, so now any issues will to start make sense. Again, hopefully :roll:

I get this in debug

Code: Select all

recognized 'normal' (-1) as variant normal
recognized 'normal' (-1) as variant normal
recognized 'normal' (-1) as variant normal
shuffleOpenings = 0
Requested font set for list -*-helvetica-medium-r-normal--14-*-*-*-*-*-*-*,-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*,-*-*-*-*-*-*-14-*-*-*-*-*-*-*
 got list -*-helvetica-medium-r-normal--14-*-*-*-*-*-*-*,-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*,-*-*-*-*-*-*-14-*-*-*-*-*-*-*, locale en_US.UTF-8
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-1
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-1
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-2
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-3
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-4
 got charset -misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-5
 got charset -misc-fixed-medium-r-normal--14-130-75-75-c-70-koi8-r
 got charset -misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-7
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-9
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-13
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-14
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso8859-15
 got charset -misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0
 got charset -daewoo-gothic-medium-r-normal--14-101-100-100-c-0-ksc5601.1987-0
 got charset -isas-fangsong ti-medium-r-normal--14-101-100-100-c-0-gb2312.1980-0
 got charset -misc-fixed-medium-r-normal--14-130-75-75-c-70-jisx0201.1976-0
 got charset -adobe-helvetica-medium-r-normal--14-140-75-75-p-77-iso10646-1
Requested font set for list -*-helvetica-bold-r-normal--34-*-*-*-*-*-*-*,-misc-fixed-bold-r-normal--34-*-*-*-*-*-*-*,-*-*-*-*-*-*-34-*-*-*-*-*-*-*
 got list -*-helvetica-bold-r-normal--34-*-*-*-*-*-*-*,-misc-fixed-bold-r-normal--34-*-*-*-*-*-*-*,-*-*-*-*-*-*-34-*-*-*-*-*-*-*, locale en_US.UTF-8
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-1
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-1
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-2
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-3
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-4
 got charset -misc-fixed-bold-r-normal--34-246-100-100-c-0-iso8859-5
 got charset -misc-fixed-medium-r-normal--34-246-100-100-c-0-koi8-r
 got charset -misc-fixed-bold-r-normal--34-246-100-100-c-0-iso8859-7
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-9
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-13
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-14
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso8859-15
 got charset -jis-fixed-medium-r-normal--34-246-100-100-c-0-jisx0208.1983-0
 got charset -daewoo-gothic-medium-r-normal--34-246-100-100-c-0-ksc5601.1987-0
 got charset -isas-fangsong ti-medium-r-normal--34-246-100-100-c-0-gb2312.1980-0
 got charset -misc-fixed-medium-r-normal--34-246-100-100-c-0-jisx0201.1976-0
 got charset -adobe-helvetica-bold-r-normal--34-240-100-100-p-182-iso10646-1
Requested font set for list -*-helvetica-bold-r-normal--14-*-*-*-*-*-*-*,-misc-fixed-bold-r-normal--14-*-*-*-*-*-*-*,-*-*-*-*-*-*-14-*-*-*-*-*-*-*
 got list -*-helvetica-bold-r-normal--14-*-*-*-*-*-*-*,-misc-fixed-bold-r-normal--14-*-*-*-*-*-*-*,-*-*-*-*-*-*-14-*-*-*-*-*-*-*, locale en_US.UTF-8
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-2
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-3
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-4
 got charset -misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-5
 got charset -misc-fixed-medium-r-normal--14-130-75-75-c-70-koi8-r
 got charset -misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-7
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-9
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-13
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-14
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-15
 got charset -misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0
 got charset -daewoo-gothic-medium-r-normal--14-101-100-100-c-0-ksc5601.1987-0
 got charset -isas-fangsong ti-medium-r-normal--14-101-100-100-c-0-gb2312.1980-0
 got charset -misc-fixed-medium-r-normal--14-130-75-75-c-70-jisx0201.1976-0
 got charset -adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso10646-1
fallback
dimensions 100x100
User avatar
hgm
Posts: 28451
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard (GtkBoard?) pre-alpha

Post by hgm »

Well, assuming that it still crashes inside rsvg_handle_render_cairo, as the previous gdb stack trace suggested, and that the rsvg_handle_get_dimensions still reported proper dimensions (the svg piece images are indeed 100x100), I would say this is a clear bug in the svg library. Because it seems that we make a perfectly normal rendering request, (no funny scaling, because of division by 0 or something like that) on a valid cairo surface.

To make absolutely sure nothing funny is going on we should perhaps print squareSize as well (it could be corrupted elsewhere in the code); change the printf statement to:

Code: Select all

fprintf(debugFP, "dimensions %dx%d sq=%d\n",  svg_dimensions.width,  svg_dimensions.height, squareSize);
Perhaps we could also verify that the creation of the bitmap worked, by adding a printf below it:

Code: Select all

    img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, squareSize,  squareSize);
if(cairo_surface_status(img) != CAIRO_STATUS_SUCCESS) fprintf(debugFP, "bad bitmap (%d)\n", cairo_surface_status(img));
But if those do not pointto any abnormality, there must be something wrong in the rsvg lib. It is already a slight anomaly that gdb says we call rsvg_handle_render_cairo_sub from LoadSVG.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard (GtkBoard?) pre-alpha

Post by JoshPettus »

all that came out in debug was

"dimensions 100x100 sq=87" which seems normal. I'm going to agree, I didn't get this issue with the fink install so i guess the answer is to clean the slate again and go back to that. At least now I know what's in my /usr/local folder XD.

Thank-you for your help. I'll let you know if/when I'm successful.
User avatar
hgm
Posts: 28451
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard (GtkBoard?) pre-alpha

Post by hgm »

I cleaned up the code history a bit in the repository, adapting the old X11 front-end at any stage such that at any stage it can be built without error. Arun provided a dual-build Makefile, so the same source tar ball can be used to build both GTK and X11 version.

The trick is to specify with ./configure what you want:

./configure --with-gtk

or

./configure --with-Xaw

(the latter is the default) After that a simple "make" will build the specified version. You might have to remove all .o files if you build one after the other.

I pushed this to the gtk2 branch in the hgm.nubati repository. The X11 build from this should be equivalent yo the most-recent master version, using the cairo graphics. Some of the dialogs are reformatted however, because they became too tall in the GTK version.

The GTK version is still alpha, although I made some more things work (sizing and window positioning), and fixed a nasty bug which caused it to hang in analysis.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard (GtkBoard?) pre-alpha

Post by JoshPettus »

the Xaw version compiles just fine on ma, but I'm having issues compiling the gtk version. Hopefully its nothing big.

Code: Select all

...
  CC     gtk/xengineoutput.o
  CCLD   xboard
Undefined symbols for architecture x86_64:
  "_gtk_dialog_get_widget_for_response", referenced from:
      _GenericPopUp in xoptions.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [xboard] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


This is with the version in the master branch as Arun fixed some issues with the GTK needing x11 stuff which gave me issues before.

On a very minor separate issue (I just don't know where to put it). I noticed that on the Xaw version, on FICS, with the auto update of games on the seekgraph, dots are no longer disappearing when the game is removed. I have no idea about ICC. Did FICS change the command you were using?
User avatar
hgm
Posts: 28451
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard (GtkBoard?) pre-alpha

Post by hgm »

I think this is a problem with the GTK version. We will look into how we can avoid using GTK calls that are only available in later versions.

I will check out the seek-graph stuff. It could be an ´expose´ problem. (i.e. the drawing is updated, but the update is not copied automatically to the display.) Can you chack if the points that ought to have disappeared do indeed disappear whan you cover then with another window, and then expose them again?
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard (GtkBoard?) pre-alpha

Post by JoshPettus »

They don't I'm afraid. The only way they clear is if I go back to the normal board and again switch to seekgraph.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard (GtkBoard?) pre-alpha

Post by JoshPettus »

Hi Harm,

I know you are busy with other things atm, and the gtk stuff has still a long way to go. But should you ever get a chance, I tried compiling the gtk version of xboard in OSX again with your latest source code. Now i get

Code: Select all

  CC     gtk/xboard.o
gtk/xboard.c:202: error: conflicting types for ‘ICSInitScript’
./frontend.h:188: error: previous declaration of ‘ICSInitScript’ was here
gtk/xboard.c: In function ‘FindFont’:
gtk/xboard.c:1246: warning: unused variable ‘pxlSize’
gtk/xboard.c:1246: warning: unused variable ‘err’
gtk/xboard.c:1246: warning: unused variable ‘minerr’
gtk/xboard.c:1246: warning: unused variable ‘nfonts’
gtk/xboard.c:1246: warning: unused variable ‘j’
gtk/xboard.c:1246: warning: unused variable ‘i’
gtk/xboard.c:1245: warning: unused variable ‘scalableTail’
gtk/xboard.c:1245: warning: unused variable ‘scalable’
gtk/xboard.c:1245: warning: unused variable ‘best’
gtk/xboard.c:1245: warning: unused variable ‘fonts’
make[2]: *** [gtk/xboard.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
once it reaches the xboard.o part of the make process. At least its different from before. Progress! :)

Thank-you!