From: Murat Tasan on
Hi, I know the solution to this will likely be system-dependent, and thus not something I should expect to find here, but I'm looking for some clues to help guide me in the right direction.

Basically, I'm looking to call some MATLAB routines from a C program. So I went through the documentation and now I'm trying to simply compile/link the 'engdemo.c' program. When running the compilation script (I've copied enhopts.sh into the local directory) via:
> mex -f engopts.sh engdemo.c
I get the following linking errors:

/usr/local/matlab2009b/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)@GLIBCXX_3.4.9'
/usr/local/matlab2009b/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<void const*>(void const*)@GLIBCXX_3.4.9'
/usr/local/matlab2009b/bin/glnxa64/libmwfl.so: undefined reference to `std::bad_alloc::what() const(a)GLIBCXX_3.4.9'
/usr/local/matlab2009b/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<double>(double)@GLIBCXX_3.4.9'
/usr/local/matlab2009b/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<long>(long)@GLIBCXX_3.4.9'
/usr/local/matlab2009b/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<bool>(bool)@GLIBCXX_3.4.9'
/usr/local/matlab2009b/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long)@GLIBCXX_3.4.9'
collect2: ld returned 1 exit status

mex: link of ' "engdemo"' failed.


So it appears whatever version of GLIBCXX_3.4.9 I have must not contain the proper symbols/definitions?

My installation of MATLAB is r2009b and I'm using a 64-bit linux system. Anyone have any idea what I should do as my next step for linking to the correct library and finding the correct library in the first place?

MATLAB novice humbly stumped by dependency hell,

Murat
From: Murat Tasan on
found the answer:

> strings libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8

but no 3.4.9, which it appears MATLAB requires. time to upgrade libraries, it seems.



"Murat Tasan" <mmuurr(a)gmail.com> wrote in message <hcsrpa$q8t$1(a)fred.mathworks.com>...
> Hi, I know the solution to this will likely be system-dependent, and thus not something I should expect to find here, but I'm looking for some clues to help guide me in the right direction.
>
> Basically, I'm looking to call some MATLAB routines from a C program. So I went through the documentation and now I'm trying to simply compile/link the 'engdemo.c' program. When running the compilation script (I've copied enhopts.sh into the local directory) via:
> > mex -f engopts.sh engdemo.c
> I get the following linking errors:
>
> /usr/local/matlab2009b/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)@GLIBCXX_3.4.9'
> /usr/local/matlab2009b/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<void const*>(void const*)@GLIBCXX_3.4.9'
> /usr/local/matlab2009b/bin/glnxa64/libmwfl.so: undefined reference to `std::bad_alloc::what() const(a)GLIBCXX_3.4.9'
> /usr/local/matlab2009b/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<double>(double)@GLIBCXX_3.4.9'
> /usr/local/matlab2009b/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<long>(long)@GLIBCXX_3.4.9'
> /usr/local/matlab2009b/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<bool>(bool)@GLIBCXX_3.4.9'
> /usr/local/matlab2009b/bin/glnxa64/libmx.so: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::basic_ostream<char, std::char_traits<char> >::_M_insert<unsigned long>(unsigned long)@GLIBCXX_3.4.9'
> collect2: ld returned 1 exit status
>
> mex: link of ' "engdemo"' failed.
>
>
> So it appears whatever version of GLIBCXX_3.4.9 I have must not contain the proper symbols/definitions?
>
> My installation of MATLAB is r2009b and I'm using a 64-bit linux system. Anyone have any idea what I should do as my next step for linking to the correct library and finding the correct library in the first place?
>
> MATLAB novice humbly stumped by dependency hell,
>
> Murat