help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to build GnuCash with SQLite backend support?


From: Chris Marusich
Subject: Re: How to build GnuCash with SQLite backend support?
Date: Wed, 06 Dec 2017 23:50:52 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Gary Johnson <address@hidden> 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: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]