public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: LLeweLLyn Reese <llewelly@lifesupport.shutdown.com>
To: "Ajay Bansal" <Ajay_Bansal@infosys.com>
Cc: <gcc-help@gcc.gnu.org>
Subject: Re: Version of shared libs Vs Name mangling.
Date: Thu, 06 Mar 2003 23:13:00 -0000	[thread overview]
Message-ID: <x3fzq0w0ph.fsf@lifesupport.shutdown.com> (raw)
In-Reply-To: <2B721C6525F0D411B1E900B0D0226BDD02149107@mohmsg01.ad.infosys.com>

"Ajay Bansal" <Ajay_Bansal@infosys.com> writes:

> Can I know, with which version of gcc a binary has been built???

Not really. If the executable is dynamicly linked, was written in C++,
    and uses the C++ standard library, run ldd on the executable. You
    should see something like the following:


[llewelly@localhost cc_moderated_examples]$ ldd ./a.out
        libstdc++.so.5 => not found
        libm.so.6 => /lib/libm.so.6 (0x40026000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40048000)
        libc.so.6 => /lib/libc.so.6 (0x40052000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

The line you are looking for is the one of the form 'libstdc++.so.X'
    where X is 2,3,4,5 . In this case it happens to be the first line,
    but don't count on that; if the executable uses a shared library,
    (say, gtkmm) which uses the standard c++ library, that will
    typically come before libstdc++.

If X is 5, the application was linked against the gcc 3.2 library,
    and was in all likelyhood compiled by 3.2 .

    libstdc++.so.5 => comes with gcc 3.2
    libstdc++.so.4 => comes with gcc 3.1
    libstdc++.so.3 => comes with gcc 3.0 *or* gcc 2.96
    libstdc++.so.2 => comes with gcc 2.95

That's partly from memory; I've only got 3.2, 3.1, and 2.96, so the so
    numbers for 3.0 and 2.95 may be different from what I list.

(Yes, I know the a.out in the example above will not execute due to
    libstdc++.so.5 not being found, but that isn't relevant.)

> -----Original Message-----
> From: Ajay Bansal 
> Sent: Thursday, March 06, 2003 12:40 PM
> To: gcc-help@gcc.gnu.org
> Subject: Version of shared libs Vs Name mangling.
> 
> 
> Hi All
> 
> Pleeeeeeeeeeease help me out.. (otherwise I am sure to get some hard
> thrashing)
> 
> I am working on RH73, gcc version 3.2.1.
> 
> I have a binary which is dependent on xercec-c libraries. My code uses a
> function XMLException.
> 
> Now there are different versions of libxerces-c available. In version
> 1.5.1 this symbol is mangled as __12XMLException
> 
> While in the version 2.1.0, it is mangled as 
> _ZTI12XMLException

hm.

[llewelly@localhost cc_moderated_examples]$/usr/local/gcc-3.2.2/bin/c++filt
_ZTI12XMLException
typeinfo for XMLException
__12XMLException
XMLException::XMLException(void)

The above is me feeding those two symbols to the c++filt that comes
    with gcc 3.2.2 . c++filt demangles c++ symbols. The first is a
    typeinfo node, and the second is a function. So in the first case,
    you've mis-identified the symbol. I suggest you read the info
    pages for nm and c++filt.

> Now, initially my code was using 2.1.0 version of shared lib. But due to
> some problems (beyond reach of normal developers like me), we had to
> shift to 1.5.1. I built my product using 1.5.1 version. But while
> testing, in the test environment libraries of both versions were
> present. [:(:(:( ].

> 
> So the above symbol was picked from 2.1.0 libxerces-so.lib. But now when
> the final package is sent out for testing, it does not have any 2.1.0
> libs. Now we get the "undefined symbol error".. :(
> 
> I have to stick to 1.5.1. how can I resolve this error????

Take 2.1.0 out of your development environment.

  reply	other threads:[~2003-03-06 23:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-06 11:25 Ajay Bansal
2003-03-06 23:13 ` LLeweLLyn Reese [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-06  7:10 Ajay Bansal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x3fzq0w0ph.fsf@lifesupport.shutdown.com \
    --to=llewelly@lifesupport.shutdown.com \
    --cc=Ajay_Bansal@infosys.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).