After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 655901 - Fix build with guile 2.0
Fix build with guile 2.0
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Build system
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Geert Janssens
gnucash-core-maint
: 698586 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-08-03 12:47 UTC by Vincent Untz
Modified: 2018-06-29 23:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
guile 2.0 build fix (1.76 KB, patch)
2011-08-03 12:47 UTC, Vincent Untz
committed Details | Review
Fix guile 2.0 on gnucash 2.4.x (986 bytes, patch)
2011-10-19 16:47 UTC, Geert Janssens
rejected Details | Review
Patch by Petr again (12.00 KB, patch)
2011-11-04 10:08 UTC, Dominique Leuenberger
needs-work Details | Review

Description Vincent Untz 2011-08-03 12:47:07 UTC
This patch for Petr Gajdos is apparently needed for a build against guile 2.0.
Comment 1 Vincent Untz 2011-08-03 12:47:27 UTC
Created attachment 193165 [details] [review]
guile 2.0 build fix
Comment 2 Vincent Untz 2011-08-03 12:47:40 UTC
(I meant "from" Petr, not "for")
Comment 3 Geert Janssens 2011-08-04 08:53:42 UTC
Thank you for the patch.

I have checked it and I wonder why the change is made in the aqbanking makefile. As far as I can see that module is not using any guile related code or function calls ? Realizing my autotools knowledge is fairly limited, I may be missing something here.

The other two changes can be applied as they are.
Comment 4 Vincent Untz 2011-08-04 09:04:44 UTC
I'll ask Petr.
Comment 5 Geert Janssens 2011-08-04 11:03:44 UTC
I have committed the two changes to the development branch already. I'll wait for your feedback before adding the last change.
Comment 6 Vincent Untz 2011-08-04 13:57:18 UTC
Petr came back to me, and showed me the build error without that part:

In file included from ../../../src/gnome-utils/gnc-ui.h:38:0,
                 from dialog-ab-trans.c:48:
../../../src/guile-mappings.h:20:54: fatal error: libguile.h: No such
file or directory
compilation terminated.
make[5]: *** [dialog-ab-trans.lo] Error 1
make[5]: *** Waiting for unfinished jobs....
In file included from ../../../src/gnome-utils/gnc-ui.h:38:0,
                 from druid-ab-initial.c:51:
../../../src/guile-mappings.h:20:54: fatal error: libguile.h: No such
file or directory
compilation terminated.
make[5]: *** [druid-ab-initial.lo] Error 1
make[5]: Leaving directory
`/usr/src/packages/BUILD/gnucash-2.4.6/src/import-export/aqbanking'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory
`/usr/src/packages/BUILD/gnucash-2.4.6/src/import-export/aqbanking'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/usr/src/packages/BUILD/gnucash-2.4.6/src/import-export'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/src/packages/BUILD/gnucash-2.4.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/packages/BUILD/gnucash-2.4.6'
make: *** [all] Error 2
Comment 7 Geert Janssens 2011-08-05 12:25:51 UTC
Ok, I see the problem. But the solution looks a bit backwards to me.

Instead of adding a guile dependency in the aqbanking module, can Petr instead try and remove a line from src/gnome-utils/gnc-ui.h, like so:

diff --git a/src/gnome-utils/gnc-ui.h b/src/gnome-utils/gnc-ui.h
index 6d368b4..c8ebb97 100644
--- a/src/gnome-utils/gnc-ui.h
+++ b/src/gnome-utils/gnc-ui.h
@@ -35,7 +35,6 @@
 
 #include "Account.h"
 #include "gnc-pricedb.h"
-#include "guile-mappings.h"
 #include <gtk/gtk.h>
 
 
That would probably also fix the problem, reducing dependencies instead of adding one.

Can you let me know of the result ?
Comment 8 Geert Janssens 2011-08-20 13:35:50 UTC
Any news on this one ? I'd like to get the guile 2.0 compatibility sorted out. Thank you.
Comment 9 Geert Janssens 2011-09-11 11:22:50 UTC
Since there's no reply, I have committed the above change to trunk. It is marked for backport to the 2.4 series as well, but I'll only commit a backport if someone confirms it's not causing any unexpected trouble.

For reference: this bug doesn't happen on my build system (Fedora 14), so my fix is only theoretical. I need someone that experienced the bug to verify if the actually does solve it and not introduce new build problems.
Comment 10 Dominique Leuenberger 2011-10-18 19:19:30 UTC
Geert,

With your proposed change, the build aborts with (With Petr's patch it passes):

In file included from ../../../src/gnome/gnc-plugin-page-register.h:43:0,
                 from gnc-plugin-aqbanking.c:49:
../../../src/gnome/gnc-split-reg.h:32:22: fatal error: libguile.h: No such file or directory
compilation terminated.
make[5]: *** [gnc-plugin-aqbanking.lo] Error 1
make[5]: *** Waiting for unfinished jobs....

As a matter of fact, guile-mappings.h is needed, due to:
  # define gnc_free_scm_locale_string free

which is used in
src/gnome-utils/gnc-menu-extensions.c: gnc_free_scm_locale_string(s);

Thus the guile requirement is real.
Comment 11 Geert Janssens 2011-10-19 16:47:27 UTC
Created attachment 199452 [details] [review]
Fix guile 2.0 on gnucash 2.4.x

Ah, I realize I didn't build with aqbanking enabled.

There are two things with my original proposal:
1. The development branch of GnuCash no longer uses the gnc_scm_locale_string macro definiton, so on trunk I didn't experience this error. On the 2.4 branch I do.

2. I have removed the libguile.h include from gnc-split-reg.h. It doesn't seem to be used there.

With the attached patch, GnuCash builds fine here. Can you try this one and see if you can continue now ?
Comment 12 Dominique Leuenberger 2011-10-19 19:36:05 UTC
I can confirm that the build indeed does pass with your new proposed patch (and some hunks left from Petr's original patch, which seemed not to be subject to discussion).

It remains to be remarked though, that even though the build passed just fine, make check has three failing tests (unrelated to which way of fixing is used: Petr's patch or the new suggested one).

The failing tests are:
FAIL: test-load-scm
FAIL: test-scm-multi
FAIL: test-load-deps
Comment 13 Dominique Leuenberger 2011-10-19 19:40:22 UTC
The output from one of the failing tests:
(All failing ones have this in common:
;;; ERROR: no code for module (sw_gnc_module)
)

###

(process:28924): gnc.module-WARNING **: Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system

;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/./test-scm-multi
;;; compiling /usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/gnc-module.scm
;;; WARNING: compilation of /usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/gnc-module.scm failed:
;;; ERROR: no code for module (sw_gnc_module)
;;; usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi:8:0: warning: possibly unbound variable `foo-hello'
;;; usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi:9:0: warning: possibly unbound variable `foo:scheme-hello'
;;; usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi:11:0: warning: possibly unbound variable `foo-hello'
;;; usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi:12:0: warning: possibly unbound variable `foo:scheme-hello'
;;; usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi:13:0: warning: possibly unbound variable `bar-hello'
;;; usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi:14:0: warning: possibly unbound variable `bar:scheme-hello'
;;; compiled /home/abuild/.cache/guile/ccache/2.0-LE-8-2.0/usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi.go
Backtrace:
In ice-9/boot-9.scm:
 170: 8 [catch #t #<catch-closure 887880> ...]
In unknown file:
   ?: 7 [catch-closure]
In ice-9/boot-9.scm:
  62: 6 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 389: 5 [eval # #]
In ice-9/boot-9.scm:
2103: 4 [save-module-excursion #<procedure 8b2980 at ice-9/boot-9.scm:3547:3 ()>]
3554: 3 [#<procedure 8b2980 at ice-9/boot-9.scm:3547:3 ()>]
In unknown file:
   ?: 2 [load-compiled/vm "/home/abuild/.cache/guile/ccache/2.0-LE-8-2.0/usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi.go"]
In usr/src/packages/BUILD/gnucash-2.4.7/src/gnc-module/test/test-scm-multi:
   7: 1 [#<procedure cf95e0 ()>]
In unknown file:
   ?: 0 [gnc-module-load "gnucash/foo" 0]

ERROR: In procedure gnc-module-load:
ERROR: SCM_STRING_CHARS does not work with read-only strings

Some deprecated features have been used.  Set the environment
variable GUILE_WARN_DEPRECATED to "detailed" and rerun the
program to get more information.  Set it to "no" to suppress
this message.
FAIL: test-scm-multi
Comment 14 Geert Janssens 2011-10-19 21:28:34 UTC
Thanks for the feedback.

I have committed a patch to the 2.4 branch based on the one above. That means, it contains what I proposed in comment 11 and additionally removed all guile stuff from the bi_import plugin. This undoes part of Petr's original patch which was already applied, which added ${GUILE_LIBS} and ${GUILE_INCS} to bi_import. Instead I removed the include of libguile.h from gncmod-bi_import.c as there is no guile related code in there at all (anymore). I suspect it got a guile dependency via one of the other files I changed.

On my system, this still compiles fine and the changes will go into the upcoming 2.4.8 release.

As for the tests, they run successfully on my system. So I'll have a hard time figuring out why they fail for you. I don't have a system with guile 2.0 available. Perhaps this error doesn't happen with 1.8 ?

Anyway, I'll have a closer look later on.
Comment 15 Dominique Leuenberger 2011-10-27 20:00:07 UTC
Verified release 2.4.8: I still get the same make check errors as stated above (3 checks failed) (not really 'surprising', considering I had all of the guile-2 related patches on my tree)
Comment 16 Geert Janssens 2011-10-29 09:22:13 UTC
Comment on attachment 193165 [details] [review]
guile 2.0 build fix

A reworked version of this patch has been applied, so I'll mark it as committed. Thanks for the patch.
Comment 17 Geert Janssens 2011-10-29 09:22:54 UTC
Comment on attachment 199452 [details] [review]
Fix guile 2.0 on gnucash 2.4.x

Doesn't work on 2.4. An improved patch has been committed.
Comment 18 Geert Janssens 2011-11-04 09:59:08 UTC
(In reply to comment #13)
> 
> ERROR: In procedure gnc-module-load:
> ERROR: SCM_STRING_CHARS does not work with read-only strings
> 
I think this may be the cause of the failing test errors (which for some odd reason I still don't see on my test system with guile 1.8.8).

The problem is that SCM_STRING_CHARS is introduced by swig auto-generated code, not in the GnuCash code.

I haven't found a way yet to avoid this.

The fedora bug tracker has a related bug in its database:
https://bugzilla.redhat.com/show_bug.cgi?id=704527
Comment 19 Dominique Leuenberger 2011-11-04 10:08:17 UTC
Created attachment 200674 [details] [review]
Patch by Petr again

The patch replaces the SCM_STRING_CHARS usage by memcpy....
Comment 20 Geert Janssens 2011-11-04 13:34:18 UTC
Comment on attachment 200674 [details] [review]
Patch by Petr again

As I explained in the Red Hat bug report, this patch can't be applied to the GnuCash source directly, because it makes changes in code that is auto generated by the swig tool.

If desired, it can be used by downstream distributions that build from the GnuCash tarballs, because the tarballs are generated after swig has run. Hence when building from the tarball, the swig autogeneration step won't be run anymore and the patch can be applied.

But it still is a hack rather than a fix of the real problem, namely that swig generates code using deprecated guile symbols. This has to be fixed in swig unfortunately.
Comment 21 Stefan Sauer (gstreamer, gtkdoc dev) 2012-01-02 16:20:07 UTC
Apparently suse ships gnucash in 12.1 using this patch and completely broke it (see https://bugzilla.novell.com/show_bug.cgi?id=724917). I don't think it is ready.
Comment 22 Geert Janssens 2012-12-15 18:15:49 UTC
An update: as of r22655 the development branch of gnucash can be built and run with guile 2. It still spews warnings and the environment variable GUILE_AUTO_COMPILE should be set to 0, so this is still a work in progress.

It is important to realize though that this is only possible is swig is properly patched as well. I have submitted a patch here for swig:
https://bugzilla.redhat.com/show_bug.cgi?id=752054

So build instructions in short:
- download the swig patch from the above link (against swig 2.0.8) and build a patched swig
- install guile 2
- checkout gnucash' trunk branch as of r22655
- you may need to update configure.ac to have it prefer guile 2 if both guile 1.8 and guile 2 are installed on the system
- build gnucash as usual
- run gnucash as
GUILE_AUTO_COMPILE=0 /path/to/gnucash
Comment 23 Geert Janssens 2012-12-19 15:00:51 UTC
For interested distribution packagers, I have created a local branch that backports a minimum set of patches to be able to build and run gnucash 2.4 with guile 2:
https://github.com/gjanssens/gnucash/tree/2.4-guile2-fedora-rebasing

This branch will be rebased regularly on the current 2.4 HEAD.

Notes:
* As also said in comment 22, you will first have to patch swig before even attempting to build gnucash with guile 2.

* The GUILE_AUTO_COMPILE=0 parameter as used in comment 22 is no longer needed on the command line. In the branch this is included in the environment file.

* If your guile2 installation uses a custom binary name (eg /usr/bin/guile2)  to avoid name clashes with a co-installed guile 1.8, make check will fail. Make check is hardcoded to use 'guile', which would point at guile 1.8 in the above example. This would mix two guile versions: the binary being 1.8 and the libaries gnucash is linked to being 2.0. This results in failures during make check. A possible workaround is to fix the test scripts to use the guile2 binary instead.

* The patches make GnuCash prefer guile 2 over 1.8 if both are installed. If that's not what you want, you have to reverse the configure.ac test for guile/guile2 so that guile 1.8 is checked first.

* Finally, just FYI: I can't push these changes into the 2.4 stable branch because our stable branch still supports guile 1.6 and the backports had to remove this support.
Comment 24 Geert Janssens 2013-04-22 16:08:45 UTC
A small status update: I'm working with upstream swig to get it guile 2 compatible. I have reworked the patch I referred to in comment 22. My work is currently published on a guile2 branch on github here:
https://github.com/gjanssens/swig/tree/guile2

Distribution packagers may be interested to test this branch.
Comment 25 Geert Janssens 2013-04-22 16:21:13 UTC
*** Bug 698586 has been marked as a duplicate of this bug. ***
Comment 26 Geert Janssens 2013-05-02 17:00:49 UTC
Another update: all the necessary patches are in swig. The next swig version (swig 2.0.10) will be fully compatible with guile 2. I have no information on when this version will be released.
Comment 27 Geert Janssens 2013-05-28 08:08:01 UTC
Swig 2.0.10 was released yesterday.

The combination GnuCash 2.5.x/Swig 2.0.10 should work with guile 2.
Comment 28 Geert Janssens 2013-08-04 18:53:18 UTC
Closing this bug report as no other modifications to gnucash are needed to work with guile 2.
Comment 29 John Ralls 2018-06-29 23:00:11 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=655901. Please update any external references or bookmarks.