GnuCash
Contact   Instructions
Bug 796769 - Exposing new variables via swig sometimes results in an error "Undefined variable : <something>" while building
Summary: Exposing new variables via swig sometimes results in an error "Undefined vari...
Status: NEW
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Build system (show other bugs)
Version: git-maint
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords: build
Depends on:
Blocks:
 
Reported: 2018-07-18 04:52 EDT by vandendriessche pierre
Modified: 2019-02-23 18:36 EST (History)
4 users (show)

See Also:


Attachments

Description vandendriessche pierre 2018-07-18 04:52:48 EDT
Hello,

I try to build last version of gnucash (3.x from git origin/maint). I have followed all the requirements for dependecies (except gwengui which i havn't found anything for installing) and run "cmake" (ok) then "make all" (NOK).

the make command give me an error (see below).

i see some possibilities for giving me this error : 
- guile problem (maybe the version of guile is not correct ? ) i use guile 2.2 which i build and installed correctly.
- the variable gnc-build-userdata-path is maybe not defined (didn't check for now)

I use ubuntu 16.04 LTS xenial release
I use guile 2.2.4 (builded myself ok)

---------------------------------------------------------------------
cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D CMAKE_BUILD_TYPE=Release ../

-- Using guile-2.2.x
-- Using guile SRFI-64
-- Checking for module 'gwengui-gtk3'
--   No package 'gwengui-gtk3' found
-- Checking for module 'libsecret-1>=0.18'
--   
-- Checking for GTEST
-- Checking for GMOCK
-- Performing Test have_mod_mask
-- Performing Test have_mod_mask - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/***user***/gnucash.git/build
---------------------------------------------------------------------

---------------------------------------------------------------------
make

[...]
[ 28%] Built target scm-gnc-module
Scanning dependencies of target scm-core-utils
[ 28%] Generating ../../lib/gnucash/scm/ccache/2.2/gnucash/core-utils.go
Backtrace:
In /usr/local/bin/guild:
    72:17 19 (main _)
In srfi/srfi-1.scm:
    640:9 18 (for-each #<procedure 11e1900 at scripts/compile.scm:2…> …)
In scripts/compile.scm:
   259:26 17 (_ _)
In system/base/target.scm:
     57:6 16 (with-target _ _)
In system/base/compile.scm:
    152:6 15 (compile-file _ #:output-file _ #:from _ #:to _ #:env _ …)
     43:4 14 (call-once _)
In ice-9/boot-9.scm:
    841:4 13 (with-throw-handler _ _ _)
In system/base/compile.scm:
    59:11 12 (_)
   155:11 11 (_ #<closed: file 11d0230>)
   235:18 10 (read-and-compile #<input: core-utils.scm 13> #:from _ # …)
   183:32  9 (compile-fold (#<procedure compile-tree-il (x e opts)>) …)
In ice-9/boot-9.scm:
   2312:4  8 (save-module-excursion #<procedure 12e7b20 at language/…>)
In language/scheme/compile-tree-il.scm:
    31:15  7 (_)
In ice-9/psyntax.scm:
  1235:36  6 (expand-top-sequence ((re-export #)) _ _ #f c (# load …) …)
  1182:24  5 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …)
   285:10  4 (parse _ (("placeholder" placeholder)) (()) _ c&e (# #) #)
In ice-9/boot-9.scm:
  2071:24  3 (call-with-deferred-observers #<procedure 12e75e0 at ic…>)
   260:13  2 (for-each #<procedure 12e74a0 at ice-9/boot-9.scm:3495…> …)
In unknown file:
           1 (scm-error misc-error #f "~A ~S" ("Undefined variab…" …) …)
In ice-9/boot-9.scm:
   752:25  0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
Undefined variable: gnc-build-userdata-path
libgnucash/core-utils/CMakeFiles/scm-core-utils.dir/build.make:61: recipe for target 'lib/gnucash/scm/ccache/2.2/gnucash/core-utils.go' failed
make[2]: *** [lib/gnucash/scm/ccache/2.2/gnucash/core-utils.go] Error 1
CMakeFiles/Makefile2:4093: recipe for target 'libgnucash/core-utils/CMakeFiles/scm-core-utils.dir/all' failed
make[1]: *** [libgnucash/core-utils/CMakeFiles/scm-core-utils.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2


---------------------------------------------------------------------
Comment 1 Geert Janssens 2018-07-31 12:32:20 EDT
This issue typically happens if an older version of libgnc-core-utils.so is found whild building.

Do you have gnucash 2.6.x still installed on this system ? If so, try to remove it an restart your build.
Comment 2 Geert Janssens 2019-02-23 18:36:58 EST
I have changed the title of this bug as the issue may be broader. I have ran into a similar issue today while rebuilding gnucash after a change in functions that are exported to guile via our swig wrappers.

In this particular case the error was
[35/504] Generating ../../lib64/gnucash/scm/ccache/2.2/gnucash/utilities.go
FAILED: lib64/gnucash/scm/ccache/2.2/gnucash/utilities.go 
cd /home/janssege/Development/builds/gnucash/maint/libgnucash/scm && /usr/bin/cmake -E env LD_LIBRARY_PATH=/home/janssege/Development/builds/gnucash/maint/lib64:/home/janssege/Development/builds/gnucash/maint/lib64/gnucash: GNC_UNINSTALLED=YES GNC_BUILDDIR=/home/janssege/Development/builds/gnucash/maint GUILE_LOAD_PATH=/home/janssege/Development/gnucash/maint/libgnucash/scm GUILE_LOAD_COMPILED_PATH=/home/janssege/Development/builds/gnucash/maint/lib64/gnucash/scm/ccache/2.2 GNC_MODULE_PATH=/home/janssege/Development/builds/gnucash/maint/lib64:/home/janssege/Development/builds/gnucash/maint/lib64/gnucash: /usr/bin/guile2.2 -e '(@@ (guild) main)' -s /usr/bin/guild2.2 compile -o /home/janssege/Development/builds/gnucash/maint/lib64/gnucash/scm/ccache/2.2/gnucash/utilities.go /home/janssege/Development/gnucash/maint/libgnucash/scm/utilities.scm
Backtrace:
In system/base/compile.scm:
    59:11 19 (_)
   155:11 18 (_ #<closed: file 55a5a14ece00>)
   235:18 17 (read-and-compile #<input: utilities.scm 13> #:from _ # …)
   183:32 16 (compile-fold (#<procedure compile-tree-il (x e opts)>) …)
In ice-9/boot-9.scm:
   2316:4 15 (save-module-excursion #<procedure 55a5a166b520 at lang…>)
In language/scheme/compile-tree-il.scm:
    31:15 14 (_)
In ice-9/psyntax.scm:
  1234:36 13 (expand-top-sequence ((use-modules (gnucash #))) _ _ #f …)
  1181:24 12 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …)
   284:10 11 (parse _ (("placeholder" placeholder)) (()) _ c&e (# #) #)
In ice-9/boot-9.scm:
  3369:20 10 (process-use-modules _)
   230:17  9 (map1 (((gnucash core-utils))))
  3370:31  8 (_ ((gnucash core-utils)))
  2792:17  7 (resolve-interface (gnucash core-utils) #:select _ # _ # …)
  2718:10  6 (_ (gnucash core-utils) _ _ #:ensure _)
  2986:16  5 (try-module-autoload _ _)
   2316:4  4 (save-module-excursion #<procedure 55a5a1650a80 at ice-…>)
  3006:22  3 (_)
In unknown file:
           2 (primitive-load-path "gnucash/core-utils" #<procedure 5…>)
In core-utils.scm:
     59:0  1 (_)
In ice-9/boot-9.scm:
   760:25  0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:760:25: In procedure dispatch-exception:
ice-9/boot-9.scm:760:25: In procedure module-lookup: Unbound variable: gnc-version

The short summary: while trying to load the gnucash/core-utils.scm module guile bails out because it can't find the symbol "gnc-version".

The gnc_version function went through some refactoring recently. It moved to another file.

I don't remember the exact order of events but just now I ran into the above build error. I suspect switching to commits before and after the change and running builds at these commits can trigger the error. It looks like not all build artefacts are properly tracked by cmake (which I presume is due to some rules missing in our CMakeLists.txt files).

I think so because in my particular case the build failure was fixed by two actions:
1. run "make clean" (which in itself was not sufficient and perhaps even completely unneeded)
2. remove ./_cmake_build/libgnucash/core-utils/CMakeFiles/gnc-core-utils.dir/swig-core-utils-guile.c.o

After deleting the file mentioned in step 2 the build worked fine again.

So it may be swig-core-utils-guile.c.o was an artefact from a previous build (which didn't have the gnc_version definition or a wrong definition) and it didn't get rebuilt after core-utils.i was updated with the new gnc_version definition. I'll keep an eye on this if it happens again.

Note You need to log in before you can comment on or make changes to this bug.