Menu

#13 cppunit compatibility with SUNWspro CC

open
nobody
None
5
2002-07-31
2002-07-31
Diane H
No

I was attempting to port our tests from Windows to
Solaris 64-bit using the SUNWspro CC compiler. After
getting several link errors, I discovered the following in
Sun's CC Readme:

5. Reference From Template to Non-Global FileScope
Object is Not Supported
A program using templates and static objects
causes link-time errors of undefined symbols. The
compiler currently does not support reference to non-
global file-scope objects

It seems that cppunit's TestFactoryRegistry class is not
supported for templates (e.g. in map).

Has anyone out there modified cppunit for support on
Sun's CC? Or, can anyone suggest another workaround
for using cppunit on 64 bit Solaris? I would be willing to
test cppunit on the Solaris 64 bit architecture.

Discussion

  • Baptiste Lepilleur

    Logged In: YES
    user_id=196852

    Could you precise exactly what part of the code is the source
    of the issue. Would encapsulating the Registries map (the
    one you are refering to?) in a plain C++ class be a work
    around this issue ?

    Baptiste.

     
  • Diane H

    Diane H - 2002-09-02

    Logged In: YES
    user_id=582270

    It seems that whenever TestFactory is used in a template
    class, e.g. most of the standard template libs, the link errors
    appear (see below). TestFactoryRegistry is a TestFactory
    object and it contains static methods (e.g. getRegistry). This
    is what the Sun compiler chokes on. I'm attaching the simple,
    sample code that does not compile.

    At first glance, the simplest fix may be to remove the use the
    static methods in the TestFactoryRegistry class. I haven't
    examined the consequence of this change.

    The link errors are:

    /opt/SUNWspro/bin/CC -c APITestCase.cpp -
    I/usr/local/include -I. -xarch=v9 -g -o APITestCase.o
    /opt/SUNWspro/bin/CC -o APITestCase APITestCase.o -
    L/usr/local/lib -lcppunit -xarch=v9
    Undefined first referenced
    symbol in file
    unsigned long
    __rwstd::__rb_tree<CppUnit::TestFactory*,CppUnit::TestFacto
    ry*,__rwstd::__ident<CppUnit::TestFactory*,CppUnit::TestFact
    ory*>,std::less<CppUnit::TestFactory*>,std::allocator<CppUni
    t::TestFactory*> >::erase(CppUnit::TestFactory*const&)
    /usr/local/lib/libcppunit.so
    void
    std::deque<CppUnit::Test*,std::allocator<CppUnit::Test*>
    >::__allocate_at_end() /usr/local/lib/libcppunit.so

    void
    __rwstd::__rb_tree<CppUnit::TestFactory*,CppUnit::TestFacto
    ry*,__rwstd::__ident<CppUnit::TestFactory*,CppUnit::TestFact
    ory*>,std::less<CppUnit::TestFactory*>,std::allocator<CppUni
    t::TestFactory*> >::__deallocate_buffers
    () /usr/local/lib/libcppunit.so
    __rwstd::__rb_tree<CppUnit::Test*,std::pair<CppUnit::Test*co
    nst,CppUnit::TestFailure*>,__rwstd::__select1st<std::pair<Cp
    pUnit::Test*const,CppUnit::TestFailure*>,CppUnit::Test*>,std:
    :less<CppUnit::Test*>,std::allocator<std::pair<CppUnit::Test*
    const,CppUnit::TestFailure*> > >::iterator
    __rwstd::__rb_tree<CppUnit::Test*,std::pair<CppUnit::Test*co
    nst,CppUnit::TestFailure*>,__rwstd::__select1st<std::pair<Cp
    pUnit::Test*const,CppUnit::TestFailure*>,CppUnit::Test*>,std:
    :less<CppUnit::Test*>,std::allocator<std::pair<CppUnit::Test*
    const,CppUnit::TestFailure*> > >::find(CppUnit::Test*const&)
    const /usr/local/lib/libcppunit.so

    ... <similar link errs snipped>

    std::deque<std::pair<std::basic_string<char,std::char_traits<c
    har>,std::allocator<char>>,std::basic_string<char,std::char_tr
    aits<char>,std::allocator<char> >
    >,std::allocator<std::pair<std::basic_string<char,std::char_trai
    ts<char>,std::allocator<char>>,std::basic_string<char,std::ch
    ar_traits<char>,std::allocator<char> > > > >::~deque
    () /usr/local/lib/libcppunit.so
    ld: fatal: Symbol referencing errors. No output written to
    APITestCase
    make: *** [APITestCase] Error 1

     
  • Diane H

    Diane H - 2002-09-02
     
  • Diane H

    Diane H - 2002-09-02
     
  • Rohan Lenard

    Rohan Lenard - 2002-11-25

    Logged In: YES
    user_id=651057

    I was able to get CppUnit working by doing this -

    ./configure CC="CC" CXX="CC" LD="CC" LDFLAGS="-
    xildoff" CXXFLAGS="-mt -g -pta -instances=static -xildoff"

    I then linked against -libcppunit but the shared library should
    work too.

     
  • Baptiste Lepilleur

    Logged In: YES
    user_id=196852

    Trying using a more recent version. I've compiled 1.10 and run
    the unit test without issues.

    Baptiste.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.