-----Original Message----- From: John Ralls <jra...@ceridwen.us> Sent: Wednesday, 6 May 2020 1:59 AM To: Chris Good <goodchri...@gmail.com> Cc: gnucash-devel <gnucash-devel@gnucash.org> Subject: Re: [GNC-dev] Master: Cannot open or save to SQLite3 database
> On May 4, 2020, at 7:53 PM, Chris Good <goodchri...@gmail.com> wrote: > > -----Original Message----- > From: John Ralls <jra...@ceridwen.us> > Sent: Tuesday, 5 May 2020 4:28 AM > To: Chris Good <goodchri...@gmail.com> > Cc: gnucash-devel <gnucash-devel@gnucash.org> > Subject: Re: [GNC-dev] Master: Cannot open or save to SQLite3 database > > > >> On May 3, 2020, at 10:40 PM, Chris Good <goodchri...@gmail.com> wrote: >> >> Hi, >> >> >> >> GnuCash master (as at 29 Apr 2020 fbf7171ab Fix >> libgnc-app-utils.dylib >> install_name_dir.) on Ubuntu 18.04 >> >> >> >> I'm trying to open SQLite3 file >> del-account-cross-currencies-issue.gnucash >> attached to bug 797220. >> >> >> >> But when I try to open SQLite3 file. It says "no suitable backend was > found" >> and if I try to save an xml file, only xml format is available. >> >> >> >> I have built with no options for turning off SQL ie >> >> >> >> Src/CMakeLists.txt: WITH_SQL=ON >> >> >> >> I have the following installed >> >> libdbi-dev 0.9.0-5 >> >> libdbi1 0.9.0-5 >> >> libdbi1-dbg 0.9.0-5 >> >> libdbd-sqlite3 0.9.0-5ubuntu2 >> >> >> >> When I try to debug, it seems to me: >> >> >> >> In gnucash/libgnucash/backend/dbi/gnc-backend-dbi.cpp >> gnc_module_init_backend_dbi() >> >> I can see HAVE_LIBDBI_R is set >> >> >> >> num_drivers = dbi_initialize_r (driver_dir, &dbi_instance); >> >> >> >> returns num_drivers=0 but dbi_instance is no longer null >> so the code exits before any drivers are registered. >> >> >> >> Any suggestions please? >> > > I just built from current master on my Ubuntu-18.04 VM and SQLite3 is > an option in Save As... > > If dpi_initialize_r returns 0 then that function (a libdbi one) didn't > find any drivers to initialize. Make sure that GNC_DBD_DIR isn't set > and in gdb at that dpi_initialize_r call check that driver_dir is 0. > > Check that /usr/lib/x86_64-linux-gnu/dbd/lidbdsqlite3.so and > /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 is present. > > Regards, > John Ralls > > Hi John, > > GNC_DBD_DIR=/ is set in build/etc/gnucash/environment > Commenting that out enables SQLite to work. > > Here are the libraries: > > /usr/lib/x86_64-linux-gnu/dbd/libdbdpgsql.la > /usr/lib/x86_64-linux-gnu/dbd/libdbdsqlite3.so > /usr/lib/x86_64-linux-gnu/dbd/libdbdmysql.la > /usr/lib/x86_64-linux-gnu/dbd/libdbdpgsql.so > /usr/lib/x86_64-linux-gnu/dbd/libdbdsqlite3.la > /usr/lib/x86_64-linux-gnu/dbd/libdbdmysql.so > > /usr/lib/x86_64-linux-gnu/libdbi.so.1.1.0 > /usr/lib/x86_64-linux-gnu/libdbi.a > /usr/lib/x86_64-linux-gnu/libdbi.so.1 > /usr/lib/x86_64-linux-gnu/libdbi.so > > cmake 3.10.2-1ubuntu2.18.04.1 > > I think the " GNC_DBD_DIR=/" line is added to environment file in > src/gnucash/CMakeLists.txt : > > if (LIBDBI_LIBRARY AND LIBDBI_DRIVERS_DIR) > get_filename_component(libdir ${LIBDBI_LIBRARY} > DIRECTORY) > string(FIND ${LIBDBI_DRIVERS_DIR} ${libdir} is_subdir) > if (NOT is_subdir EQUAL 0) > file(APPEND ${BUILD_ENV_FILE_OUT} > "GNC_DBD_DIR=${LIBDBI_DRIVERS_DIR}") > endif() > endif() > > Before I spend too much time trying to fix this, I am running the > build environment from within eclipse. Is SQLite supported while > running from the build or should I "ninja install" and run from there? Chris, It should run from the build directory. Misconfiguring GNC_DBD_DIR is the obvious problem and would break libdbi regardless of whether GnuCash is installed. You found half of the LIBDBI_DRIVERS_DIR code; the other half is in the top-level CMakeLists.txt beginning at line 436 (in master): find_library (LIBDBI_DRIVERS_DIR NAMES dbdmysql dbdpgsql dbdsqlite3 NAMES_PER_DIR PATH_SUFFIXES dbd libdbi-drivers/dbd HINTS LIBDBI_LIBRARY PATHS GNC_DBD_DIR DOC "Libdbi Drivers Directory") If (WITH_SQL) if (NOT LIBDBI_INCLUDE_PATH) message (SEND_ERROR "Include file <dbi/dbi.h> was not found - did you install libdbi0-dev or libdbi-dev?") endif() if (NOT LIBDBI_LIBRARY) message (SEND_ERROR "Library libdbi was not found") endif() set(HAVE_DBI_DBI_H 1) if (NOT LIBDBI_DRIVERS_DIR) message (SEND_ERROR "No libdbi drivers found, SQL tests will fail.") else() get_filename_component(drivers_dir ${LIBDBI_DRIVERS_DIR} DIRECTORY) set(LIBDBI_DRIVERS_DIR ${drivers_dir} CACHE FILEPATH "Directory containing the libdbi driver modules." FORCE) endif() endif() Note that the "found" value of LIBDBI_DRIVERS_DIR gets overwritten in that last phrase so it might be helpful to insert message(INFO "find_library found drivers at $LIBDBI_DRIVERS_DIR") just before the get_filename_component() call. Regards, John Ralls Hi John, The problem is that src/CMakeLists.txt does: set(GNC_DBD_DIR ${CMAKE_PREFIX_LIBDIR}/dbd CACHE PATH "specify location of libdbi drivers") and CMAKE_PREFIX_LIBDIR is null (and not used anywhere else...) I see for mac : file(APPEND ${ENV_FILE_OUT} "GNC_DBD_DIR={SYS_LIB}/dbd\n") but SYS_LIB is not set in Ubuntu. What is the functionality we need to cater for? Just using the system dbd libraries and also possibly a special version of the drivers somewhere in build/lib? Regards, Chris Good _______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel