[GRASS5] [bug #2544] (grass) grass libs built with paths to source tree, not install dir

Request Tracker grass-bugs at intevation.de
Sun Jul 18 14:00:52 EDT 2004


this bug's URL: http://intevation.de/rt/webrt?serial_num=2544
-------------------------------------------------------------------------

Subject: grass libs built with paths to source tree, not install dir

Platform: other
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: CVS 2004-7-17

(This is the way it seems to work on OS X at least. It may affect other platforms as well.)

GRASS 5.7 libraries are built with embedded paths pointing to the source tree.  Everything that is 
linked to these libs points to the source tree instead of the installed libs.  (Not sure if it's an Apple 
thing, but linking to them uses the embedded path/libname instead of where they physically are.)  
This becomes a problem if GDAL is patched to use GRASS 5.7 libs instead of libgrass.

Normally this isn't a big deal - if the source is removed after installation, dyld is smart enough to try 
defined library paths if it can't find libraries in the original location.  But, say the source is built 
inside one's home Documents folder (a reasonable location).  On Mac OS X, a users' home folder has 
read access for everyone, but the Documents subfolder does not.  GRASS runs as the user's ID and 
doesn't have a problem, but MapServer runs as the webserver.  Before dyld has a chance to not find 
the source libs so it can try elsewhere, it fails because it can't get past the Documents folder.


I found some commented lines in configure to use as a starting point to add a few needed darwin 
options to fix this - darwin needs -install_name (at least), and -compatibility_version and 
-current_version (may be optional, don't know).  I ended up with:

SHLIB_LD="cc -dynamiclib -Wl,-flat_namespace,-U,_cuserid -undefined suppress 
-compatibility_version 5.7 -current_version 5.7 -install_name \${LIB_RUNTIME_DIR}/
lib\${LIB_NAME}\${SHLIB_SUFFIX} \${LDFLAGS}"

It seems GRASS_SHLIB_LD_EXTRAS isn't used, so I had to put it all in SHLIB_LD.  This builds the libs 
with the correct embedded paths (and the patched GDAL, after rebuilding, is happy).  It works, but I 
don't know enough to say that this is the right way to do it.  I hard-coded the version numbers 
because with the CVS version, the command that creates the LIB_VER var ends up with '5.7.', and the 
version options don't like that trailing '.' (and I don't know enough about sed to fix LIB_VER).

A side note on the linking options - undefined-suppress disables prebind, so prebind could be 
removed from LDFLAGS.  Harmless warnings otherwise, no big deal.

-------------------------------------------- Managed by Request Tracker




More information about the grass-dev mailing list