Find the answer to your Linux question:
Results 1 to 10 of 10
Hello everyone i think i did a terrible thing, so i would like to ask you how terrible this actually is, and what i should have done instead i have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2014
    Posts
    9

    updating libstdc++6


    Hello everyone

    i think i did a terrible thing, so i would like to ask you how terrible this actually is, and what i should have done instead

    i have a program which relies on libstdc++, and it compiles and runs fine on my desktop computer, but not on my laptop, no matter if i compile it on the former or the latter
    both machines are running linux mint x64. mint 14 on the laptop, mint 16 on the desktop

    the error comes up when i run the program, and the console informs me that GLIBCXX_3.4.18 is needed but not found in libstdc++.so.6

    investigating a bit, i found out that i had installed libstdc++.so.6.0.14, which does not have that version of glibcxx

    i could not update the package "the nice way", as "sudo apt-get update && sudo apt-get install libstdc++6" says that my version is already up to date

    so i went to my compiler's directory, grabbed an updated version of the file (6.0.1.19 IIRC), copypasted it into the same dir as the old one, and changed the symlink libstdc++.so.6 to point to the new file
    now the executable runs fine, and there doesn't appear to be any problem

    did i somehow damage the system? what is the correct fix for that problem?

    thanks

  2. #2
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,311
    You may have some/many programs that don't function properly. You might not have any problems. The good news is that the Linux kernel is written in C and does not use C++.

    If you have a problem you can put reverse the symlink.

  3. #3
    Just Joined!
    Join Date
    Jul 2014
    Posts
    9
    Quote Originally Posted by gregm View Post
    You may have some/many programs that don't function properly. You might not have any problems. The good news is that the Linux kernel is written in C and does not use C++.

    If you have a problem you can put reverse the symlink.
    thank you, that's a good news!

    but still, what is the correct way of doing it? i need to run that program on yet another machine, this one is rocking ubuntu 10.04 x64, should i do the same thing?
    can i use the same file i used on my laptop, or do i need to install an updated version of gcc on that machine and grab the file from that installation?

    edit: i found out that ubuntu10.04 needs to update glibc as well to run the program
    Last edited by Ciccioo; 08-11-2014 at 12:20 PM.

  4. #4
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,311
    It's possible to have two versions but there's quite a bit to setting up and using the one that isn't correct for your distro. You need the correct loader path in the executable and the libraries need to be built with it. The --rpath compiler option can be used to set the libc path and --dynamic-linker sets the path to the ld-linux shared library. If you are going down this road then I suggest a web search for instructions.

  5. #5
    Just Joined!
    Join Date
    Jul 2014
    Posts
    9
    Quote Originally Posted by gregm View Post
    and the libraries need to be built with it
    so i need to recompile gcc on that machine, to get the libraries?
    then, i will put those libraries in a custom folder, and i'll add the path of that folder to the library search paths list of my executable
    did i understand it correctly?

  6. #6
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,311
    No, you don't want to recompile gcc. Glibc is a separate entity from gcc. GNU Project Archives

  7. #7
    Just Joined!
    Join Date
    Jul 2014
    Posts
    9
    oh, thanks
    now, i downloaded glib2.19, and compiled it with configure/make/install
    i took libc.so.6 and placed it in the same dir as my executable, that i compiled with -rpath=.
    and... now i get a segmentation fault

  8. #8
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,311
    Yes, like I said you need to set the dynamic linker path, ld-linux may need to match the version of libc, and you may also need to recompile some libraries for it. It's a process and you need to do it correctly.

    http://www.tldp.org/HOWTO/Glibc2-HOWTO.html

  9. #9
    Just Joined!
    Join Date
    Jul 2014
    Posts
    9
    this is going to take some time
    i may or may not have broken the system with my first try, so tomorrow i'll try to recover it and give the link a deeper and careful read
    thanks for your patience

  10. #10
    Just Joined!
    Join Date
    Jul 2014
    Posts
    9
    update:
    this procedure is too much for me, i don't understand what it does, how or why, so i really don't think i can work much on it, and i can't go with trial and error risking to break the system every time
    i'm downgrading my program to an older version of the language, so that i can compile it with gcc 4.4 and the system native libraries
    this is bugging me though, i'll try again when i will understand a bit better how things work
    thanks again for your help!

Posting Permissions

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