Professional Web Applications Themes

g++ linking problems - Sun Solaris

I am trying to build kvim on Solaris 9 (08/03), and always run into errors at the linking phase (linker complains that it cannot find any Qt/Kde objects). I tried compiling a simple hello world type Qt application, and that too fails to link, although g++ 2.95 compiles and links correctly (unfortunately kvim does not complie with g++ 2.95). I tried g++ 3.2 and 3.3, with the same results. It looks like the linker cannot handle C++ libraries. gcc 3.3 seems to work fine. Has anyone seen this behaviour before? Is it an issue with the linker in 08/03 release ...

  1. #1

    Default g++ linking problems

    I am trying to build kvim on Solaris 9 (08/03), and always run into
    errors at the linking phase (linker complains that it cannot find any
    Qt/Kde objects). I tried compiling a simple hello world type Qt
    application, and that too fails to link, although g++ 2.95 compiles and
    links correctly (unfortunately kvim does not complie with g++ 2.95). I
    tried g++ 3.2 and 3.3, with the same results. It looks like the linker
    cannot handle C++ libraries. gcc 3.3 seems to work fine. Has anyone
    seen this behaviour before? Is it an issue with the linker in 08/03
    release of Solaris 9? Thanks in advance for all help/suggestions.

    Rakesh

    Rakesh Guest

  2. #2

    Default Re: g++ linking problems

    On Wed, 01 Oct 2003 11:18:39 -0500, Rakesh Vidyadharan
    <org> wrote: 

    Can you give more details of how your are trying to link? Are you using
    qmake or some KDE equivalent?

    The linker can't on its own link, especially if there is any template
    code involved. Normally you link with gcc itself (which invokes ld after
    its fixed up everything).

    A bientot
    Paul
    --
    Paul Floyd http://paulf.free.fr (for what it's worth)
    Surgery: ennobled Gerald.
    Paul Guest

  3. #3

    Default Re: g++ linking problems

    In article <bleuov$239n$tribune.com>,
    Rakesh Vidyadharan <org> writes: 

    I don't quite follow your details, but C++ name mangling (encodes argument
    types into the name to accomodate overloaded functions, and accomodates
    member functions) is _not_ standardized. Thus, Sun's compiler vs gcc (or
    even different versions of gcc) may do it differently.

    Even if that were standardized, it would take more than just that to get
    binary compatibility between libraries produced by one C++ compiler and
    object files produced by another. For example, the details of how virtual
    functions are called may vary.


    --
    mailto:smart.net http://www.smart.net/~rlhamil
    Richard Guest

  4. #4

    Default Re: g++ linking problems

    Paul Floyd wrote:
     
    >
    >
    > Can you give more details of how your are trying to link? Are you using
    > qmake or some KDE equivalent?
    >
    > The linker can't on its own link, especially if there is any template
    > code involved. Normally you link with gcc itself (which invokes ld after
    > its fixed up everything).
    >
    > A bientot
    > Paul[/ref]

    The simple hello application source is:

    #include <qapplication.h>
    #include <qlabel.h>

    int main ( int argc, char* argv[] )
    {
    QApplication application( argc, argv );
    QLabel* label = new QLabel( "Hello World!", 0 );
    label->resize( 120, 30 );
    application.setMainWidget( label );
    label->show();
    return application.exec();
    }

    The test program was compiled and linked like so:

    /usr/local/bin/g++ -o hello -I/opt/sfw/include -L/opt/sfw/lib -lqt-mt
    hello.C

    This fails to compile and gives the following warnings (this is g++
    version 3.3 from sunfreeware).

    Undefined first referenced
    symbol in file
    typeinfo for QPtrCollection /var/tmp//ccqBJQud.o
    QStringData::deleteSelf() /var/tmp//ccqBJQud.o
    QString::QString[in-charge](char const*)/var/tmp//ccqBJQud.o
    QApplication::~QApplication [in-charge]()/var/tmp//ccqBJQud.o
    QGList::clear() /var/tmp//ccqBJQud.o
    QApplication::exec() /var/tmp//ccqBJQud.o
    QGList::compareItems(void*, void*) /var/tmp//ccqBJQud.o
    QGList::read(QDataStream&, void*&) /var/tmp//ccqBJQud.o
    QString::shared_null /var/tmp//ccqBJQud.o
    QLabel::QLabel[in-charge](QString const&, QWidget*, char const*,
    unsigned)/var/tmp//ccqBJQud.o
    QApplication::setMainWidget(QWidget*) /var/tmp//ccqBJQud.o
    QGList::~QGList [in-charge deleting]()/var/tmp//ccqBJQud.o
    QGList::write(QDataStream&, void*) const/var/tmp//ccqBJQud.o
    QApplication::QApplication[in-charge](int&, char**)/var/tmp//ccqBJQud.o
    QGList::~QGList [in-charge]() /var/tmp//ccqBJQud.o
    QPtrCollection::newItem(void*) /var/tmp//ccqBJQud.o
    ld: fatal: Symbol referencing errors. No output written to hello
    collect2: ld returned 1 exit status

    /usr/local/bin/g++ -c -I/opt/sfw/include hello.C produces the hello.o
    file properly.


    However,

    /opt/sfw/bin/g++ -o hello -I/opt/sfw/include -L/opt/sfw/lib -lqt-mt hello.C

    Generates the hello application properly with no errors (this is g++
    version 2.95 from the companion cd).

    For building kvim, I just use configure and make. I also tried linking
    against a locally compiled QT library, but gave the same errors about
    not finding QT and KDE objects.

    Rakesh

    Rakesh Guest

  5. #5

    Default Re: g++ linking problems

    On Thu, 02 Oct 2003 10:52:51 -0500, Rakesh Vidyadharan
    <org> wrote: 

    ....

     

    GCC a and 3 are not binary compatible. It looks like your libqt-mt was
    compiled with GCC 2.95.3, but the make system is picking up GCC 3.3. Try
    making sure that the former is the 1st in your path, or even
    uninstalling GCC 3.3.

    A bientot
    Paul
    --
    Paul Floyd http://paulf.free.fr (for what it's worth)
    Surgery: ennobled Gerald.
    Paul Guest

Similar Threads

  1. Problems linking to pdf on server
    By Robin in forum Web Design
    Replies: 2
    Last Post: November 29th, 05:29 AM
  2. Linking problems
    By Doug_Tait@adobeforums.com in forum Adobe Acrobat Windows
    Replies: 3
    Last Post: June 10th, 03:10 PM
  3. linking problems (CW)
    By HiddenRabbit in forum Mac Programming
    Replies: 3
    Last Post: August 19th, 12:06 AM
  4. Linking Problems
    By SamEl webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 17th, 11:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139