> -----Original Message-----
> From: Geert Janssens <geert.gnuc...@kobaltwit.be>
> Sent: Sunday, 10 June 2018 8:16 PM
> To: gnucash-devel@gnucash.org
> Cc: Chris Good <goodchri...@gmail.com>; 'John Ralls' <jra...@ceridwen.us>
> Subject: Re: [GNC-dev] GnuCash 3 on Linux
> 
> Op zondag 10 juni 2018 11:07:36 CEST schreef Chris Good:
> > > -----Original Message-----
> > > From: John Ralls <jra...@ceridwen.us>
> > > Sent: Sunday, 10 June 2018 6:13 AM
> > > To: Chris Good <goodchri...@gmail.com>
> > > Cc: gnucash-devel@gnucash.org
> > > Subject: Re: [GNC-dev] GnuCash 3 on Linux
> > >
> > > > On 9. Jun 2018, at 00:17, Chris Good <goodchri...@gmail.com> wrote:
> > > >
> > > > Hi John,
> > > >
> > > > Thanks very much for your help.
> > > > A little more please...
> > > >
> > > > On my Ubuntu 16.04:
> > > >
> > > > sudo apt-get update -qq
> > > > sudo apt-get build-dep -qq gnucash > /dev/null sudo apt-get
> > > > install -qq git bash-completion cmake make swig xsltproc
> > > > libdbd-sqlite3 texinfo ninja-build libboost-all-dev libgtk-3-dev
> > > > libwebkit2gtk-3.0-dev > /dev/null sudo apt-get --reinstall install
> > > > -qq language-pack-en language-pack-fr cd /home/cgood/github git
> > > > clone https://github.com/google/googletest -b release-1.8.0 gtest
> > > > (created
> > > > /home/cgood/github/gtest)
> > > >
> > > > cd /home/cgood/github/gnucash-maint git checkout maint git pull
> > > > --rebase upstream maint git push origin maint
> > > >
> > > > /home/cgood/github/gnucash-maint/README.dependencies :
> > > >         guile           2.2.0 or 2.0.0
> > > >         googletest          1.7.0
> > > >
> > > > As 'make uninstall' didn't work from my 2.6.21 git repo:
> > > >  cd /home/cgood/github/gnucash-maint-install
> > > >  rm -r *
> > > >
> > > > cd /home/cgood/github/gnucash-maint-build
> > > > rm -r *
> > > > cmake -G Ninja -D
> > > > CMAKE_INSTALL_PREFIX=$HOME/github/gnucash-maint-install -D
> > >
> > > WITH_AQBANKING=OFF \
> > >
> > > >   -D WITH_OFX=OFF -DGTEST_ROOT=$HOME/github/gtest/googletest
> > > >
> > > > -DGMOCK_ROOT=$HOME/cgood/github/gtest/googlemock \
> > > >
> > > >   ../gnucash-maint
> > > >
> > > > ninja
> > > > [5/892] Generating ../../lib/gnucash/scm/ccache/2.0/json.go
> > > > wrote
> > > > `/home/cgood/github/gnucash-maint-
> > >
> > > build/lib/gnucash/scm/ccache/2.0/json.go'
> > >
> > > > [22/892] Generating
> > > > ../../../lib/gnucash/scm/ccache/2.0/json/syntax.go
> > > > wrote
> > > > `/home/cgood/github/gnucash-maint-build/lib/gnucash/scm/ccache/2.0
> > > > /jso
> > > > n/synt
> > > > ax.go'
> > > > [25/892] Generating
> > > > ../../../lib/gnucash/scm/ccache/2.0/json/parser.go
> > > > wrote
> > > > `/home/cgood/github/gnucash-maint-build/lib/gnucash/scm/ccache/2.0
> > > > /jso
> > > > n/pars
> > > > er.go'
> > > > [28/892] Generating
> > > > ../../../lib/gnucash/scm/ccache/2.0/json/builder.go
> > > > wrote
> > > > `/home/cgood/github/gnucash-maint-build/lib/gnucash/scm/ccache/2.0
> > > > /jso
> > > > n/buil
> > > > der.go'
> > > > [120/892] Building CXX object
> > > > common/test-core/CMakeFiles/gtest.dir/home/cgood/github/gtest/goog
> > > > lete
> > > > st/src
> > > > /gtest-all.cc.o
> > > > FAILED: /usr/bin/c++   -DHAVE_CONFIG_H -DHAVE_GUILE20 -Icommon
> > > > -I/home/cgood/github/gnucash-maint/common
> > > > -I/home/cgood/github/gnucash-maint/libgnucash/engine
> > > > -I/home/cgood/github/gnucash-maint/common/test-core
> > > > -I/usr/include/glib-2.0
> > > > -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> > > > -I/usr/include/guile/2.0 -I/home/cgood/github/gtest/googletest
> > > > -Werror -
> > >
> > > Wall -Wmissing-declarations
> > >
> > > > -Wno-unused -Wno-error=parentheses -std=gnu++11    -Wno-missing-
> > >
> > > declarations
> > >
> > > > -MMD -MT
> > > > common/test-core/CMakeFiles/gtest.dir/home/cgood/github/gtest/goog
> > > > lete
> > > > st/src
> > > > /gtest-all.cc.o -MF
> > > > common/test-core/CMakeFiles/gtest.dir/home/cgood/github/gtest/goog
> > > > lete
> > > > st/src
> > > > /gtest-all.cc.o.d -o
> > > > common/test-core/CMakeFiles/gtest.dir/home/cgood/github/gtest/goog
> > > > lete
> > > > st/src /gtest-all.cc.o -c
> > > > /home/cgood/github/gtest/googletest/src/gtest-all.cc
> > > > In file included from
> > > > /home/cgood/github/gtest/googletest/src/gtest-all.cc:42:0:
> > > > /home/cgood/github/gtest/googletest/src/gtest.cc:35:41: fatal error:
> > > > gtest/internal/custom/gtest.h: No such file or directory
> > > > compilation terminated.
> > > > [120/892] Building CXX object
> > > > common/test-
> > >
> > > core/CMakeFiles/gmock.dir/home/cgood/github/gtest/googlemo
> > >
> > > > ck/src
> > > > /gmock-all.cc.o
> > > > FAILED: /usr/bin/c++   -DHAVE_CONFIG_H -DHAVE_GUILE20 -Icommon
> > > > -I/home/cgood/github/gnucash-maint/common
> > > > -I/home/cgood/github/gnucash-maint/libgnucash/engine
> > > > -I/home/cgood/github/gnucash-maint/common/test-core
> > > > -I/usr/include/glib-2.0
> > > > -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> > > > -I/usr/include/guile/2.0 -I/home/cgood/github/gtest/googletest
> > > > -I/home/cgood/github/gtest/googlemock
> > > > -Werror -Wall -Wmissing-declarations -Wno-unused -Wno-
> error=parentheses
> > > > -std=gnu++11    -Wno-missing-declarations -MMD -MT
> > > > common/test-
> > >
> > > core/CMakeFiles/gmock.dir/home/cgood/github/gtest/googlemo
> > >
> > > > ck/src
> > > > /gmock-all.cc.o -MF
> > > > common/test-
> > >
> > > core/CMakeFiles/gmock.dir/home/cgood/github/gtest/googlemo
> > >
> > > > ck/src
> > > > /gmock-all.cc.o.d -o
> > > > common/test-
> > >
> > > core/CMakeFiles/gmock.dir/home/cgood/github/gtest/googlemo
> > >
> > > > ck/src /gmock-all.cc.o -c
> > > > /home/cgood/github/gtest/googlemock/src/gmock-all.cc
> > > > In file included from
> > > > /home/cgood/github/gtest/googlemock/src/gmock-all.cc:46:0:
> > >
> > > > /home/cgood/github/gtest/googlemock/src/gmock-spec-
> builders.cc:339:1:
> > > error:
> > > > prototype for 'testing::internal::UntypedActionResultHolderBase*
> > > > testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(co
> > > > nst void*)' does not match any in class
> > > > 'testing::internal::UntypedFunctionMockerBase'
> > > > UntypedFunctionMockerBase::UntypedInvokeWith(const void* const
> > > > untyped_args)
> > > > ^
> > > > In file included from
> > > > /usr/include/gmock/gmock-generated-function-mockers.h:43:0,
> > > >
> > > >                 from /usr/include/gmock/gmock.h:61,
> > > >                 from
> > > >
> > > > /home/cgood/github/gtest/googlemock/src/gmock-all.cc:40:
> > > > /usr/include/gmock/gmock-spec-builders.h:214:40: error: candidate
is:
> > > > const
> > > > testing::internal::UntypedActionResultHolderBase*
> > > > testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith(co
> > > > nst
> > >
> > > void*)
> > >
> > > >   const UntypedActionResultHolderBase* UntypedInvokeWith(
> > > >
> > > >                                        ^
> > > >
> > > > ninja: build stopped: subcommand failed.
> > > >
> > > > find ../gtest -name gtest.h
> > > > ../gtest/googletest/include/gtest/internal/custom/gtest.h
> > > > ../gtest/googletest/include/gtest/gtest.h
> > >
> > > Chris,
> > >
> > > There's an include argument missing from the compile instructions:
> > >   -I/home/cgood/github/gtest/googletest/include
> > >
> > > Grep CMakeCache.txt for GTEST_INCLUDE_DIR. It should return
> > >
> > >   GTEST_INCLUDE_DIR:PATH=/home/cgood/github/gtest/googletest/include
> > >
> > > GTEST_INCLUDE_DIR is passed to target_include_directories() at
> >
> > common/test-
> >
> > > core/CMakeLists.txt line 79.
> > >
> > > If GTEST_INCLUDE_DIR isn't set cmake should fail, complaining that
> > > it
> >
> > can't find
> >
> > > googletest. You'll need to examine the CMake logs to see why it's
> > > not
> >
> > getting
> >
> > > included.
> > >
> > > Regards,
> > > John Ralls
> >
> > Hi John,
> >
> > Thanks very much for your help which got me on the right direction (I
> > haven't tried to fix a problem with cmake or ninja before).
> >
> > I couldn't find anything in the cmake logs
> > (gnucash-maint-build/CMakeFiles/[CMakeError.log|CMakeOutput.log])
> > about GTEST or gtest but I found:
> > gnucash-maint/common/cmake_modules/GncAddTest.cmake:
> >
> >   find_path(GTEST_INCLUDE_DIR gtest/gtest.h
> >     PATHS ${GTEST_ROOT}/include ${GMOCK_ROOT}/gtest/include
> > /usr/include)
> >
> > grep GTEST_INCLUDE_DIR CMakeCache.txt shows:
> >   GTEST_INCLUDE_DIR:PATH=/usr/include
> >
> > So somehow cmake find_path is not finding
> > $GTEST_ROOT/include/gtest/gtest.h (which does exist), but
> > /usr/include/gtest/gtest.h which is version
> > 1.7.0-4ubuntu1
> > which I installed following instructions at
> > https://wiki.gnucash.org/wiki/BuildUbuntu16.04#GnucCash_Dependencies.
> >
> > There is no /usr/include/gtest/internal/custom/gtest.h.
> >
> > As no packages depend on google-mock or libgtest-dev on my system, I
> > have uninstalled them, and now cmake finds the correct gtest headers
> > and I have successfully built gnucash.
> >
> > Shouldn't cmake (3.5.1-1ubuntu1) find_path() have tried to use the
> > first path (using GTEST_ROOT)?
> > The documentation
> > https://cmake.org/cmake/help/v3.5/command/find_path.html?highlight=fin
> > d_path doesn't specifically say that but it seems logical to me.
> >
> According to the page you link to system paths are searched before
directories
> added via PATHS. Considering we base our search on parameters already set
> (GTEST_ROOT and GMOCK_ROOT) we probably should use HINTS instead of
> PATHS as directories specified with HINTS take precedence over system
paths.
> 
> Can you run this experiment ? That is
> - change PATHS to HINTS in the line above and the other find_path calls
further
> down the macro
> - reinstall gtest 1.7.0
> - rerun ninja
> - verify it still finds your correct local googletest instead of the
system installed
> one.
> 
> Geert
> 

Hi Geert,

Good catch!
Using HINTS instead of PATHS correctly sets GTEST_INCLUDE_DIR &
GMOCK_INCLUDE_DIR
to the local install instead of the system /usr/include paths.

I've got a maint branch to fix this. Shall I do a PR?
There are no other instances like this of PATHS being used in other .cmake
files in common/cmake_modules.
Shall I look for other instances of PATHS being used where the system path
is the last option, in all other directories, and include those in the PR?

Regards, Chris Good

_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to