GNC_MODULE_PATH loaded twice

John Ralls jralls at ceridwen.us
Mon Oct 11 16:02:16 EDT 2010


On Oct 11, 2010, at 12:02 PM, Geert Janssens wrote:

> On Monday 11 October 2010, John Ralls wrote:
>> On Oct 11, 2010, at 3:11 AM, Geert Janssens wrote:
>>> I've been doing some code reading in the gnc_module code.
>>> 
>>> I've found that at some point the paths in environment variable
>>> GNC_MODULE_PATH are appended to the environment variable LD_LIBRARY_PATH.
>>> This happens somewhere early in the gnc_module initialization [1].
>>> 
>>> However at the time the gnc_module code is run GNC_MODULE_PATH has
>>> already been added to LD_LIBRARY_PATH. On linux and compatibles this
>>> happens as a result of parsing the environment configuration file [2].
>>> Mac OS X/Quartz uses gnucash-launcher (if built from source) or the
>>> startup script inside the bundle. The Windows build currently doesn't
>>> even use GNC_MODULE_PATH anymore.
>>> 
>>> I guess the code in gnc_module is from the early days, when GnuCash only
>>> ran on linux. But I don't think it has any effect anymore. At least OS X
>>> and Windows don't use LD_LIBRARY_PATH to find shared libraries and in all
>>> cases the proper variables have been set up already.
>>> 
>>> So unless I am overlooking something, I'd like to remove the
>>> LD_LIBRARY_PATH modifying code from gnc_module altogether. To keep things
>>> simple.
>>> 
>>> Any objections ?
>> 
>> None from me. I'd think that having more than one place to look for
>> gnucash's loadable modules would slow things down and potentially cause
>> trouble (like what Dave Reiser is experiencing). (DY)LD_LIBRARY_PATH is
>> for loading shared libraries... which might be pulled in by a loadable
>> module, of course, but the shared libraries should live in lib, while the
>> loadables should live in lib/foo (lib/gnucash in our case).
>> 
> You even imply more than I intended. If I understand your reasoning correctly, 
> (DY)LD_LIBRARY_PATH should contain paths for shared libraries only, while 
> GnuCash' loadable modules should be in a directory that's NOT in 
> (DY)LD_LIBRARY_PATH.
> GnuCash effectively has all of its loadable modules in lib/gnucash. This is 
> what GNC_MODULE_PATH is set to by default.
> So to follow your reasoning, GNC_MODULE_PATH should not even be added to 
> (DY)LD_LIBRARY_PATH ever ? Not in the gnc_module code, nor in the launcher 
> scripts ?

Since gnc-modules.c does it's own search of GNC_MODULE_PATH, there should be no reason to add it to LD_LIBRARY_PATH.

(I went a bit overboard in my earlier letter. I should have checked the manpage first: dlopen will search LD_LIBRARY_PATH if it's given a filename with no file separators in it, so there's a case for using it in other programs that don't have their own search mechanism.)

Regards,
John Ralls


More information about the gnucash-devel mailing list