CppUnit Install trouble

Help
2008-10-29
2013-04-22
  • Kenji Morita

    Kenji Morita - 2008-10-29

    I have a trougle with installing CppUnit for Unix.

    I had error with "make" command , when I try to "configure" and "make".
    Error content is following.

    How can I get rid of this error ?
    Would you like tell me ?

    Now, I use Sun Solaris 8 and gcc version 3.3.2.
    Then, I specified "configure" comand like following.

    ----configure option-----
    ./configure CXXFLAGS="-g -c" LDFLAGS="-lc -lm -lgcc"

    ----Error Content-----

    so.1)
    (cd .libs && rm -f libcppunit.so && ln -s libcppunit-1.12.so.1.0.0 libcppunit.so)
    ar cru .libs/libcppunit.a  AdditionalMessage.o Asserter.o BeOsDynamicLibraryManager.o BriefTestProgressListener.o CompilerOutputter.o DefaultProtector.o DynamicLibraryManager.o DynamicLibraryManagerException.o Exception.o Message.o RepeatedTest.o PlugInManager.o PlugInParameters.o Protector.o ProtectorChain.o SourceLine.o StringTools.o SynchronizedObject.o Test.o TestAssert.o TestCase.o TestCaseDecorator.o TestComposite.o TestDecorator.o TestFactoryRegistry.o TestFailure.o TestLeaf.o TestNamer.o TestPath.o TestPlugInDefaultImpl.o TestResult.o TestResultCollector.o TestRunner.o TestSetUp.o TestSuccessListener.o TestSuite.o TestSuiteBuilderContext.o TextOutputter.o TextTestProgressListener.o TextTestResult.o TextTestRunner.o TypeInfoHelper.o UnixDynamicLibraryManager.o ShlDynamicLibraryManager.o XmlDocument.o XmlElement.o XmlOutputter.o XmlOutputterHook.o Win32DynamicLibraryManager.o
    ranlib .libs/libcppunit.a
    creating libcppunit.la
    (cd .libs && rm -f libcppunit.la && ln -s ../libcppunit.la libcppunit.la)
    Making all in DllPlugInTester
    g++ -DHAVE_CONFIG_H -I. -I../../config -I../../include -I../../include     -g -c -MT DllPlugInTester.o -MD -MP -MF .deps/DllPlugInTester.Tpo -c -o DllPlugInTester.o DllPlugInTester.cpp
    In file included from DllPlugInTester.cpp:16:
    CommandLineParser.h:26: error: syntax error before `;' token
    DllPlugInTester.cpp: In function `bool runTests(const CommandLineParser&)':
    DllPlugInTester.cpp:35: error: `PlugInManager' undeclared in namespace `CppUnit
       '
    DllPlugInTester.cpp:35: error: parse error before `;' token
    DllPlugInTester.cpp:70: error: `plugInManager' undeclared (first use this
       function)
    DllPlugInTester.cpp:70: error: (Each undeclared identifier is reported only
       once for each function it appears in.)
    DllPlugInTester.cpp:70: error: 'struct CommandLinePlugInInfo' has no member
       named 'm_parameters'
    DllPlugInTester.cpp: In function `int main(int, const char**)':
    DllPlugInTester.cpp:240: error: parse error before `&' token
    DllPlugInTester.cpp: At global scope:
    DllPlugInTester.cpp:250: error: ISO C++ forbids declaration of `stdCOut' with
       no type
    DllPlugInTester.cpp:250: error: `int CppUnit::stdCOut()' should have been
       declared inside `CppUnit'
    DllPlugInTester.cpp: In function `int CppUnit::stdCOut()':
    DllPlugInTester.cpp:250: error: new declaration `int CppUnit::stdCOut()'
    ../../include/cppunit/portability/Stream.h:333: error: ambiguates old
       declaration `CppUnit::OStream& CppUnit::stdCOut()'
    DllPlugInTester.cpp: In function `int CppUnit::stdCOut()':
    DllPlugInTester.cpp:250: error: parse error before `.' token
    DllPlugInTester.cpp:251: error: syntax error before `.' token
    *** Error code 1

    ...The rest is omitted
    --------

     
    • Niels Dekker

      Niels Dekker - 2008-10-29

      Hi Kenji Morita,

      CommandLineParser.h line 26 (which caused the syntax error before `;' token) says:
        CPPUNIT_NS::PlugInParameters m_parameters;

      I guess that during your compilation, PlugInParameters was not defined.  This could be because the definition of PlugInParameters is inside an #if-#endif, within cppunit/plugin/PlugInParameters.h:

      #if !defined(CPPUNIT_NO_TESTPLUGIN)
      ...
      #endif // !defined(CPPUNIT_NO_TESTPLUGIN)

      CPPUNIT_NO_TESTPLUGIN is defined in cppunit/config/SelectDllLoader.h, for some unfortunate platforms:

      // Is WIN32 platform ?
      #if defined(WIN32)
      ...
      // Is BeOS platform ?
      #elif defined(__BEOS__)
      ...
      // Is Unix platform and have shl_load() (hp-ux)
      #elif defined(CPPUNIT_HAVE_SHL_LOAD)
      ...
      // Is Unix platform and have include <dlfcn.h>
      #elif defined(CPPUNIT_HAVE_LIBDL)
      ...
      // Otherwise, disable support for DllLoader
      #else
      #define CPPUNIT_NO_TESTPLUGIN 1
      #endif

      Hope this helps.  Do you really need the DllPlugInTester? Otherwise I guess you can still use the rest of the testing framework...

      Note that I don't have a Sun Solaris machine, I just took a look at the source code.
      --
      Niels Dekker
      http://www.xs4all.nl/~nd/dekkerware
      Scientific programmer at LKEB, Leiden University Medical Center

       
    • Kenji Morita

      Kenji Morita - 2008-10-30

      Hi Niels Dekker

      Thank you very much for your help.
      I can succeed to make with changing header file.

      However, I have one more question.
      Would you like to tell me ?

      I have following error with "make check" command.
      Is this no problem ?

      ----error content-----
      g++ -g -O2 -o .libs/hierarchy BoardGame.o Chess.o main.o  -ldl ../../src/cppunit/.libs/libcppunit.so /usr/local/lib/./libstdc++.so -L/usr2/SOURCES/S8/gcc-3.3.2/objdir/sparc-sun-solaris2.8/libstdc++-v3/src -L/usr2/SOURCES/S8/gcc-3.3.2/objdir/sparc-sun-solaris2.8/libstdc++-v3/src/.libs -L/usr2/SOURCES/S8/gcc-3.3.2/objdir/gcc -L/usr/local/sparc-sun-solaris2.8/bin -L/usr/local/sparc-sun-solaris2.8/lib -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/../../../sparc-sun-solaris2.8/lib -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/../..  -Wl,-R -Wl,/usr/local/lib -Wl,-R -Wl,/usr/local/lib/.
      ld: warning: file /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/../../libstdc++.so: linked to /usr/local/lib/./libstdc++.so: attempted multiple inclusion of file
      creating hierarchy
      make  check-TESTS
      ..The following test fails, this is intended:
      F..The following test fails, this is intended:
      F.

      !!!FAILURES!!!
      Test Results:
      Run:  5   Failures: 2   Errors: 0

      1) test: BoardGameTest<BoardGame>::testResetShouldFail (F) line: 45 BoardGameTest.h
      assertion failed
      - Expression: !this->m_game->reset()

      2) test: ChessTest<Chess>::testResetShouldFail (F) line: 45 BoardGameTest.h
      assertion failed
      - Expression: !this->m_game->reset()

      XFAIL: hierarchy

      All 1 tests behaved as expected (1 expected failures)

      Making check in cppunittest
      make  cppunittestmain

      ...The rest is omitted
      --------

       
      • Niels Dekker

        Niels Dekker - 2008-10-30

        Kenji wrote:
        I have following error with "make check" command.
        Is this no problem ?
        ----error content-----
        make check-TESTS
        ..The following test fails, this is intended:
        F..The following test fails, this is intended:
        F.

        !!!FAILURES!!!
        Test Results:
        Run: 5 Failures: 2 Errors: 0
        --------

        I don't think that's a problem.  I think those failures were intended, just to test the test framework!

        (Note: I haven't tried it myself.)

        Hope this helps, Niels

         
    • Kenji Morita

      Kenji Morita - 2008-10-31

      Hi Niels Dekker 

      Thank you very much for your help.
      I understand. I overlooked "..The following test fails, this is intended"

       

Log in to post a comment.