21. febrúar 2007

Update troubles....

For some unknown (possibly stupid) reason I decided to update the fink package manager today to a newer version. After a painstakingly long update process (needed to compile the whole thing on my machine) I discovered to my horror that I couldn't run any of the terminal programs. The only thing that happened was the printout of this error:
Reason: Incompatible library version: tar requires version 6.0.0 or later,
but libiconv.2.dylib provides version 5.0.0
(Was trying to run tar)

So after some digging around I discovered that a conflict existed between this libiconv.2.dylib file I (for some reason) had in two separate locations on my machine.
One was at: /sw/lib
ls -all /sw/lib/libiconv.*
1270620 Feb 21 15:06 /sw/lib/libiconv.2.3.0.dylib
20 Feb 21 15:06 /sw/lib/libiconv.2.dylib -> libiconv.2.3.0.dylib
20 Feb 21 15:06 /sw/lib/libiconv.dylib -> libiconv.2.3.0.dylib
804 Feb 21 15:06 /sw/lib/libiconv.la
The other was at:
ls -all /usr/lib/libiconv.*
    16 Aug 19  2005 /usr/lib/libiconv.2.2.0.dylib -> libiconv.2.dylib
987544 Oct 3 11:55 /usr/lib/libiconv.2.dylib
20 Aug 19 2005 /usr/lib/libiconv.dylib -> libiconv.2.2.0.dylib
786 Sep 11 22:48 /usr/lib/libiconv.la
Asking otool (man otool) to list the names and version numbers of the shared libraries that the object file uses reveiled the following:
otool -L /sw/lib/libiconv.2.dylib
/sw/lib/libiconv.2.dylib:
/sw/lib/libiconv.2.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.7)
otool -L /usr/lib/libiconv.2.dylib
/usr/lib/libiconv.2.dylib:
/sw/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.0.7)
There is indeed a discrepency between the versions of the two libiconv.2.dylib files. So what did I try? Ofcourse simply renaming the old version to a backup filename and creating a symlink to the new updated file in the /sw/lib directory. Simple right?

Wrong! This had to be one of those times when I make a typing-error and don't double check it. So I successfully created this symlink in the /usr/lib/ directory:
/usr/lib/libiconv.2.dylib -> /sw/lib/libconv.2.dylib
Notice the missing "i" in the target filename!

So after a hopefull restart I discovered to my horror that OS X was permanently stuck on the loading screen (apparently this library is used for some sort of character set conversions, don't ask). So, I was stuck. Couldn't log into my machine to correct the problem. Thank god I have a lot of higly skilled co-workers, one of which suggested that I'd try booting into OSX in single-user mode (omg, always learning something new!). So that gave me access to local computer through a simple the shell prompt. After some fumbling with unlocking the file-system (tip: 'fsck -y' then 'mount -uw /') I managed to undo my changes and reboot back into my normal system and by fixing the small typo and recreating the symlink, everything worked just fine.

A rather boring story I hope you agree, but a nice way of learning how to do a "safe-mode startup" on a Mac and re-mounting a read-write file-system.

Have phun kids :)

9. febrúar 2007

A worthy reminder...

Computer science is no more about computers
than astronomy is about telescopes.
--Edsger Dijkstra.