[Mrtrix-discussion] Re: MRtrix library path
Clayden, Jonathan
j.clayden at ucl.ac.uk
Wed Aug 1 04:09:39 PDT 2012
Hi Donald,
Thanks. I guess I'm being awkward by preferring to run the binaries from the place they're compiled. Of course, your answer suggests a route which I really should have thought of, which is to manually symlink the dylib into /usr/lib or /usr/local/lib, and that works fine.
However, FWIW, I've managed to get the binaries to link to the library using its full path using the following patch to the build script:
@@ -111,7 +111,9 @@ Acceptable options are:
# check if we are compiling a separate project:
mrtrix_dir = os.path.dirname (os.path.realpath(sys.argv[0]))
-if os.path.abspath(mrtrix_dir) == os.path.abspath(os.getcwd()): mrtrix_dir = None
+if os.path.abspath(mrtrix_dir) == os.path.abspath(os.getcwd()):
+ lib_dir = os.path.join (mrtrix_dir, lib_dir)
+ mrtrix_dir = None
else:
if verbose:
print 'compiling separate project against "' + mrtrix_dir + '"'
I doubt this is an OS X specific issue, so I'm copying to the mailing list for posterity.
All the best,
Jon
On 1 Aug 2012, at 06:33, Donald Tournier <d.tournier at brain.org.au> wrote:
> Hi Jon,
>
> Not a lot of experience with MacOS I'm afraid, so can only make vague suggestions. My first suggestion would to install the executables using the "./build install" command (as root). This will place your executables and library into the /opt/mrtrix folder, and symbolic links to these into /usr/bin and /usr/lib respectively. Although this is really geared for a Unix install, as far as I can tell, these paths will be appropriate for MacOSX as well. You can tune either of these paths using a couple of options, as described here:
> http://www.brain.org.au/software/mrtrix/install/unix.html#install
>
> I'm guessing this way, you won't have to stuff around setting paths and library paths - which is the reason I eventually decided to add this feature to the install in the first place...
>
> If that still doesn't work, I'd recommend you post your question on the mailing list anyway. There's a few Mac users out there who'll be monitoring it, so they might be able to help - not to mention the added benefit to future Mac users (and hence myself) of having that particular problem discussed and archived on the mailing list. ;)
>
> Hope that helps.
> Cheers,
>
> Donald.
>
>
> On 1 August 2012 01:13, Clayden, Jonathan <j.clayden at ucl.ac.uk> wrote:
> Hi Donald,
>
> I hope all is well with you. Catching any of the Olympics?
>
> I have a technical query/request for MRtrix which I thought might be too esoteric for the mailing list, so I hope you don't mind me getting in touch directly. (Feel free to copy any response to the mailing list if you see fit.)
>
> It seems that MRtrix links its library to the binaries using a relative rather than absolute path:
>
> $ otool -L ~/git/mrtrix/bin/mrinfo
> /Users/jon/git/mrtrix/bin/mrinfo:
> lib/libmrtrix-0_2_10.dylib (compatibility version 0.0.0, current version 0.0.0)
> /usr/local/lib/libgsl.0.dylib (compatibility version 17.0.0, current version 17.0.0)
> /usr/local/lib/libgslcblas.0.dylib (compatibility version 1.0.0, current version 1.0.0)
> /usr/local/lib/libglibmm-2.4.1.dylib (compatibility version 5.0.0, current version 5.0.0)
> /usr/local/lib/libgobject-2.0.0.dylib (compatibility version 3201.0.0, current version 3201.1.0)
> /usr/local/lib/libsigc-2.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
> /usr/local/lib/libgthread-2.0.0.dylib (compatibility version 3201.0.0, current version 3201.1.0)
> /usr/local/lib/libglib-2.0.0.dylib (compatibility version 3201.0.0, current version 3201.1.0)
> /usr/local/Cellar/gettext/0.18.1.1/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.1.0)
> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
>
> The practical upshot of this is that the binaries can't be run from outside the MRtrix directory...
>
> $ mrinfo
> dyld: Library not loaded: lib/libmrtrix-0_2_10.dylib
> Referenced from: /Users/jon/git/mrtrix/bin/mrinfo
> Reason: image not found
>
> ... unless I explicitly set DYLD_LIBRARY_PATH. I've done that in the past, and it has had the desired effect, but in the new release of OS X it has started to pester about setting DYLD_* variables, which is becoming a bit of a nuisance (cf [1]).
>
> So I was wondering whether (a) there is another way around this, or (b) there is a tweak I can make to the build script so that the binaries are linked against the dylib using its full path.
>
> Thanks in advance.
>
> All the best,
> Jon
>
> --
> [1] http://lightyearsoftware.com/2011/02/mysql-5-5-on-mac-os-x/
>
>
>
>
>
>
> --
> Jacques-Donald Tournier (PhD)
> Brain Research Institute, Melbourne, Australia
> Tel: +61 (0)3 9035 7033
More information about the Mrtrix-discussion
mailing list