compiling gnucash2 on FC5-devel (gcc 4.1.0)

ag381597 at ohio.edu ag381597 at ohio.edu
Thu Jan 12 23:12:48 EST 2006


Hello all, I am new to the list (or returning, rather, since I had joined
briefly a year ago).  I am not much of a programmer these days, but hope to at
least provide some QA feedback for gnucash2.

I attempted to build gnucash from SVN on my Fedora Core 5 development desktop
last night with relative success.  However, I configured using "./configure
--enable-error-on-warning --enable-compile-warnings" as suggested, and gcc
errored out on three minor things.  I worked in quick fixes to make it compile
without warnings.  Here were the issues (I do not expect that my patches are the
final fixes, they merely worked around the warnings/errors):

1) in src/engine/gw-engine.c (which it appears may actually be generated at some
point from scheme code?), a variable was passed an an argument to a function
before being initialized, so I simply initialized it to a constant of the
appropriate type:

--- src/engine/gw-engine.c      2006-01-12 22:15:06.000000000 -0500
+++ ../gw-engine.c      2006-01-12 22:02:17.000000000 -0500
@@ -16596,6 +16596,7 @@
 if (gw__error_status != GW__ERR_NONE) goto gw__post_call_arg_8;

 {
+gw__scm_extras[0] = SCM_BOOL_F;
 gw__scm_extras[0] = gh_call1(gw__enum__gnc_query_op__val_to_int_scm_func,
gw__scm_extras[0]);
 if(SCM_FALSEP(scm_integer_p(gw__scm_extras[0]))){
    gw__error_status = GW__ERR_ARG_TYPE;


2) in src/gnome-utils/gnc-tree-view-account.c there was a "type punning"
problem, casting a GtkWidget pointer to a gpointer within a function call.  I
fixed this using a temp variable, as several people have suggested for similar
errors on other gtk-related mailing lists:

--- src/gnome-utils/gnc-tree-view-account.c     2006-01-12 22:08:07.000000000 -0500
+++ ../gnc-tree-view-account.c        2006-01-12 22:38:36.000000000 -0500
@@ -1492,6 +1492,7 @@
 {
   GtkWidget *view;
   guint32 types;
+  gpointer gptemp;

   g_return_if_fail(GTK_IS_DIALOG(dialog));

@@ -1507,8 +1508,10 @@

   /* Clean up and delete dialog */
   fd->selection_changed_cb_id = 0;
-  g_atomic_pointer_compare_and_exchange((gpointer *)&fd->dialog,
+  gptemp = (gpointer) fd->dialog;
+  g_atomic_pointer_compare_and_exchange(&gptemp,
                                        dialog, NULL);
+  fd->dialog = gptemp;
   gtk_widget_destroy(dialog);
   LEAVE("types 0x%x", types);
 }

3) in src/register/ledger-core/split-register.c , some function return values
are being typecast yet ignored.  I found that quite strange, but simply created
a variable to which the return value could be assigned:

 --- src/register/ledger-core/split-register.c   2006-01-12 22:09:58.000000000 -0500
+++ ../split-register.c 2006-01-12 22:02:45.000000000 -0500
@@ -1331,6 +1331,7 @@
    const char *memo;
    const char *desc;
    Split *split;
+   Account * acct;

    if (!reg) return FALSE;

@@ -1389,8 +1390,8 @@
      return FALSE;

    /* Validate the transfer account names */
-   (void *)gnc_split_register_get_account (reg, MXFRM_CELL);
-   (void *)gnc_split_register_get_account (reg, XFRM_CELL);
+   acct = gnc_split_register_get_account (reg, MXFRM_CELL);
+   acct = gnc_split_register_get_account (reg, XFRM_CELL);

    /* Maybe deal with exchange-rate transfers */
    if (gnc_split_register_handle_exchange (reg, FALSE))


Now it builds just fine for me.  I haven't tested much functionality yet, but
likely will in the next few weeks.  Nice work so far, guys.

--Andy


More information about the gnucash-devel mailing list