[Mono-dev] ELF runtime path and P/Invoke

Andreas Färber andreas.faerber at web.de
Thu Jan 17 17:59:08 EST 2008


Is there a reason not to add $libdir (i.e. $prefix/lib) to the ELF  
runtime path for Mono?

On Solaris the use of their -R option is being favored over the use of  
LD_LIBRARY_PATH in several articles. I thus filed this patch:

Zoltan pointed out that changing this only for Solaris would create an  
inconsistency among the supported platforms. So while testing this  
some more, I found that this feature is not limited to Solaris (-R),  
IRIX and some other, uncommon Unix I can't remember right now (both - 
rpath): Apparently GNU ld on Linux can do the same via -Wl,-rpath.  
Mono is not using this feature, so is there a special reason for not  
doing so?

For me the use of -R/opt/mono/lib makes adding a system-wide  
MonoDevelop .desktop menu item work without going through a custom  
shell script or profile scripts for each user that sets  
LD_LIBRARY_PATH appropriately. libtool does take care to embed the  
runtime path to linked libraries such as an external Boehm GC but it  
doesn't embed paths to libraries only referred to by p/invokes, such  
as libMonoPosixHelper or libgdiplus. Being built inside the mono tree,  
at least libMonoPosixHelper will always end up in Mono's $libdir and  
benefit from this change.

The three options I see are:
1) Leave configure.in as it is and let the user add LDFLAGS when  
2) Modify configure.in to enhance the runtime path only on Solaris.
3) Modify configure.in to do it for as many platforms as possible.


More information about the Mono-devel-list mailing list