Menu

#54 Solaris build fails with undefined symbols

1.12.0
open-remind
5
2009-11-23
2006-12-01
No

When building cppunit 1.12.0 on Solaris 2.8 I got a number of symbols undefined when the shared library was built. A few examples:

Undefined first referenced
symbol in file
std::ostream &std::ostream::operator<<(int) .libs/CompilerOutputter.o
std::ostream &std::ostream::operator<<(double) .libs/StringTools.o
fabs .libs/TestAssert.o
void __Crun::pure_error() .libs/CompilerOutputter.o

As you can see, these are symbols from standard libraries. The reason the linker complains about them is that the linking is done with the -zdefs flag, which in turn is used because libtool is run with -no-undefined. And it does so because src/cppunit/Makefile.am adds this flag.

To use that flag, I assume one has to also add all standard libraries when linking the shared library. And I can't find any code that would do that.

I removed -no-undefined from src/cppunit/Makefile.am and then I could build on Solaris. Would it make sense to do this in the default distribution too maybe?

I build on HP-UX, Red Hat Linux and AIX too. On HP-UX and Red Hat Linux, -no-undefined is a no-op, so the problem does not occur there. On AIX shared libraries should be disabled according to README-unix, why this problem doesn't happen there either.

Discussion

  • Göran Uddeborg

    Göran Uddeborg - 2006-12-01

    The actual (trivial) patch

     
  • Baptiste Lepilleur

    • assigned_to: nobody --> blep
    • status: open --> open-remind
     

Log in to post a comment.