[Mrtrix-discussion] Linking error
Jon Clayden
jon.clayden at gmail.com
Mon Oct 28 10:00:13 PDT 2013
Looks like we crossed over in the aether... :)
Yes, sorry - initially it didn't occur to me that Homebrew wasn't using GCC. I also saw the POD VLA thing, but have already updated to the latest SVN revision which does indeed fix that. The patch I sent in the last message was against that latest SVN rev. It should be safe on all platforms.
Thanks again,
Jon
On 28 Oct 2013, at 16:49, Donald Tournier <jdtournier at gmail.com> wrote:
> Hi Jon,
>
> OK, this makes a bit more sense now, mixing compilers is never a good idea... Might be simplest just to fix up MRtrix to compile under clang. What are the error messages? I recently helped someone with compiler errors on MacOSX, mostly related to the use of non-POD VLAs (non plain-old-data variable-length arrays, in English). I've no idea what the compiler was, but these were easy to fix, and I've committed the changes to the MRtrix SVN repository. You could give it a try if you want, look here for the repository:
> https://code.google.com/p/mrtrix/source/checkout
>
> I guess you'd have to also change the sysconf/darwin.py file to specify your compiler, but it sounds like you'd already figured that out...
>
> Cheers,
>
> Donald.
>
>
>
> On 28 October 2013 16:18, Jon Clayden <jon.clayden at gmail.com> wrote:
> Hi Donald,
>
> Thanks for the quick reply. Unfortunately I've already tried cleaning up first, and it doesn't help.
>
> Clang is now the default compiler on OS X, and I think Homebrew uses it by default too. So the only other thing I can think of is that Clang uses different name-mangling to GCC and therefore that the symbols don't match up. They're definitely there in some form:
>
> $ nm -arch x86_64 -g /usr/local/Cellar/glibmm/2.38.0/lib/libglibmm-2.4.dylib | grep build_filename
> 0000000000017261 T __ZN4Glib14build_filenameERKNS_11ArrayHandleINSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_17Container_Helpers10TypeTraitsIS7_EEEE
> 00000000000172ce T __ZN4Glib14build_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_
> 000000000001735d T __ZN4Glib14build_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_
> 00000000000173fd T __ZN4Glib14build_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_
> 00000000000174b0 T __ZN4Glib14build_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_S8_
> 0000000000017575 T __ZN4Glib14build_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_S8_S8_
> 000000000001765c T __ZN4Glib14build_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_S8_S8_S8_
> 000000000001775a T __ZN4Glib14build_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_S8_S8_S8_S8_
> 000000000001786f T __ZN4Glib14build_filenameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_S8_S8_S8_S8_S8_S8_S8_
> U _g_build_filename
> U _g_build_filenamev
>
> Unfortunately MRtrix won't build out of the box with Clang, so I can't quickly try that. I'll keep plugging away at it.
>
> All the best,
> Jon
>
>
> On 28 Oct 2013, at 15:25, Donald Tournier <jdtournier at gmail.com> wrote:
>
> > Hey Jon,
> >
> > Seems odd, but my best guess would be that these functions might have changed from being actual functions calls to now being header-only inline functions, which would therefore not be present in the library. If that's the case, it would only be a problem if you're trying to link already compiled code, which would happen if you're trying to build from your previous installation without issuing a './build clean' first to remove all already compiled object files.
> >
> > So in brief, try './build clean', then './build'...
> >
> > Cheers,
> > Donald.
> >
> >
> >
> > On 28 October 2013 15:11, Jon Clayden <jon.clayden at gmail.com> wrote:
> > Dear all,
> >
> > I know this is tedious--sorry--but I've been struggling to get MRtrix installed on a new computer (Mac OS X Mavericks + Homebrew) and can't find my way past this problem.
> >
> > The MRtrix build script fails at link time (see output below). But the library paths look fine, the appropriate libraries are listed in the link command generated by the script, and I see no evidence that the functions in question have moved or been removed in recent versions of glibmm (I'm using 2.38.0).
> >
> > Am I missing something obvious here?
> >
> > Thanks in advance,
> > Jon
> >
> > --
> > [LD] lib/libmrtrix-0_2_11.dylib
> >
> > ERROR: [LD] lib/libmrtrix-0_2_11.dylib
> >
> > g++-4.8 -shared lib/math/vector.o lib/math/matrix.o lib/image/format/analyse.o lib/file/dicom/quick_scan.o lib/image/format/list.o lib/file/dicom/image.o lib/file/config.o lib/point.o lib/image/name_parser.o lib/image/format/xds.o lib/data_type.o lib/args.o lib/file/dicom/patient.o lib/file/dicom/tree.o lib/image/fft.o lib/image/header.o lib/file/dicom/mapper.o lib/file/dicom/select_cmdline.o lib/math/linalg.o lib/file/dicom/study.o lib/file/dicom/element.o lib/file/mmap.o lib/image/format/nifti1.o lib/file/dicom/dict.o lib/image/format/mrtrix.o lib/image/format/base.o lib/image/axis.o lib/image/interp.o lib/image/mapper.o lib/file/dicom/series.o lib/mrtrix.o lib/image/format/mri.o lib/image/object.o lib/image/format/dicom.o lib/app.o lib/file/key_value.o -L/usr/local/Cellar/glibmm/2.38.0/lib -L/usr/local/Cellar/glib/2.38.1/lib -L/usr/local/Cellar/libsigc++/2.3.1/lib -L/usr/local/Cellar/glib/2.38.1/lib -L/usr/local/opt/gettext/lib -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lgthre
> > ad-2.0 -lglib-2.0 -lintl -lgsl -lgslcblas -lz -o lib/libmrtrix-0_2_11.dylib
> >
> > failed with output:
> >
> > Undefined symbols for architecture x86_64:
> > "Glib::build_filename(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
> > MR::File::Config::init() in config.o
> > MR::Image::NameParser::name(std::vector<int, std::allocator<int> > const&) in name_parser.o
> > MR::Image::NameParser::get_next_match(std::vector<int, std::allocator<int> >&, bool) in name_parser.o
> > MR::File::Dicom::Tree::read_dir(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in tree.o
> > MR::Image::Format::MRtrix::read(MR::Image::Mapper&, MR::Image::Header&) const in mrtrix.o
> > "Glib::str_has_suffix(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
> > MR::Image::Format::Analyse::check(MR::Image::Header&, int) const in analyse.o
> > MR::Image::Format::Analyse::read(MR::Image::Mapper&, MR::Image::Header&) const in analyse.o
> > MR::Image::Format::XDS::check(MR::Image::Header&, int) const in xds.o
> > MR::Image::Format::XDS::read(MR::Image::Mapper&, MR::Image::Header&) const in xds.o
> > MR::File::Dicom::Element::set(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in element.o
> > MR::Image::Format::NIfTI::check(MR::Image::Header&, int) const in nifti1.o
> > MR::Image::Format::NIfTI::create(MR::Image::Mapper&, MR::Image::Header const&) const in nifti1.o
> > ...
> > "Glib::path_get_dirname(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
> > MR::Image::NameParser::parse(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) in name_parser.o
> > MR::Image::Format::MRtrix::read(MR::Image::Mapper&, MR::Image::Header&) const in mrtrix.o
> > "Glib::path_get_basename(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
> > MR::Image::NameParser::parse(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) in name_parser.o
> > MR::Image::Format::MRtrix::create(MR::Image::Mapper&, MR::Image::Header const&) const in mrtrix.o
> > MR::Image::Object::open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) in object.o
> > MR::Image::Object::create(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, MR::Image::Header&) in object.o
> > MR::App::App(int, char**, char const**, MR::Argument const*, MR::Option const*, unsigned int const*, char const*, char const*) in app.o
> > MR::App::App(int, char**, char const**, MR::Argument const*, MR::Option const*, unsigned int const*, char const*, char const*) in app.o
> > "Glib::Dir::Dir(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
> > MR::Image::NameParser::get_next_match(std::vector<int, std::allocator<int> >&, bool) in name_parser.o
> > MR::File::Dicom::Tree::read_dir(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in tree.o
> > "Glib::ustring::ustring(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
> > MR::Math::Vector::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const in vector.o
> > MR::Math::Vector::load(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in vector.o
> > MR::Math::Matrix::save(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const in matrix.o
> > MR::Math::Matrix::load(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in matrix.o
> > MR::Image::NameParser::get_next_match(std::vector<int, std::allocator<int> >&, bool) in name_parser.o
> > MR::Image::Format::XDS::read(MR::Image::Mapper&, MR::Image::Header&) const in xds.o
> > MR::Image::Format::XDS::create(MR::Image::Mapper&, MR::Image::Header const&) const in xds.o
> > ...
> > "Glib::file_test(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Glib::FileTest)", referenced from:
> > MR::File::Config::init() in config.o
> > MR::Image::NameParser::parse(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int) in name_parser.o
> > MR::File::Dicom::Tree::read_dir(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in tree.o
> > MR::File::Dicom::Tree::read(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in tree.o
> > MR::Image::Format::MRtrix::create(MR::Image::Mapper&, MR::Image::Header const&) const in mrtrix.o
> > "Glib::operator<<(std::basic_ostream<char, std::char_traits<char> >&, Glib::ustring const&)", referenced from:
> > MR::cmdline_info(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in app.o
> > MR::cmdline_error(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in app.o
> > MR::cmdline_debug(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in app.o
> > MR::operator<<(std::basic_ostream<char, std::char_traits<char> >&, MR::App const&) in app.o
> > ld: symbol(s) not found for architecture x86_64
> > collect2: error: ld returned 1 exit status
> >
> > STOP
> > _______________________________________________
> > Mrtrix-discussion mailing list
> > Mrtrix-discussion at www.nitrc.org
> > http://www.nitrc.org/mailman/listinfo/mrtrix-discussion
> >
> >
> >
> > --
> > Dr J-Donald Tournier (PhD)
> >
> > Senior Lecturer, Biomedical Engineering
> > Division of Imaging Sciences & Biomedical Engineering
> > King's College London
> >
> > A: Department of Perinatal Imaging & Health, 1st Floor South Wing, St Thomas' Hospital, London. SE1 7EH
> > T: +44 (0)20 7188 7118 ext 53613
> > W: http://www.kcl.ac.uk/medicine/research/divisions/imaging/departments/biomedengineering
>
>
>
>
> --
> Dr J-Donald Tournier (PhD)
>
> Senior Lecturer, Biomedical Engineering
> Division of Imaging Sciences & Biomedical Engineering
> King's College London
>
> A: Department of Perinatal Imaging & Health, 1st Floor South Wing, St Thomas' Hospital, London. SE1 7EH
> T: +44 (0)20 7188 7118 ext 53613
> W: http://www.kcl.ac.uk/medicine/research/divisions/imaging/departments/biomedengineering
More information about the Mrtrix-discussion
mailing list