Thread Subject: Conflict with mcc... libstdc++.so.6

Subject: Conflict with mcc... libstdc++.so.6

From: spasmous

Date: 1 Jun, 2008 21:22:15

Message: 1 of 8

I have a Hello World program I'm attempting to compile with mcc. It
appears to compile except at the end I get the message:

/usr/bin/ld: warning: libstdc++.so.6, needed by /usr/local/matlab/bin/
glnx86/libmwmclmcrrt.so, may conflict with libstdc++.so.5

Following previous posts on here I've checked the LD_LIBRARY_PATH is
set as in the manual. It is. A binary is generated and can be called,
however the result is errors.

>> system('./hello');
free(): invalid pointer 0x808d0c8!
free(): invalid pointer 0x808d348!
./hello: Segmentation fault

I'm stuck as to what to do now.

-------------------------------------------------------------------------------------
MATLAB Version 7.5.0.338 (R2007b)
MATLAB License Number: xxxxxx
Operating System: Linux 2.6.7-2.2smp #1 SMP Mon Jan 31 17:12:24 CST
2005 i686
Java VM Version: Java 1.6.0 with Sun Microsystems Inc. Java
HotSpot(TM) Client VM mixed mode, sharing
-------------------------------------------------------------------------------------
MATLAB Version
7.5 (R2007b)
Image Processing Toolbox Version
6.0 (R2007b)
MATLAB Compiler Version
4.7 (R2007b)
Optimization Toolbox Version
3.1.2 (R2007b)
Signal Processing Toolbox Version
6.8 (R2007b)

Subject: Conflict with mcc... libstdc++.so.6

From: Sebastiaan

Date: 2 Jun, 2008 12:00:05

Message: 2 of 8

spasmous <spasmous@gmail.com> wrote in message
<431d112e-2cfc-4e5e-8b68-e2dcac8b7008@w5g2000prd.googlegroups.com>...
> I have a Hello World program I'm attempting to compile
with mcc. It
> appears to compile except at the end I get the message:
>
> /usr/bin/ld: warning: libstdc++.so.6, needed by
/usr/local/matlab/bin/
> glnx86/libmwmclmcrrt.so, may conflict with libstdc++.so.5
>
Probably your system uses so.5 while Matlab comes with .so.6.

Did you compile with -L/opt/matlab/2007b/sys/os/glnxa64/
-lstdc++ ? What does 'ldd hello' give? And when executed
from Matlab (system('ldd hello'))?

Sebastiaan

Subject: Conflict with mcc... libstdc++.so.6

From: spasmous

Date: 2 Jun, 2008 17:03:33

Message: 3 of 8

On Jun 2, 5:00=A0am, "Sebastiaan "
<s.breedv...@erasmusmc.REMOVE.BOO.BOO.nl> wrote:
> spasmous<spasm...@gmail.com> wrote in message
>
> <431d112e-2cfc-4e5e-8b68-e2dcac8b7...@w5g2000prd.googlegroups.com>...> I h=
ave a Hello World program I'm attempting to compile
> with mcc. It
> > appears to compile except at the end I get the message:
>
> > /usr/bin/ld: warning: libstdc++.so.6, needed by
>
> /usr/local/matlab/bin/> glnx86/libmwmclmcrrt.so, may conflict with libstdc=
++.so.5
>
> Probably your system uses so.5 while Matlab comes with .so.6.
>
> Did you compile with -L/opt/matlab/2007b/sys/os/glnxa64/
> -lstdc++ =A0? What does 'ldd hello' give? And when executed
> from Matlab (system('ldd hello'))?
>

Sebastian - by responding you are saving my life :) Thank you!
The result of ldd hello is:

        linux-gate.so.1 =3D> (0xffffe000)
        libmwmclmcrrt.so =3D> /usr/local/matlab/bin/glnx86/
libmwmclmcrrt.so (0x40001000)
        libm.so.6 =3D> /lib/tls/libm.so.6 (0x42e08000)
        libstdc++.so.5 =3D> /usr/lib/libstdc++.so.5 (0x439b9000)
        libpthread.so.0 =3D> /lib/tls/libpthread.so.0 (0x42f20000)
        libc.so.6 =3D> /lib/tls/libc.so.6 (0x42cea000)
        libdl.so.2 =3D> /lib/libdl.so.2 (0x42e2d000)
        libstdc++.so.6 =3D> /usr/local/matlab/bin/glnx86/../../sys/os/
glnx86/libstdc++.so.6 (0x40069000)
        libgcc_s.so.1 =3D> /usr/local/matlab/bin/glnx86/../../sys/os/
glnx86/libgcc_s.so.1 (0x40146000)
        /lib/ld-linux.so.2 =3D> /lib/ld-linux.so.2 (0x42cd1000)

So it looks like my platform uses libstdc++.so.5. Is there any
solution where I can tell MATLAB to use .so.6?

I'm not sure I understand what you meant by compiling with -L/opt/
matlab/2007b/sys/os/glnxa64/-lstdc++. There is not -L flag with mcc
that I can see.

Subject: Conflict with mcc... libstdc++.so.6

From: Sebastiaan

Date: 2 Jun, 2008 18:16:02

Message: 4 of 8

> Sebastian - by responding you are saving my life :) Thank you!
> The result of ldd hello is:
>
> linux-gate.so.1 =3D> (0xffffe000)
> libmwmclmcrrt.so =3D> /usr/local/matlab/bin/glnx86/
> libmwmclmcrrt.so (0x40001000)
> libm.so.6 =3D> /lib/tls/libm.so.6 (0x42e08000)
> libstdc++.so.5 =3D> /usr/lib/libstdc++.so.5
(0x439b9000)
> libpthread.so.0 =3D> /lib/tls/libpthread.so.0
(0x42f20000)
> libc.so.6 =3D> /lib/tls/libc.so.6 (0x42cea000)
> libdl.so.2 =3D> /lib/libdl.so.2 (0x42e2d000)
> libstdc++.so.6 =3D>
/usr/local/matlab/bin/glnx86/../../sys/os/
> glnx86/libstdc++.so.6 (0x40069000)
> libgcc_s.so.1 =3D>
/usr/local/matlab/bin/glnx86/../../sys/os/
> glnx86/libgcc_s.so.1 (0x40146000)
> /lib/ld-linux.so.2 =3D> /lib/ld-linux.so.2
(0x42cd1000)
>
> So it looks like my platform uses libstdc++.so.5. Is there any
> solution where I can tell MATLAB to use .so.6?
>
> I'm not sure I understand what you meant by compiling with
-L/opt/
> matlab/2007b/sys/os/glnxa64/-lstdc++. There is not -L flag
with mcc
> that I can see.

Funny, it is actually linked to .so.5 and .so.6. Seems
strange, but I am not an expert on this.

I also have no experience with mcc, only with mex files.

From
http://www.gravity.psu.edu/~s4/software/MATLAB-R2006a/Compiling_MATLAB_Release_2006a.html
it seems that you have to edit bin/mbuildopts.sh (or better:
~/.matlab/R2007b/mbuildopts.sh which is the one you can and
should edit) and change:
CLIBS="$RPATH $MLIBS -lm $TMW_ROOT/sys/os/$Arch/libstdc++.so.6""

in the section belonging to your architecture (seems glnx86).

Does it work?

Greetz,
Sebastiaan

Subject: Conflict with mcc... libstdc++.so.6

From: spasmous

Date: 2 Jun, 2008 18:59:02

Message: 5 of 8

On Jun 2, 11:16=A0am, "Sebastiaan "
<s.breedv...@erasmusmc.REMOVE.BOO.BOO.nl> wrote:
> > Sebastian - by responding you are saving my life :) Thank you!
> > The result of ldd hello is:
>
> > =A0 =A0 =A0 =A0 linux-gate.so.1 =3D3D> =A0(0xffffe000)
> > =A0 =A0 =A0 =A0 libmwmclmcrrt.so =3D3D> /usr/local/matlab/bin/glnx86/
> > libmwmclmcrrt.so (0x40001000)
> > =A0 =A0 =A0 =A0 libm.so.6 =3D3D> /lib/tls/libm.so.6 (0x42e08000)
> > =A0 =A0 =A0 =A0 libstdc++.so.5 =3D3D> /usr/lib/libstdc++.so.5
> (0x439b9000)
> > =A0 =A0 =A0 =A0 libpthread.so.0 =3D3D> /lib/tls/libpthread.so.0
> (0x42f20000)
> > =A0 =A0 =A0 =A0 libc.so.6 =3D3D> /lib/tls/libc.so.6 (0x42cea000)
> > =A0 =A0 =A0 =A0 libdl.so.2 =3D3D> /lib/libdl.so.2 (0x42e2d000)
> > =A0 =A0 =A0 =A0 libstdc++.so.6 =3D3D>
>
> /usr/local/matlab/bin/glnx86/../../sys/os/> glnx86/libstdc++.so.6 (0x40069=
000)
> > =A0 =A0 =A0 =A0 libgcc_s.so.1 =3D3D>
>
> /usr/local/matlab/bin/glnx86/../../sys/os/
>
> > glnx86/libgcc_s.so.1 (0x40146000)
> > =A0 =A0 =A0 =A0 /lib/ld-linux.so.2 =3D3D> /lib/ld-linux.so.2
> (0x42cd1000)
>
> > So it looks like my platform uses libstdc++.so.5. Is there any
> > solution where I can tell MATLAB to use .so.6?
>
> > I'm not sure I understand what you meant by compiling with
> -L/opt/
> > matlab/2007b/sys/os/glnxa64/-lstdc++. There is not -L flag
> with mcc
> > that I can see.
>
> Funny, it is actually linked to .so.5 and .so.6. Seems
> strange, but I am not an expert on this.
>
> I also have no experience with mcc, only with mex files.
>
> Fromhttp://www.gravity.psu.edu/~s4/software/MATLAB-R2006a/Compiling_MATLA.=
..
> it seems that you have to edit bin/mbuildopts.sh (or better:
> ~/.matlab/R2007b/mbuildopts.sh which is the one you can and
> should edit) and change:
> CLIBS=3D"$RPATH $MLIBS -lm $TMW_ROOT/sys/os/$Arch/libstdc++.so.6""
>
> in the section belonging to your architecture (seems glnx86).
>
> Does it work?


Interesting. I changed my mbuildopts.sh file as you suggested and it
does work. But only calling from the MATLAB prompt via system('./
hello'). Calling from the bash shell gives the error

=2E/hello: error while loading shared libraries: libmwmclmcrrt.so:
cannot open shared object file: No such file or directory

Subject: Conflict with mcc... libstdc++.so.6

From: spasmous

Date: 2 Jun, 2008 19:16:11

Message: 6 of 8

On Jun 2, 11:59=A0am, spasmous <spasm...@gmail.com> wrote:
> On Jun 2, 11:16=A0am, "Sebastiaan "
>
>
>
> <s.breedv...@erasmusmc.REMOVE.BOO.BOO.nl> wrote:
> > > Sebastian - by responding you are saving my life :) Thank you!
> > > The result of ldd hello is:
>
> > > =A0 =A0 =A0 =A0 linux-gate.so.1 =3D3D> =A0(0xffffe000)
> > > =A0 =A0 =A0 =A0 libmwmclmcrrt.so =3D3D> /usr/local/matlab/bin/glnx86/
> > > libmwmclmcrrt.so (0x40001000)
> > > =A0 =A0 =A0 =A0 libm.so.6 =3D3D> /lib/tls/libm.so.6 (0x42e08000)
> > > =A0 =A0 =A0 =A0 libstdc++.so.5 =3D3D> /usr/lib/libstdc++.so.5
> > (0x439b9000)
> > > =A0 =A0 =A0 =A0 libpthread.so.0 =3D3D> /lib/tls/libpthread.so.0
> > (0x42f20000)
> > > =A0 =A0 =A0 =A0 libc.so.6 =3D3D> /lib/tls/libc.so.6 (0x42cea000)
> > > =A0 =A0 =A0 =A0 libdl.so.2 =3D3D> /lib/libdl.so.2 (0x42e2d000)
> > > =A0 =A0 =A0 =A0 libstdc++.so.6 =3D3D>
>
> > /usr/local/matlab/bin/glnx86/../../sys/os/> glnx86/libstdc++.so.6 (0x400=
69000)
> > > =A0 =A0 =A0 =A0 libgcc_s.so.1 =3D3D>
>
> > /usr/local/matlab/bin/glnx86/../../sys/os/
>
> > > glnx86/libgcc_s.so.1 (0x40146000)
> > > =A0 =A0 =A0 =A0 /lib/ld-linux.so.2 =3D3D> /lib/ld-linux.so.2
> > (0x42cd1000)
>
> > > So it looks like my platform uses libstdc++.so.5. Is there any
> > > solution where I can tell MATLAB to use .so.6?
>
> > > I'm not sure I understand what you meant by compiling with
> > -L/opt/
> > > matlab/2007b/sys/os/glnxa64/-lstdc++. There is not -L flag
> > with mcc
> > > that I can see.
>
> > Funny, it is actually linked to .so.5 and .so.6. Seems
> > strange, but I am not an expert on this.
>
> > I also have no experience with mcc, only with mex files.
>
> > Fromhttp://www.gravity.psu.edu/~s4/software/MATLAB-R2006a/Compiling_MATL=
A...
> > it seems that you have to edit bin/mbuildopts.sh (or better:
> > ~/.matlab/R2007b/mbuildopts.sh which is the one you can and
> > should edit) and change:
> > CLIBS=3D"$RPATH $MLIBS -lm $TMW_ROOT/sys/os/$Arch/libstdc++.so.6""
>
> > in the section belonging to your architecture (seems glnx86).
>
> > Does it work?
>
> Interesting. I changed my mbuildopts.sh file as you suggested and it
> does work. But only calling from the MATLAB prompt via system('./
> hello'). Calling from the bash shell gives the error
>
> ./hello: error while loading shared libraries: libmwmclmcrrt.so:
> cannot open shared object file: No such file or directory

Whoops, my error. I opened an xterm without updating the
LD_LIBRARY_PATH variable. After doing that it works as advertised from
the command line. Thanks again. Wow, it works.

Subject: Conflict with mcc... libstdc++.so.6

From: Jack Yu

Date: 23 Jul, 2008 14:11:05

Message: 7 of 8

Hello,
I think I have a similar, if not the same, problem. The
version of Matlab I am using is: 7.0.0.19901 (R14). And the
problem is when I use mcc -m to compile a certain function,
I get the following warning message:

/usr/bin/ld: warning: libstdc++.so.5, needed by
/usr/local/matlab/bin/glnx86/libmwmclmcrrt.so, may conflict
with libstdc++.so.6
Warning: Objects of uiundo.FunctionCommand class exist - not
clearing this class
or any of its super-classes.
Warning: Objects of uiundo.CommandManager class exist - not
clearing this class
or any of its super-classes.
Warning: Objects of uitools.FigureToolManager class exist -
not clearing this class
or any of its super-classes.

So, I tried to solve it by changing my mbuildopts.sh as follows:

# CLIBS = "$RPATH $MLIBS -lm -lstdc++"
  CLIBS = "$RPATH $MLIBS -lm
$TMW_ROOT/sys/os/$Arch/libstdc++.so.5""

where I've commented out the old CLIBS and inserted what I
think I should according to this discussion. But now, I get
an error:

Warning: an error occurred while parsing class
dspopts.abstractspectrum:
Undefined function or variable 'check_integer'.
Warning: an error occurred while parsing class
dspopts.pseudospectrum:
Invalid superclass handle.
??? Unable to create a class array for class
dspopts.pseudospectrum

Warning: Objects of uiundo.FunctionCommand class exist - not
clearing this class
or any of its super-classes.
Warning: Objects of uiundo.CommandManager class exist - not
clearing this class
or any of its super-classes.
Warning: Objects of uitools.FigureToolManager class exist -
not clearing this class
or any of its super-classes.
??? Depfun error: 'Unable to create a class array for class
dspopts.pseudospectrum
'

Does anyone know how I can make this work? Any help or
hints would be very much appreciated.

cheers,

Jack


spasmous <spasmous@gmail.com> wrote in message
<9f4032f6-4871-4bae-b649-e78b2b4fa1bc@z24g2000prf.googlegroups.com>...
> On Jun 2, 11:16=A0am, "Sebastiaan "
> <s.breedv...@erasmusmc.REMOVE.BOO.BOO.nl> wrote:
> > > Sebastian - by responding you are saving my life :)
Thank you!
> > > The result of ldd hello is:
> >
> > > =A0 =A0 =A0 =A0 linux-gate.so.1 =3D3D> =A0(0xffffe000)
> > > =A0 =A0 =A0 =A0 libmwmclmcrrt.so =3D3D>
/usr/local/matlab/bin/glnx86/
> > > libmwmclmcrrt.so (0x40001000)
> > > =A0 =A0 =A0 =A0 libm.so.6 =3D3D> /lib/tls/libm.so.6
(0x42e08000)
> > > =A0 =A0 =A0 =A0 libstdc++.so.5 =3D3D>
/usr/lib/libstdc++.so.5
> > (0x439b9000)
> > > =A0 =A0 =A0 =A0 libpthread.so.0 =3D3D>
/lib/tls/libpthread.so.0
> > (0x42f20000)
> > > =A0 =A0 =A0 =A0 libc.so.6 =3D3D> /lib/tls/libc.so.6
(0x42cea000)
> > > =A0 =A0 =A0 =A0 libdl.so.2 =3D3D> /lib/libdl.so.2
(0x42e2d000)
> > > =A0 =A0 =A0 =A0 libstdc++.so.6 =3D3D>
> >
> > /usr/local/matlab/bin/glnx86/../../sys/os/>
glnx86/libstdc++.so.6 (0x40069=
> 000)
> > > =A0 =A0 =A0 =A0 libgcc_s.so.1 =3D3D>
> >
> > /usr/local/matlab/bin/glnx86/../../sys/os/
> >
> > > glnx86/libgcc_s.so.1 (0x40146000)
> > > =A0 =A0 =A0 =A0 /lib/ld-linux.so.2 =3D3D>
/lib/ld-linux.so.2
> > (0x42cd1000)
> >
> > > So it looks like my platform uses libstdc++.so.5. Is
there any
> > > solution where I can tell MATLAB to use .so.6?
> >
> > > I'm not sure I understand what you meant by compiling with
> > -L/opt/
> > > matlab/2007b/sys/os/glnxa64/-lstdc++. There is not -L flag
> > with mcc
> > > that I can see.
> >
> > Funny, it is actually linked to .so.5 and .so.6. Seems
> > strange, but I am not an expert on this.
> >
> > I also have no experience with mcc, only with mex files.
> >
> >
Fromhttp://www.gravity.psu.edu/~s4/software/MATLAB-R2006a/Compiling_MATLA.=
> ..
> > it seems that you have to edit bin/mbuildopts.sh (or better:
> > ~/.matlab/R2007b/mbuildopts.sh which is the one you can and
> > should edit) and change:
> > CLIBS=3D"$RPATH $MLIBS -lm
$TMW_ROOT/sys/os/$Arch/libstdc++.so.6""
> >
> > in the section belonging to your architecture (seems
glnx86).
> >
> > Does it work?
>
>
> Interesting. I changed my mbuildopts.sh file as you
suggested and it
> does work. But only calling from the MATLAB prompt via
system('./
> hello'). Calling from the bash shell gives the error
>
> =2E/hello: error while loading shared libraries:
libmwmclmcrrt.so:
> cannot open shared object file: No such file or directory

Subject: Conflict with mcc... libstdc++.so.6

From: Sebastiaan

Date: 13 Aug, 2008 09:13:01

Message: 8 of 8

What does ldd give you, before and after the change in the
CLIBS?


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
libstdc mcc Jack Yu 23 Jul, 2008 10:15:14
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com