[Mono-dev] Library path bug in Makefile?
Edward Ned Harvey (mono)
edward.harvey.mono at clevertrove.com
Thu Mar 6 02:09:45 UTC 2014
> From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-
> bounces at lists.ximian.com] On Behalf Of Robert Jordan
> Non-default Mono installations still need LD_LIBRARY_PATH, otherwise
> p/invoke of Mono libraries (libgdiplus, libMonoPosixHelper) won't
> work because p/invoke is obeying the CLR rules of library look-up
> that know nothing about ELF RPATH attributes.
If you install packages that depend on mono with the package manager (yum, apt, whatever) they will be dependent on the packaged version of mono (emphasis on "packaged version"), because the dependent packages were built linking against that particular build of mono in that particular location. You won't be able to install such dependent packages, unless you *also* install the packaged version of mono. (And you'll consequently be limited to whatever version of mono is available in that OS distribution, which I've mentioned, is 2.4.3 for RHEL/Centos, and 2.10.8 for Ubuntu 1204 LTS).
If you build mono from source, intending to actually use it and not install the old distribution package, then of course you won't be able to use the dependent packages from the package manager - you'll have to also build the dependent packages from source if you want them. In which case, the dependent package ./configure script won't be able to find mono, they'll complain and ask you to specify ./configure --mono-path=PATH
> Moreover, things like pkg-config need to be configured as well,
> because they also know nothing about mono's executable RPATH.
Isn't this relevant only when/if building a packaged version of something dependent on the mono package?
One thing here I'll definitely agree with: It is best to manage packages with a package manager. Roll your own mono-3.2.6 rpm or deb file, and later, roll your own mono-3.2.8, and "rpm update" or "deb update." But I have to say, learning to roll your own packages is difficult. Building from source is easy. (At least for mono.)
> The only thing you'd achieve by setting the RPATH attribute:
> you won't be able to safely relocate Mono anymore, as RPATH
> takes precedence over LD_LIBRARY_PATH.
So ... http://blog.tremily.us/posts/rpath/
I wasn't talking about setting RPATH. I was talking about setting RUN_PATH. Which you could override, if you wanted to, by setting the LD_LIBRARY_PATH.
Also, what do you mean "relocate?" It seems, without setting it, you're expected to never relocate to any location other than the system root. (/lib, /usr/lib, /usr/local/lib).
The thing that would be achieved by setting the RUN_PATH of the mono executable is that mono itself would be able to run without problem.
If you build mono with --prefix=PATH, then you can safely assume, the mono binary installed in PATH/bin will require the libraries in PATH/lib.
If a user adds PATH to their PATH, it would be desirable that they could simply run mono without it failing. Or, if they specify on the command line, /PATH/bin/mono, then again, it would be desirable for mono to be able to run without failing.
More information about the Mono-devel-list