Archived

This forum has been archived. Please start a new discussion on GitHub.

static linking of standard libs

I'm trying to use Ice together with matlab. This results in an segmentation fault, since matlab is compiled using gcc 2.95.x and I'm using gcc 3.3.1 to compile my Ice-using library and Ice.

When linking the library into matlab and initialising Ice I get a segmentation fault due to a buggy implementation of dynamic_cast

[see http://gcc.gnu.org/ml/gcc-bugs/2002-05/msg00964.html ]

My idea now is to statically link libstdc++ and libgcc into my application (and Ice), since I assume that the problem is caused by the fact, that matlab links to an older version of libstdc++ and incompatibility of the used RTTI.

My idea is to modify the LDFLAGS to something like:

LDFLAGS = -nodefaultlibs -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic <other libs>

Do you think, this can work, or do you have a better idea?

Thanx in advance

Gerald

Comments

  • marc
    marc Florida
    If Matlab is plain C, then you can use the GCC 3.3 library. If it's written in C++, then this doesn't work, because the binary C++ format has changed between 2.95.x and 3.3.x.
  • Unfortunatly matlab is programmed using c++. :(
  • bernard
    bernard Jupiter, FL
    Hello,

    Maybe your best option is to use an Ice 1.0.1/GCC 2.95.3 build with Matlab: see http://www.zeroc.com/vbulletin/showthread.php?s=&threadid=100

    If you really need to mix C++ compilers, you could try to combine everything in a single library linked with -Bsymbolic ... but I am not very optimistic.

    Cheers,
    Bernard
  • Thanx for your help.

    Unfortunatly I REALLY have to mix compilers... :(

    Well, I'll give it a try..

    By the way

    Thanx to ervyone at ZeroC for all the support I got: My diplomthesis, which is based on Ice reveived a "very good". :)

    Thanx again