[MINC-users] minc tools crash in matlab

Alex Zijdenbos alex at bic.mni.mcgill.ca
Wed Feb 24 09:38:53 EST 2010


Hi Pierre,

What does matlab need netcdf for? You may want to try to make matlab
use the netcdf lib that you want, by putting a symlink in place of
matlab's netcdf lib pointing to /usr/local/libnetcdf.so.4. A bit of a
crude hack but hey, it might work :)

-- A

On Wed, Feb 24, 2010 at 8:46 AM, Pierre Bellec
<pbellec at bic.mni.mcgill.ca> wrote:
> Hi everyone,
>
> Here's an update on the crash of minc tools when used through matlab R2009b.
> First, as Alex pointed out, I had an outdated version of the minc tools that
> had not been cleaned up by installing the mincbundle package. After manually
> deleting the minctools package, I got :
>
> $ mincinfo -version
> program: 2.0.17
> libminc: 2.0.17
>
> netcdf : "3.6.2" of Feb  8 2008 16:40:20 $
> HDF5   : 1.6.5
>
> Unfortunately, mincinfo still crashed when called through matlab.
>
>>> system('mincinfo -help')
> mincinfo: symbol lookup error: mincinfo: undefined symbol: ncopts
>
> Claude found out what the problem is. The mincbundle package has been
> compiled dynamically and relies on the NETCDF libraries
>
> $  ldd /usr/local/bic/bin/mincinfo
>    linux-gate.so.1 =>  (0xb7ee8000)
>    libhdf5-1.6.5.so.0 => /usr/lib/libhdf5-1.6.5.so.0 (0xb7daa000)
>    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.
> so.0 (0xb7d92000)
>    libz.so.1 => /usr/lib/libz.so.1 (0xb7d7c000)
>    *libnetcdf.so.4 => /usr/lib/libnetcdf.so.4 (0xb7d4a000)*
>    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7d25000)
>    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7bd6000)
>    /lib/ld-linux.so.2 (0xb7ee9000)
>
> However, matlab comes with its own NETCDF library, and puts them first in
> the LD_LIBRARY_PATH.
>
>>> system('ldd /usr/local/bic/bin/mincinfo')
>    linux-gate.so.1 =>  (0xb7f51000)
>    libhdf5-1.6.5.so.0 => /usr/lib/libhdf5-1.6.5.so.0 (0xb7e13000)
>    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7dfa000)
>    libz.so.1 => /usr/lib/libz.so.1 (0xb7de5000)
>    *libnetcdf.so.4 => /usr/local/matlabR2009b/bin/**glnx86/libnetcdf.so.4
> (0xb7da9000)*
>    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7d84000)
>    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c35000)
>    /lib/ld-linux.so.2 (0xb7f52000)
>
> There is obviously an incompatibility between the version of NETCDF that's
> bundled with matlab and the one assumed by mincbundle. The mincbundle
> package may be perfectly correct, but in any case the matlab installer is
> just an archive and does not check on compatibility or whatever ... it just
> crashes my minc tools ! Now if I change the environment variables in the
> matlab call I can force mincinfo to use the right libraries :
>
>>> system('export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH; mincinfo')
> Usage: mincinfo [<options>] <mincfile> [<mincfile> ...]
>       mincinfo -help
>
> Replacing all system calls to MINC tool in NIAK by this kind of hack is
> obviously not an option. As matlab does reinitialize the environment
> variables at each system call, I don't see how to apply that change once and
> for all to any system call. In other words, the following strategy won't
> work :
>>>  system('export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH;');
>>>  system('mincinfo -help')
> mincinfo: symbol lookup error: mincinfo: undefined symbol: ncopts
>
> Changing the .bashrc won't work as well (because matlab forces its library
> to be first). The only practical solution I have at this stage is to keep
> using a static compilation of the minc tools. This will work for the time
> being because I have access to the CIVET quarantine but it won't apply to a
> random user. Please let me know if one of you guys can think of a better
> solution for the future.
>
> Cheers,
>
> Pierre
>
> Date: Sun, 21 Feb 2010 01:00:23 -0500
>> From: Alex Zijdenbos <alex at bic.mni.mcgill.ca>
>> Subject: Re: [MINC-users] minc tools crash in matlab
>> To: MINC users mailing list <minc-users at bic.mni.mcgill.ca>
>> Message-ID:
>>        <e758a6651002202200g2c41a678g61b12af585490f23 at mail.gmail.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> Hi Pierre,
>>
>> As far as I know, 'mincbundle' for Hardy contains (at least) 2.0.17,
>> and installs in /usr/local/bic, not /usr as your error message
>> suggests. I suspect you may have also installed the minc-tools package
>> which lives in the Hardy repositories, but which is rather
>> outdated/obsolete. See what happens if you run 'apt-get remove
>> libminc2-1'.
>>
>> -- Alex
>>
>> On Sat, Feb 20, 2010 at 5:59 PM, Claude LEPAGE <claude at bic.mni.mcgill.ca>
>> wrote:
>> > Pierre,
>> >
>> > I don't know how this mincbundle was created, but it looks
>> > like it's looking for dynamic libraries (.so). Add the path
>> > of libminc2.so.1 (should be somewhere in your mincbundle)
>> > to LD_LIBRARY_PATH environment variable.
>> >
>> > Also, this mincbundle is old. minc 2.0.14. This will not
>> > work well with your fmri studies.
>> >
>> > Claude
>> - Afficher le texte des messages précédents -
>>
>> >
>> >
>> >> I just installed the "mincbundle" package on my laptop (with ubuntu
>> hardy).
>> >> The installation went smoothly and everything I tried so far in the
>> shell
>> >> worked just fine. Unfortunately, when I start Matlab (7.9.0, R2009b) and
>> try
>> >> to use the minc tools via system calls I get an error :
>> >>
>> >> >> ! mincinfo anat_subject1.mnc.gz
>> >> mincinfo: symbol lookup error: /usr/lib/libminc2.so.1: undefined symbol:
>> >> ncerr
>> >>
>> >> In a shell, the "mincinfo -version" gives :
>> >>
>> >> program: 2.0.14
>> >> libminc: 2.0.14
>> >> netcdf : "3.6.2" of Feb ?8 2008 16:40:20 $
>> >> HDF5 ? : 1.6.5
>> >>
>> >> >From Octave everything works fine. If I source the CIVET quarantine
>> >> "Feb-14-2008", I don't get any error in matlab.
>> >>
>> >> Any thoughts about how to fix that ?
>> >>
>> >> Pierre
>> >>
>> >> --
>> >> Pierre Bellec
>> >> Post-doctoral fellow
>> >> McConnel Brain Imaging Center, Webster 2B
>> >> Montreal Neurological Institute
>> >> 3801 University Street
>> >> Montreal, Quebec, Canada H3A 2B4
>> >> http://wiki.bic.mni.mcgill.ca/index.php/PierreBellec
>> >> tel: ? ? ? (001)(514) 398 5220
>> >> fax: ? ? ?(001)(514) 398 8948
>> >> _______________________________________________
>> >> MINC-users at bic.mni.mcgill.ca
>> >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>> >>
>> > _______________________________________________
>> > MINC-users at bic.mni.mcgill.ca
>> > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>> >
>> >
>>
>>
>
> --
> Pierre Bellec
> Post-doctoral fellow
> McConnel Brain Imaging Center, Webster 2B
> Montreal Neurological Institute
> 3801 University Street
> Montreal, Quebec, Canada H3A 2B4
> http://wiki.bic.mni.mcgill.ca/index.php/PierreBellec
> tel:       (001)(514) 398 5220
> fax:      (001)(514) 398 8948
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>
>


More information about the MINC-users mailing list