Recent lib changes

John Ralls jralls at ceridwen.us
Sun Dec 3 10:17:20 EST 2017


Bob,

We added “import(GNUInstallDirs)” to CMakeLists.txt and then went through and changed all of the hard-coded installation directories (e.g. ${CMAKE_INSTALL_PREFIX}/lib to ${CMAKE_INSTALL_LIBDIR} so that GnuCash would install stuff in the right places for the Debian packager. It works for him, we haven’t heard from any of the others yet.

The GNUInstallDirs module automates the directories a bit more than autotools; typically in autotools if you want libdir to be /usr/lib64 (or on Debian, /usr/lib/x86_64-linux-gnu) you tell configure that with --libdir /usr/lib64. GNUInsalldirs figures out somehow what distro you’re running and sets up the defaults for what it thinks are that distro’s rules. If you want something different you pass e.g. -DCMAKE_INSTALL_LIBDIR=/usr/lib to cmake… but I think we need modify the top-level  CMakeLists.txt to enable that.

core-utils/binreloc.c had hard-coded directory names of bin, lib, etc, and share relative to the prefix it detects by finding the executable’s path. Rob Gowin fixed lib on Friday but the rest need to be changed to use the paths from gncla-dir.h; that’s the source of your /usr/etc/gnucash problem and yes, that’s a long-standing error: There isn’t supposed to be a /usr/etc [1].

I think your change to CMAKE_INSTALL_RPATH is correct; ${PKGLIBDIR} is a relative path that doesn’t belong in the executable’s rpath.

Regards,
John Ralls

[1] http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/usr.html <http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/usr.html>

> On Dec 3, 2017, at 4:51 AM, Robert Fewell <14ubobit at gmail.com> wrote:
> 
> Just a follow up, the VM I was using with a checkout before the changes at
> some point a /usr/etc/gnucash directory was created and hence works. If I
> rename the directory I get the same in the VM with an up to date checkout
> of unstable that does not have this directory but /etc/gnucash.
> 
> I am confused !!!
> 
> Bob
> 
> On 3 December 2017 at 12:10, Robert Fewell <14ubobit at gmail.com> wrote:
> 
>> Hi,
>> 
>> I see there have been a lot of changes regarding lib directories and I am
>> wondering if the overall effect is I should be able to compile/build just
>> like I used to with out changing any thing because I can't.
>> 
>> The first problem is that I build on Gentoo and occasionally try to build
>> from a local package / ebuild and as part of this scanelf is used which is
>> now reporting a possible security problem with DT_RUNPATH
>> 
>> Prior to the changes it showed RPATH to be /usr/lib:/usr/lib/gnucash but
>> now it is /usr/lib64:lib64/gnucash. I can fix this by changing line 501 of
>> CMakeLists.txt to the following...
>> 
>>  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}:
>> ${CMAKE_INSTALL_FULL_LIBDIR}/gnucash")
>> 
>> If it is just Gentoo specific, I will just patch it locally.
>> 
>> The main problem is that it will not run because it can not find the
>> gnc-modules, after some poking around, the enviroment file is not being
>> found and so does not set GNC_MODULE_PATH.
>> 
>> In gnc-enviroment.c, line 197,  gnc_path_get_pkgsysconfdir returns
>> /usr/etc/gnucash which comes from binreloc.c, line 606, with prefix being
>> /usr
>> 
>> The strange thing is that I get the same values for before these changes
>> were made, was this ever correct ?
>> 
>> How to fix ?
>> 
>> Regards,
>> 
>> Bob
>> 
>> 
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel



More information about the gnucash-devel mailing list