[Mono-list] How to detect which version of Mono a library is compiled with?
IBBoard
ibboard at gmail.com
Wed May 16 19:53:58 UTC 2012
On 16/05/12 19:23, Jonathan Pryor wrote:
> On May 11, 2012, at 2:54 PM, IBBoard wrote:
>> What I want is a less hack-ish run script (currently using Bash). The proper way to do it is to check for features rather than string matching and version checking (which caused lots of JavaScript issues with people doing IE version checks badly). Is there a way to probe the profile that a Mono library was compiled with from Bash, without the ...-dev package being installed?
>
> `monodis --assemblyref` will tell you which assemblies an assembly references, including version numbers, but (1) I don't know if monodis is in a -dev package or not (I imagine it is), and (2) I'm not sure that would actually help you, as you'd need to "somehow" find an assembly to run monodis against. Running it against your app won't help -- you know it's a 2.0 app -- so you'd presumably want System.dll or gtk-sharp.dll or something, and how do you find the appropriate path for _that_?
>
> I'd suggest a different hack:
>
> bindir=$(dirname `which mono`)
> if [ -d "$bindir/../lib/mono/2.0" ]; then
> # you have the 2.0 runtime...
> else
> # you don't; try for the 4.0 runtime and use `mono --runtime`...
> fi
>
> You may also need to check for lib64 in addition to lib (iirc Fedora likes lib64).
>
> In general, if $prefix/lib/mono/2.0 exists, then the 2.0 profile exists.
>
> - Jon
>
>
I've just checked on openSUSE and monodis is provided by mono-devel, so
unfortunately not everyone would have that (even if I could work out how
to reliably check the gtk-sharp.dll!)
I'll look at checking profiles or something similar, but I'm not sure
that'll work - I've got 4.0 on openSUSE but using 2.0 works, and you can
install 2.0 on Ubuntu, you just don't seem to be able to use any
libraries outside of core.
Looking at the contents of gtk-sharp2 on openSUSE (rpm -q --filesbypkg
gtk-sharp2), I can see .pc files, but a) I'm not sure there is anything
specific enough to be useful in them and b) might other distros ship
them in -devel packages?
I feel like there should be a neater solution here - a way to check
dependencies without just falling over in an ugly heap - but maybe there
are just too many uncertainties and inconsistencies.
Thanks.
More information about the Mono-list
mailing list