Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1056189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:40:48+00:00 2026-05-16T17:40:48+00:00

A simple question – is there any way to make the g++ linker to

  • 0

A simple question – is there any way to make the g++ linker to link with a specific libstdc++ library version? I didn’t find anything useful in the man page of gcc/g++, neither in other questions here.

Here’s the situation – my application uses a specific shared library, that’s built with libstdc++.so.5 and I want to install and use it on RHEL5. So, when I try to build the application on a RHEL5 machine, I got the warning:

warning: libstdc++.so.5, needed by ..the_shared_library_.. may conflict with libstdc++.so.6

Installing a compat-libstdc++ rpm didn’t help, the program crashes on a destructor of std::string, because of the incapability. So, on this RHEL5 machine I have this:

[root@xxx]# ll /usr/lib/libstd*  
-rwxr-xr-x 1 root root 259532 Aug 21 2006 /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so  
lrwxrwxrwx 1 root root 31 Jul 28 19:35 /usr/lib/libstdc++-libc6.2-2.so.3 -> libstdc++-3-libc6.2-2-2.10.0.so  
lrwxrwxrwx 1 root root 18 Aug 24 15:08 /usr/lib/libstdc++.so.5 -> libstdc++.so.5.0.7  
-rwxr-xr-x 1 root root 733456 Aug 21 2006 /usr/lib/libstdc++.so.5.0.7  

and when I make

[root@xxxx]# ldd my_exe  
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00333000)  
...  
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00ddf000)

which is bad, as I know it’s undefined behavior :/

So, is there any way to build my executable using only libstdc++.so.5 ? (removing libstdc++.so.6 is not an option because of many reasons. Static linking is not an option, too ).

Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:40:49+00:00Added an answer on May 16, 2026 at 5:40 pm

    Here’s the ABI versions table; the default value for the -fabi-version switch changed from 1 to 2 at the same time g++ introduced libstdc++.so.6 with 3.4. This means that to link against the older libstdc++ library you would need to

    • find and use the equivalent C++ headers instead of the ones included with your compiler
    • recompile all your code (and any other C++ libraries you’re using) with -fabi-version=1

    otherwise you run the risk of ABI incompatibilities. I can’t tell you precisely what the changes were but in general it’s best to try and keep all C++ code you have compiled with the same compiler version.

    Assuming you don’t want to try and hack things togther like this I think you have two choices:

    1. ask your shared library vendor to recompile the library with your version of GCC for you. This may not be trivial as g++ 3.4 introduced a new stricter C++ parser.
    2. ask your vendor which version of g++ they used to compile the library in the first place and use that version to compile your own code. RH might provide a compat-gcc compiler as well as the libstdc++ – I can’t remember. However you’ll also need down-level versions of all other libraries and OS-provided C++ libraries that you’re using, so might be easiest to compile on a VM with an older Red Hat version that had the right compiler.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question, but one that I've been curious about...is there a functional difference between
Simple question, hopefully an easy way and just want to verify I'm doing it
Simple question, how do you list the primary key of a table with T-SQL?
Simple question - I've got a bucketload of cruddy html pages to clean up
Simple question that keeps bugging me. Should I HTML encode user input right away
Simple question: Can a swing frame be completely modal ( block all others windows
Simple question, spurred on by the removal of the target attribute in HTML 4.0
Simple question: How do I do this on one line: my $foo = $bar->{baz};
Simple question: Can I mix in my desktop application Java and JavaFX Script code?
Simple question; what's better and why? out.resize( in.size() ); T1::iterator outit = out.begin(); for(

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.