LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-23-2007, 10:33 AM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
unlinking a symbolic link


Hello, I hope I've used the correct termanology here. Basically I installed a driver which changed my libstdc to version 5, I was running 6. I tried to reindstall 6, which appeared to work, however when I now try to run my code I get an error reporting OpenGL is running version 5 rather than 6.
On inverstigation I found that /usr/lib/libstdc++ is now pointing to both version 5 and 6

debian:~# locate /usr/lib/libstdc++
/usr/lib/libstdc++.so
/usr/lib/libstdc++.so.5
/usr/lib/libstdc++.so.5.0.6
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.8

So I need to unlink 5 and 5.0.6 but am unsure how to do this? I linked using the ln command, but cannot seem to find a switch to remove the 5's. Can anyone help
 
Old 06-23-2007, 10:48 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Did you do "ln -s" or just "ln". You don't really "unlink" - you "remove".

ln can do hard links (ln without -s option) or symbolic links (a/k/a slinks - made with -s option).

To determine what links you have use the ls -l command:
ls -l /usr/lib/libstdc++.so*

So on my Fedora Core (FC) 4 system I see:
ls -l /usr/lib/libstdc++*
lrwxrwxrwx 1 root root 18 Nov 6 2006 /usr/lib/libstdc++.so.5 -> libstdc++.so.5.0.7
-rwxr-xr-x 1 root root 744168 Mar 8 2005 /usr/lib/libstdc++.so.5.0.7
lrwxrwxrwx 1 root root 18 Jul 19 2006 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.7
-rwxr-xr-x 1 root root 933428 May 19 2005 /usr/lib/libstdc++.so.6.0.4
-rwxr-xr-x 1 root root 892148 Nov 25 2005 /usr/lib/libstdc++.so.6.0.7

The entries with the right arrows are slinks. The file on the right side of the arrow is the file to which it is linked. So to remove libstdc++.so.5 which is an slink to libstdc++.so.5.07 you would simply type "rm /usr/lib/libstdc++.so.5". This would leave /usr/lib/libstdc++.so.5.0.7 in place. (Notice this 5.0.7 does NOT have a right arrow next to it so is NOT an slink.)

If you notice the number between the permissions and the owner (e.g. rwxr-x-r-x and root) is the "link count". If you had hard linked files you would see a number greater than 1. With hard linked files you can remove any of them and you'll see the link count decrease.

To verify two files that have the same link count are actually the same file you can type "ls -i" on each. This shows you the inode number - hard linked files all have the same inode. (slinks do not have the same inode).

One reason for slinks is because they don't require the same inode they can actually go across filesystems which hard links can not. (When I first started doing UNIX there was no such thing as slinks.)

On a hard link ANY change to the file (except removing it) is reflected on all of the linked copies. On slinks writes to and reads from the slink are done to/from the original file. However, it is possible to change permissions on the slink without changing them on the original.

Last edited by MensaWater; 06-23-2007 at 04:30 PM.
 
Old 07-03-2007, 08:17 AM   #3
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
ldconfig will delete symlinks associated with sonames anyway, and everything should still be linked correctly. The only thing it should effect is newly-linked programs, so just run ldconfig again and see if that fixes it. You probably only need to remove libstdc++.so and ln -s it to libstdc++.so.6.
ta0kira

PS Drivers should not be changing that symlink. That is an internal library for use by g++. I assume you downloaded a precompiled driver and it installed 5 as a dependency. I'd send a suggestion to the developer that they shouldn't be overwriting symlinks for dependencies.

Last edited by ta0kira; 07-03-2007 at 08:20 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is a Symbolic Link? little_penguin Linux - Software 2 05-14-2005 09:27 AM
symbolic link ilnli Slackware 6 01-04-2005 05:05 PM
symbolic link jsetter Linux - Newbie 4 11-22-2004 07:18 AM
Symbolic link. bulzbb Linux - General 8 03-19-2004 04:57 AM
Symbolic link bwaynej2002 Linux - General 8 08-25-2003 10:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration