GNOME Bugzilla – Bug 792884
cmake: gschemas.compiled missing
Last modified: 2018-06-30 00:03:47 UTC
When building on NetBSD-8.99.12/amd64 with cmake (after working around https://bugzilla.gnome.org/show_bug.cgi?id=792883) installation fails with: CMake Error at gnucash/cmake_install.cmake:62 (file): file INSTALL cannot find "/scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/gschemas.compiled". Call Stack (most recent call first): cmake_install.cmake:84 (include) Previously in the build I see [ 48%] Generating ../share/glib-2.0/schemas/gschemas.compiled so I don't know why installation fails. (Perhaps a DESTDIR/PREFIX problem?)
Maybe a DESTDIR or PREFIX problem indeed... but unless you share what you told cmake to do only you will know.
Here are the arguments cmake gets: -DGMOCK_ROOT=/scratch/wip/gnucash-devel/work/googletest-release-1.8.0/googlemock -DGTEST_ROOT=/scratch/wip/gnucash-devel/work/googletest-release-1.8.0/googletest -DWITH_AQBANKING=OFF -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" -DCMAKE_INSTALL_PREFIX:PATH=/usr/pkg -DCMAKE_MODULE_PATH:PATH=/scratch/wip/gnucash-devel/work/.buildlink/cmake-Modules -DCMAKE_SKIP_RPATH:BOOL=TRUE -DCMAKE_INSTALL_LIBDIR:PATH=lib -DCMAKE_INSTALL_MANDIR:PATH=man -DCMAKE_INSTALL_INFODIR:PATH=info
Actually, no, neither prefix nor destdir should matter here, the file was either not made or deleted from CMAKE_BUILD_DIR/share/glib-2.0/schemas. I suppose you've made sure that the file really isn't there. The directory should be populated with 18 files whose names will be org.gnucash...gschema.xml. If they're not there then the command that creates gschemas.compiled will silently do nothing. Are they there?
I have worked on the gschemas and gschemas.compiled creation code in commit f11eab36d9a2e9d844a549e8a64cf356c8b4858f. I remember having trouble getting these files generated as well. I thought I had that fixed, but perhaps I have missed a corner case. Does netbsd ship the ninja-build tool ? If so you may want to do another cmake run adding -GNinja and run ninja-build (or ninja depending on the platform) instead of make as an extra test point.
Thanks for the suggestions. I did the ninja test first. Building with ninja throws lots of warnings like this one: ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /scratch/wip/gnucash-devel/work/.buildlink/bin/guild ;;; WARNING: compilation of /scratch/wip/gnucash-devel/work/.buildlink/bin/guild failed: ;;; failed to create path for auto-compiled file "/scratch/wip/gnucash-devel/work/.buildlink/bin/guild" and then dies with: cd /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/qif-imp && /usr/pkg/bin/cmake -E env LD_LIBRARY_PATH=/scratch/wip/gnucash-devel/work/gnucash-2.7.3/lib:/scratch/wip/gnucash-devel/work/gnucash-2.7.3/lib/gnucash: GNC_UNINSTALLED=YES GNC_BUILDDIR=/scratch/wip/gnucash-devel/work/gnucash-2.7.3 GUILE_LOAD_PATH=/scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/qif-imp GUILE_LOAD_COMPILED_PATH=/scratch/wip/gnucash-devel/work/gnucash-2.7.3/lib/gnucash/scm/ccache/2.2 GNC_MODULE_PATH=/scratch/wip/gnucash-devel/work/gnucash-2.7.3/lib:/scratch/wip/gnucash-devel/work/gnucash-2.7.3/lib/gnucash: /scratch/wip/gnucash-devel/work/.buildlink/bin/guile -e '(@@ (guild) main)' -s /scratch/wip/gnucash-devel/work/.buildlink/bin/guild compile -o /scratch/wip/gnucash-devel/work/gnucash-2.7.3/lib/gnucash/scm/ccache/2.2/qif-import/qif-import.go /scratch/wip/gnucash-devel/work/gnucash-2.7.3/gnucash/import-export/qif-imp/qif-import.scm ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /scratch/wip/gnucash-devel/work/.buildlink/bin/guild ;;; WARNING: compilation of /scratch/wip/gnucash-devel/work/.buildlink/bin/guild failed: ;;; failed to create path for auto-compiled file "/scratch/wip/gnucash-devel/work/.buildlink/bin/guild" Backtrace: In scripts/compile.scm: 251:26 19 (_ _) In system/base/target.scm: 57:6 18 (with-target _ _) In system/base/compile.scm: 152:6 17 (compile-file _ #:output-file _ #:from _ #:to _ #:env _ …) 43:4 16 (call-once _) In ice-9/boot-9.scm: 841:4 15 (with-throw-handler _ _ _) In system/base/compile.scm: 59:11 14 (_) 155:11 13 (_ #<closed: file 8150e0>) 235:18 12 (read-and-compile #<input: qif-import.scm 5> #:from _ # …) 183:32 11 (compile-fold (#<procedure compile-tree-il (x e opts)>) …) In ice-9/boot-9.scm: 2312:4 10 (save-module-excursion #<procedure 6dda60 at language/s…>) In language/scheme/compile-tree-il.scm: 31:15 9 (_) In ice-9/psyntax.scm: 1235:36 8 (expand-top-sequence ((use-modules (gnucash #))) _ _ #f …) 1182:24 7 (parse _ (("placeholder" placeholder)) ((top) #(# # …)) …) 285:10 6 (parse _ (("placeholder" placeholder)) (()) _ c&e (# #) #) In ice-9/boot-9.scm: 3365:20 5 (process-use-modules _) 222:17 4 (map1 (((gnucash app-utils)))) 3366:31 3 (_ ((gnucash app-utils))) 2791:6 2 (resolve-interface _ #:select _ #:hide _ #:prefix _ # _ …) In unknown file: 1 (scm-error misc-error #f "~A ~S" ("no code for modu…" …) …) In ice-9/boot-9.scm: 752:25 0 (dispatch-exception _ _ _) ice-9/boot-9.scm:752:25: In procedure dispatch-exception: no code for module (gnucash app-utils) [756/888] Generating ../../../lib/gnucash/scm/ccache/2.2/gnucash/import-export/qif-import.go FAILED: lib/gnucash/scm/ccache/2.2/gnucash/import-export/qif-import.go
As for the other question: # wc -l /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/* 178 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.business.gschema.xml 116 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.checkprinting.gschema.xml 16 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.commodities.gschema.xml 21 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.export.csv.gschema.xml 248 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.gschema.xml 16 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.import.csv.gschema.xml 71 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.import.generic.gschema.xml 9 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.import.ofx.gschema.xml 36 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.import.qif.gschema.xml 31 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.reconcile.gschema.xml 56 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.sxs.gschema.xml 21 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.dialogs.totd.gschema.xml 389 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.gschema.xml 59 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.history.gschema.xml 191 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.warnings.gschema.xml 54 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.window.pages.account.tree.gschema.xml 14 /scratch/wip/gnucash-devel/work/gnucash-2.7.3/share/glib-2.0/schemas/org.gnucash.window.pages.gschema.xml 1526 total
Whew, looks like building on NetBSD brings us from one issue to the next :( To start, I'd do as the warning advises and globally set environment variable GUILE_AUTO_COMPILE to 0. Note when guile is allowed to autocompile it will try to create files in $HOME/.cache/guile/ccache/.... It seems there's an issue with accessing that directory on your system. The actual error of "no code for module (gnucash app-utils)" may be because of a missing load path or a build sequence error. Can you check higher up in the build log whether there's a reference to a successful compilation of app-utils.go ? And lastly, I think it would be best to start a new bug for the scheme issues. It would distract from the original issue here of gchemas.compiled missing.
Ok back to gschemas.compiled, and assuming you have set up your build using cmake generating makefiles. What happens if you run make compiled-schemas
# gmake compiled-schemas [ 0%] Built target org.gnucash.dialogs.import.ofx.gschema.valid-target [ 0%] Built target org.gnucash.dialogs.import.qif.gschema.valid-target [ 0%] Built target org.gnucash.dialogs.commodities.gschema.valid-target [ 0%] Built target org.gnucash.dialogs.totd.gschema.valid-target [ 0%] Built target org.gnucash.dialogs.business.gschema.valid-target [ 0%] Built target org.gnucash.dialogs.checkprinting.gschema.valid-target [ 0%] Built target org.gnucash.window.pages.gschema.valid-target [ 0%] Built target org.gnucash.dialogs.reconcile.gschema.valid-target [ 0%] Built target org.gnucash.dialogs.gschema.valid-target [ 50%] Built target org.gnucash.dialogs.sxs.gschema.valid-target [ 50%] Built target org.gnucash.gschema.valid-target [ 50%] Built target org.gnucash.window.pages.account.tree.gschema.valid-target [ 50%] Built target org.gnucash.warnings.gschema.valid-target [ 50%] Built target org.gnucash.history.gschema.valid-target [100%] Built target org.gnucash.dialogs.export.csv.gschema.valid-target [100%] Built target org.gnucash.dialogs.import.csv.gschema.valid-target [100%] Built target org.gnucash.dialogs.import.generic.gschema.valid-target [100%] Generating ../share/glib-2.0/schemas/gschemas.compiled [100%] Built target compiled-schemas
I can't reproduce this with gnucash 2.7.4 (in which a number of cleanups happened in the build system). Can you test with that version or the current unstable ?
I still see the same issue in 2.7.4. ... -- Installing: /scratch/wip/gnucash-devel/work/.destdir/usr/pkg/bin/gnucash-valgrind -- Installing: /scratch/wip/gnucash-devel/work/.destdir/usr/pkg/etc/gnucash/environment CMake Error at gnucash/cmake_install.cmake:62 (file): file INSTALL cannot find "/scratch/wip/gnucash-devel/work/gnucash-2.7.4/share/glib-2.0/schemas/gschemas.compiled". Call Stack (most recent call first): cmake_install.cmake:84 (include) Makefile:61: recipe for target 'install' failed
ISTM you still haven't revealed whether gschemas.compiled is actually getting created, only that the cmake target is being executed. Does it exist after gmake and before gmake install? If not, run gmake compiled-schemas again. Does it exist now? Having confirmed its existence, run gmake install Does that succeed?
I have never found a "gschemas.compiled" file in my work directory. 'gmake compiled-schemas' does not create one either. Can you tell me what the command that should be executed to create the file is, so I can try it manually?
Ah, that explains the problem. The command for your build directory would be: glib-compile-schemas share/glib-2.0/schemas You can stick more elements onto the path if your pwd is somewhere else. I'll hazard a guess that glib-compile-schemas isn't installed and that there's some additional package that you need to install.
Thank you. That pointed me in the right direction. I'm building inside pkgsrc. pkgsrc provides a glib-compile-schemas binary during build, but it is a dummy that does nothing; pkgsrc takes care of generating the gschemas.compiled file by running glib-compile-schemas automatically after installation. That being said, I think that installing the file is the wrong way to handle it in general. It needs to be generated in the final destination, because other packages will already have installed other schema files, and those schema files will be ignored when the copy of gschemas.compiled generated for the gnucash files separately is installed.
Created attachment 367968 [details] [review] Run glib-compile-schemas on the installed schema files. OK. I agree with you; in fact I realize that this has been causing me trouble on Mac builds for exactly the reason you say. So I've figured out a way to do that, with two caveats: 1. CMake runs install commands in subdir inclusion order with "containing" CMakeLists run *first*, so the command has to go in a special subdirectory with a CMakeLists.txt that just does this post processing step. You can see what I think of this by the name I gave that directory. 2. The command line is constructed by cmake and needs the directory containing the schemas as a parameter. That means that it doesn't work with DESTDIR because the path is wrong. I don't see a way around this. I've put a patch up here for Geert to look over.
Thank you. I've tested the patch and it fixes the problem for me. One strangeness I noticed: there are two new files compared to 2.7.3 with strange names: share/gnucash/scm/gnucash/baz.scm share/gnucash/scm/gnucash/foo.scm If that is by intention, then I'm happy with closing the PR as soon as the patch above is committed. Thanks again!
A good catch on the way we were generating gschemas.compiled. I had noticed this while working on the commit I mentioned in comment 4 with the intention to investigate afterwards but I clearly completely forgot about it. I have worked from John's patch to come up with this commit, currently on my private github repo: https://github.com/gjanssens/gnucash/commit/a487d07f6eb14a3e73 It has two major changes: 1. it properly handles DESTDIR. To get this to work I had to write the compile command into a separate shell script and invoke that at install time. I suspect this part can probably be done directly in an execute process but it would mean lots of escapes making it hardly readable. I started on that route but gave up after a dozen or so attempts to get those right. 2. keep the ugly-hack but make it more meaningful by collecting the gschema files from gnome and gnome-utils in one higher-level directory. I had this in mind already for some time, but intended to do this after the 3.0 release. The necessity of this subdirectory to get gschemas-compiled to work reliably was a good motivation to do it for 3.0 after all. Note there are additional gschema files still in the importers, but I have not decided yet whether those will end up as optional modules or not in the future. So for now I will not move their files keep them self-contained. Feel free to review.
Those two files are used by gnc-module's test suite. Ideally they should be in the build and dist but not installed.
Indeed. I mentioned these on irc last weekend, but I haven't found time yet to clean this up. I may require extending the GncAddSchemeTarget definition with a switch to define whether or not the file should be installed. Perhaps we can get away with just detecting we're in a test subdir and ignore installation of any file in the test subdirectories.
I have committed a variation of John's patch to fix this issue. I've retrofitted some meaning to the 'ugly-hack' concept and chose to wrap the actual compilation work in a small temporary script to allow to print a message while doing the compilation. John and I had some more thorough discussion on the DESTDIR issue on the commit in github: https://github.com/gjanssens/gnucash/commit/a487d07f6eb14 The conclusion is this problem is unsolvable from within gnucash itself. It's proper to glib-compile-schemas' requirement to run on all the schema files in the final installation directory. This is fundamentally incompatible with the DESTDIR concept. So people relying on DESTDIR should be aware they may need to (re)run glib-compile-schemas somewhere later in their build process.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=792884. Please update any external references or bookmarks.