all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to build GnuCash with SQLite backend support?
@ 2017-12-05 20:56 Gary Johnson
  2017-12-06  8:59 ` Efraim Flashner
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Johnson @ 2017-12-05 20:56 UTC (permalink / raw)
  To: help-guix

Hi guys,

I run Guix on top of Parabola. Recently, the GnuCash package from the
AUR got into conflict with an old version of ICU, and now it won't build
anymore. So...I decided to install GnuCash through Guix instead.

Unfortunately, although it built correctly (yay Guix!), I can no longer
open my accounts.gnucash file (in SQLite3 format). Instead, I just get a
message from GnuCash saying that no suitable backend can be found for
this format.

I then looked at the gnucash.scm file here:

  /usr/share/guile/site/2.2/gnu/packages/gnucash.scm

And I found this:

(arguments
 `(#:tests? #f ;FIXME: failing at /qof/gnc-date/qof print date dmy buff
   #:configure-flags '("--disable-dbi"
                       "--enable-aqbanking")

So I'm guessing that the "--disable-dbi" configure flag is the culprit
here. However, I'm still a novice to the structure of Guix package build
files, so I could really use some help. I tried removing the
"--disable-dbi" flag from the #:configure-flags list, and then ran:

$ guix package -f gnucash.scm

on my new copy of the gnucash.scm file. However, guix just returns
silently without doing anything. What am I doing wrong?

Thanks in advance,
  Gary

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to build GnuCash with SQLite backend support?
  2017-12-05 20:56 How to build GnuCash with SQLite backend support? Gary Johnson
@ 2017-12-06  8:59 ` Efraim Flashner
  2017-12-06 15:34   ` Gary Johnson
  0 siblings, 1 reply; 5+ messages in thread
From: Efraim Flashner @ 2017-12-06  8:59 UTC (permalink / raw)
  To: Gary Johnson; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]

On Tue, Dec 05, 2017 at 03:56:02PM -0500, Gary Johnson wrote:
> Hi guys,
> 
> I run Guix on top of Parabola. Recently, the GnuCash package from the
> AUR got into conflict with an old version of ICU, and now it won't build
> anymore. So...I decided to install GnuCash through Guix instead.
> 
> Unfortunately, although it built correctly (yay Guix!), I can no longer
> open my accounts.gnucash file (in SQLite3 format). Instead, I just get a
> message from GnuCash saying that no suitable backend can be found for
> this format.
> 
> I then looked at the gnucash.scm file here:
> 
>   /usr/share/guile/site/2.2/gnu/packages/gnucash.scm
> 
> And I found this:
> 
> (arguments
>  `(#:tests? #f ;FIXME: failing at /qof/gnc-date/qof print date dmy buff
>    #:configure-flags '("--disable-dbi"
>                        "--enable-aqbanking")
> 
> So I'm guessing that the "--disable-dbi" configure flag is the culprit
> here. However, I'm still a novice to the structure of Guix package build
> files, so I could really use some help. I tried removing the
> "--disable-dbi" flag from the #:configure-flags list, and then ran:
> 
> $ guix package -f gnucash.scm
> 
> on my new copy of the gnucash.scm file. However, guix just returns
> silently without doing anything. What am I doing wrong?
> 
> Thanks in advance,
>   Gary
> 

guix package -f my-file.scm works great when you have a file that
returns a package. In this case, gnucash.scm contains the definition of
a package and so it doesn't return anything. If it's still the package
in the guix git tree then you can just run `guix package -i gnucash', if
your copy of gnucash.scm resides outside of the git tree then you'll
need `guix package -L path-to-gnucash.scm-directory -i gnucash' in order
to install it from your custom location.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to build GnuCash with SQLite backend support?
  2017-12-06  8:59 ` Efraim Flashner
@ 2017-12-06 15:34   ` Gary Johnson
  0 siblings, 0 replies; 5+ messages in thread
From: Gary Johnson @ 2017-12-06 15:34 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: help-guix

Thanks Efraim,

  I made a modified copy of gnucash.scm outside of the Guix git tree (as
gnucash-with-dbi.scm) that returns the gnucash package and was able to
get it to run with:

$ guix package -f gnucash-with-dbi.scm

Of course, I then ran into this error in the configure phase:

====================================
checking dbi/dbi.h usability... no
checking dbi/dbi.h presence... no
checking for dbi/dbi.h... no
configure: error:

 Unable to find <dbi/dbi.h>. Either install the libdbi development
 package (such as libdbi0-dev), or switch off the database backend of
 gnucash by --disable-dbi.
 Note: If you install libdbi, you should also install its database
 drivers (such as libdbd-sqlite3 libdbd-mysql libdbd-pgsql).
====================================

So, yeah...I should have seen that coming. Since libdbi and
libdbd-sqlite3 are not part of Guix yet, I guess that means I need to
write package definitions for them. I guess I'll need to go cozy up with
the manual for awhile...

RTFM time,
  Gary

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to build GnuCash with SQLite backend support?
       [not found] <mailman.135.1512579627.1476.help-guix@gnu.org>
@ 2017-12-07  1:28 ` Gary Johnson
  2017-12-07  7:50   ` Chris Marusich
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Johnson @ 2017-12-07  1:28 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

Hi again,

After spending some time with the Guix manual, I managed to write up a
new package module that defines packages for libdbi, libdbi-drivers
(just sqlite3 support for now), and gnucash-with-dbi (see attached
file).


[-- Attachment #2: gnucash-with-dbi.scm --]
[-- Type: application/octet-stream, Size: 7012 bytes --]

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017 Gary Johnson <lambdatronic@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (my-packages gnucash-with-dbi)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages gnucash)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages icu4c)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages web)
  #:use-module (gnu packages webkit)
  #:use-module (gnu packages xml))

(define-public gnucash-with-dbi
  (package
    (name "gnucash-with-dbi")
    (version "2.6.16")
    (source
     (origin
      (method url-fetch)
      (uri (string-append "mirror://sourceforge/gnucash/gnucash%20%28stable%29/"
                          version "/gnucash-" version ".tar.bz2"))
      (sha256
       (base32
        "1088rssg9xgwi3wdfrhdcga46gby6lrd9a1fvn9zq456lscn4m9c"))
      (patches (search-patches "gnucash-price-quotes-perl.patch"))))
    (build-system gnu-build-system)
    (inputs
     `(("guile" ,guile-2.0)
       ("icu4c" ,icu4c)
       ("glib" ,glib)
       ("gtk" ,gtk+-2)
       ("goffice" ,goffice-0.8)
       ("libgnomecanvas" ,libgnomecanvas)
       ("libdbi" ,libdbi)
       ("libdbi-drivers" ,libdbi-drivers)
       ("libxml2" ,libxml2)
       ("libxslt" ,libxslt)
       ("webkitgtk" ,webkitgtk/gtk+-2)
       ("aqbanking" ,aqbanking)
       ("perl-date-manip" ,perl-date-manip)
       ("perl-finance-quote" ,perl-finance-quote)))
    (propagated-inputs
     `(("sqlite" ,sqlite)))
    (native-inputs
     `(("glib" ,glib "bin") ; glib-compile-schemas, etc.
       ("intltool" ,intltool)
       ("pkg-config" ,pkg-config)))
    (arguments
     `(#:tests? #f ;FIXME: failing at /qof/gnc-date/qof print date dmy buff
       #:configure-flags '("--enable-aqbanking")
       #:phases
       (modify-phases %standard-phases
         (add-after
          'install 'wrap-programs
          (lambda* (#:key inputs outputs #:allow-other-keys)
            (for-each (lambda (prog)
                        (wrap-program (string-append (assoc-ref outputs "out")
                                                     "/bin/" prog)
                          `("PERL5LIB" ":" prefix
                            ,(map (lambda (o)
                                    (string-append o "/lib/perl5/site_perl/"
                                                   ,(package-version perl)))
                                  (if (string=? prog "gnc-fq-helper")
                                      (list
                                       ,@(transitive-input-references
                                          'inputs
                                          (map (lambda (l)
                                                 (assoc l (inputs)))
                                               '("perl-finance-quote"
                                                 "perl-date-manip"))))
                                      (list
                                       ,@(transitive-input-references
                                          'inputs
                                          (map (lambda (l)
                                                 (assoc l (inputs)))
                                               '("perl-finance-quote")))))))))
                      '("gnucash"
                        "gnc-fq-check"
                        "gnc-fq-helper"
                        "gnc-fq-dump")))))))
    (home-page "http://www.gnucash.org/")
    (synopsis "Personal and small business financial accounting software")
    (description
     "GnuCash is personal and professional financial-accounting
software. It can be used to track bank accounts, stocks, income and
expenses, based on the double-entry accounting practice. It includes
support for QIF/OFX/HBCI import and transaction matching. It also
automates several tasks, such as financial calculations or scheduled
transactions.")
    (license license:gpl3+)))

(define-public libdbi
  (package
    (name "libdbi")
    (version "0.9.0")
    (source
     (origin
      (method url-fetch)
      (uri
       (string-append "https://versaweb.dl.sourceforge.net/project/libdbi/libdbi/libdbi-"
                      version "/libdbi-" version ".tar.gz"))
      (sha256
       (base32
        "00s5ra7hdlq25iv23nwf4h1v3kmbiyzx0v9bhggjiii4lpf6ryys"))))
    (build-system gnu-build-system)
    (home-page "http://libdbi.sourceforge.net/")
    (synopsis "Database-independent abstraction layer in C")
    (description
     "The libdbi framework implements a database-independent abstraction layer in C,
similar to the DBI/DBD layer in Perl. Writing one generic set of code,
programmers can leverage the power of multiple databases and multiple
simultaneous database connections by using this framework.")
    (license license:lgpl2.1+)))

(define-public libdbi-drivers
  (package
    (name "libdbi-drivers")
    (version "0.9.0")
    (source
     (origin
      (method url-fetch)
      (uri
       (string-append "https://versaweb.dl.sourceforge.net/project/libdbi-drivers/libdbi-drivers/libdbi-drivers-"
                      version "/libdbi-drivers-" version ".tar.gz"))
      (sha256
       (base32
        "0m680h8cc4428xin4p733azysamzgzcmv4psjvraykrsaz6ymlj3"))))
    (build-system gnu-build-system)
    (inputs
     `(("libdbi" ,libdbi)
       ("sqlite" ,sqlite)))
    (arguments
     '(#:configure-flags '("--with-sqlite3")))
    (home-page "http://libdbi-drivers.sourceforge.net/")
    (synopsis "Database-specific drivers for the libdbi framework")
    (description
     "The libdbi-drivers project provides the database-specific drivers for
the libdbi framework. The current version of libdbi-drivers will work
with any 0.9.x release of the framework. The drivers officially
supported by libdbi are MySQL, PostgreSQL, and SQLite3.")
    (license license:lgpl2.1+)))

[-- Attachment #3: Type: text/plain, Size: 1809 bytes --]


However, now I'm getting a new error when I pop this file on the
GUIX_PACKAGE_PATH and run:

$ guix package -i libdbi-drivers

==================================================
...
LOTS OF NORMAL CONFIG OUTPUT
...
checking for libdbi framework... checking dbi/dbi.h usability... yes
checking dbi/dbi.h presence... yes
checking for dbi/dbi.h... yes
checking for MySQL support... no
checking for PostgreSQL support... no
checking for SQLite support... no
checking for SQLite3 support... yes
checking sqlite3.h usability... yes
checking sqlite3.h presence... yes
checking for sqlite3.h... yes
checking for library containing sqlite3_exec... -lsqlite3
checking for Msql support... no
checking for Oracle support... no
checking for Firebird/Interbase support... no
checking for Freetds support... no
checking for Ingres support... no
checking for IBM DB2 support... no
checking for strtoll... yes
checking for atoll... yes
checking for vasprintf... yes
checking for asprintf... yes
checking for libdbi library... no
configure: error: Invalid libdbi directory - include files not found.
phase `configure' failed after 2.5 seconds
builder for `/gnu/store/nxm3ivpsngf7k9rcszry30hyjpx65iqw-libdbi-drivers-0.9.0.drv' failed with exit code 1
guix package: error: build failed: build of `/gnu/store/nxm3ivpsngf7k9rcszry30hyjpx65iqw-libdbi-drivers-0.9.0.drv' failed
==================================================

Okay, guys. What the heck am I missing here? I've clearly added the
libdbi and sqlite packages to the "inputs" list of the libdbi-drivers
package. The configure phase is detecting dbi.h and sqlite3.h just fine,
but then it can't find the libdbi library? Now I'm definitely lost. :(

I tried sticking libdbi into propagated-inputs and even into
native-inputs with exactly the same result.

Help?
  Gary

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to build GnuCash with SQLite backend support?
  2017-12-07  1:28 ` Gary Johnson
@ 2017-12-07  7:50   ` Chris Marusich
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Marusich @ 2017-12-07  7:50 UTC (permalink / raw)
  Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 6173 bytes --]

Gary Johnson <lambdatronic@gmail.com> writes:

> Hi again,
>
> After spending some time with the Guix manual, I managed to write up a
> new package module that defines packages for libdbi, libdbi-drivers
> (just sqlite3 support for now), and gnucash-with-dbi (see attached
> file).

Awesome!  Thank you for taking the time to do this!

> However, now I'm getting a new error when I pop this file on the
> GUIX_PACKAGE_PATH and run:
>
> $ guix package -i libdbi-drivers
>
> ==================================================
> ...
> LOTS OF NORMAL CONFIG OUTPUT
> ...
> checking for libdbi framework... checking dbi/dbi.h usability... yes
> checking dbi/dbi.h presence... yes
> checking for dbi/dbi.h... yes
> checking for MySQL support... no
> checking for PostgreSQL support... no
> checking for SQLite support... no
> checking for SQLite3 support... yes
> checking sqlite3.h usability... yes
> checking sqlite3.h presence... yes
> checking for sqlite3.h... yes
> checking for library containing sqlite3_exec... -lsqlite3
> checking for Msql support... no
> checking for Oracle support... no
> checking for Firebird/Interbase support... no
> checking for Freetds support... no
> checking for Ingres support... no
> checking for IBM DB2 support... no
> checking for strtoll... yes
> checking for atoll... yes
> checking for vasprintf... yes
> checking for asprintf... yes
> checking for libdbi library... no
> configure: error: Invalid libdbi directory - include files not found.
> phase `configure' failed after 2.5 seconds
> builder for `/gnu/store/nxm3ivpsngf7k9rcszry30hyjpx65iqw-libdbi-drivers-0.9.0.drv' failed with exit code 1
> guix package: error: build failed: build of `/gnu/store/nxm3ivpsngf7k9rcszry30hyjpx65iqw-libdbi-drivers-0.9.0.drv' failed
> ==================================================
>
> Okay, guys. What the heck am I missing here? I've clearly added the
> libdbi and sqlite packages to the "inputs" list of the libdbi-drivers
> package. The configure phase is detecting dbi.h and sqlite3.h just fine,
> but then it can't find the libdbi library? Now I'm definitely lost. :(

I think the problem might lie in how the libdbi author(s) have written
their ./configure.in file.  Check out the file in the libdbi source:

--8<---------------cut here---------------start------------->8---
if test "$ac_libdbi" = "YES"; then
   AC_MSG_CHECKING(for libdbi library)
   if test "$ac_dbi_libdir" = "no"; then
           dbi_libdirs="/usr/lib /usr/local/lib /sw/lib"
           libdbi_libs="libdbi.so libdbi.a"
           AC_FIND_FILE($libdbi_libs, $dbi_libdirs, ac_dbi_libdir)
           if test "$ac_dbi_libdir" = "no"; then
                   AC_MSG_RESULT(no)
                   AC_MSG_ERROR([Invalid libdbi directory - include files not found.])
           fi
   fi

   AC_MSG_RESULT([yes: libs in $ac_dbi_libdir])
   LIBADD_LIBDBI="$LIBADD_LIBDBI -L$ac_dbi_libdir"
        
   AC_SUBST(LIBADD_LIBDBI)

   LIBDBI_LIBDIR="$ac_dbi_libdir"
   AC_SUBST(LIBDBI_LIBDIR)

fi
--8<---------------cut here---------------end--------------->8---

It looks like this expands to the following in ./configure:

--8<---------------cut here---------------start------------->8---
if test "$ac_libdbi" = "YES"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdbi library" >&5
$as_echo_n "checking for libdbi library... " >&6; }
   if test "$ac_dbi_libdir" = "no"; then
           dbi_libdirs="/usr/lib /usr/local/lib /sw/lib"
           libdbi_libs="libdbi.so libdbi.a"

ac_dbi_libdir=no
for i in $dbi_libdirs; do
        for j in $libdbi_libs; do
                if test -r "$i/$j"; then
                        ac_dbi_libdir=$i
                        break 2
                fi
        done
done

           if test "$ac_dbi_libdir" = "no"; then
                   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
                   as_fn_error $? "Invalid libdbi directory - include files not found." "$LINENO" 5
           fi
   fi

   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: libs in $ac_dbi_libdir" >&5
$as_echo "yes: libs in $ac_dbi_libdir" >&6; }
   LIBADD_LIBDBI="$LIBADD_LIBDBI -L$ac_dbi_libdir"



   LIBDBI_LIBDIR="$ac_dbi_libdir"


fi
--8<---------------cut here---------------end--------------->8---

Note the "dbi_libdirs" variable, which contains the value "/usr/lib
/usr/local/lib /sw/lib".  My guess is that the configure step is failing
because it's trying (incorrectly) to look in those absolute directory
paths to find the files it needs.  When you build a package in Guix, the
build takes place in an isolated environment.  The builder only has
access to inputs that you explicitly declare in your package definition
(or inputs that are provided by default by the build system you choose).
Any attempt to access files outside the store will fail.

If that's the problem, then to fix it, there are at least two possible
approaches:

1) Submit a patch that somehow fixes the issue upstream.  Probably, the
   configure.in script should not assume an absolute path like this.
   I'm not too familiar with Autoconf and Automake, but I'm sure there
   must be a way to fix this upstream...  Maybe someone else knows more.

2) Patch the ./configure script by using the "substitute*" form defined
   in Guix.  This is a fine solution, too.  You can run

       grep -r 'substitute\*' ~/.config/guix/latest/gnu/packages

   to see how it's used.  You can run

       grep -r -A30 'define.*substitute\*' ~/.config/guix/latest

   to find the file where it's defined.  It isn't really documented in
   the Guix manual (yet).  You probably want to either (a) remove the
   check entirely, and hope that the build system will just find the
   libraries it needs in the build environment, or (b) explicitly set
   the dbi_libdirs variable to the path in the store that contains the
   output of the libdbi package.  Option (b) seems cleaner.

Hope that helps get you moving forward again!  Thanks for taking the
time to add packages.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-07  7:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-05 20:56 How to build GnuCash with SQLite backend support? Gary Johnson
2017-12-06  8:59 ` Efraim Flashner
2017-12-06 15:34   ` Gary Johnson
     [not found] <mailman.135.1512579627.1476.help-guix@gnu.org>
2017-12-07  1:28 ` Gary Johnson
2017-12-07  7:50   ` Chris Marusich

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.