Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My terminal(FREE BSD) uses CShell by defualt , under which vim is working fine . But to run some testscripts , i have to use bash shell ,where some of my env variables are defined . Once i am in bash shell , if i start vim , it thorws this error

/libexec/ld-elf.so.1: Shared object "libgtk-12.so.2" not found, required by "vim"

vi is working fine though.Can some one help me solve this?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

A plausible explanation is that depending on which shell you're running, you have different environment variable settings. Compare the output of

echo $PATH
echo $LD_LIBRARY_PATH

under bash and under csh. Maybe $LD_LIBRARY_PATH includes the location of libgtk-12.so.2 when you're in csh but not when you're in bash. Or maybe $PATH leads to a different vim executable in csh and in bash (one that requires gtk in bash, and one that doesn't require gtk in csh). To check this, run type vim under bash and which vim under csh.

EDIT: based on your comments, there's a vim in /volume/perl/bin/vim that doesn't work for you, but you also need something in /volume/perl/bin to come first in the PATH, probably perl. You have several solutions:

  • Put /volume/perl/bin/vim first in $PATH, and put alias vim=/usr/local/bin/vim in your .bashrc and your .cshrc.

  • Don't put /volume/perl/bin/vim in $PATH at all, but arrange to run the perl scripts with /volume/perl/bin/vim instead of your local perl.

  • Don't put /volume/perl/bin/vim in $PATH at all. Instead, put ~/bin first in $PATH, and create symbolic links to what you need from /volume/perl/bin in ~/bin, e.g., ln -s /volume/perl/bin/perl ~/bin.

  • Try setting PERL5LIB and not PATH, in case what you need is not a newer version of perl but some extra libraries. E.g. setenv PERL5LIB /volume/perl/lib/perl/5.10 (adjust to whatever directories are needed; you can see the default directories for /volume/perl/bin/perl by running /volume/perl/bin/perl -le 'map print, @INC').

  • Upgrade your perl so that your scripts works with them (perhaps in addition to the previous suggestion).

  • Install the libraries that /volume/perl/bin/vim needs.

  • Remove vim from /volume/perl/bin.

Whatever you do, I don't recommend to have different PATH settings in different shells, it gets confusing very quickly (as you've already noticed). Set PATH in .login (assuming csh is your login shell, otherwise in .profile).

share|improve this answer
    
yes.my $PATH has a few extra pathes to perl libraries which is creating the problem as you can see in my comment above. –  MIkhail Sep 7 '10 at 3:49
add comment

You mention terminal, but the library that it's complaining about is a GUI library. Do you care about GUI? if not, you may be able to force no gui and not attempt to load this lib, but I'm far from a vim guru. You can even unset your DISPLAY, and vim will have to run in terminal mode.

As other's have answered, it's probably your LD_LIBRARY_PATH, or you're using a different vim than you're thinking. See what's set in both bash and csh., and the differences

Also try the ldd command, it will show you what libraries your app is able to load. it should fail on bash to resolve

On many systems, vi and vim are two separate installs, vim more featured for general editing, and a slimmed down, very few dependency version called vi for emergency mode. I'm sure vi will work in either.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.