GNOME Bugzilla – Bug 655901
Fix build with guile 2.0
Last modified: 2018-06-29 23:00:11 UTC
This patch for Petr Gajdos is apparently needed for a build against guile 2.0.
Created attachment 193165 [details] [review] guile 2.0 build fix
(I meant "from" Petr, not "for")
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.
I'll ask Petr.
I have committed the two changes to the development branch already. I'll wait for your feedback before adding the last change.
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
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 ?
Any news on this one ? I'd like to get the guile 2.0 compatibility sorted out. Thank you.
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.
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.
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 ?
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
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
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.
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 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 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.
(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
Created attachment 200674 [details] [review] Patch by Petr again The patch replaces the SCM_STRING_CHARS usage by memcpy....
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.
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.
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
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.
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.
*** Bug 698586 has been marked as a duplicate of this bug. ***
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.
Swig 2.0.10 was released yesterday. The combination GnuCash 2.5.x/Swig 2.0.10 should work with guile 2.
Closing this bug report as no other modifications to gnucash are needed to work with guile 2.
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.