unable to compile vim with luajit for centos

341 views
Skip to first unread message

flashburn

unread,
Apr 28, 2017, 1:25:13 AM4/28/17
to vim_dev
I was trying to compile vim for CentOS 7 with LuaJit support.

The script that I used for installation is located here, https://gist.github.com/lambdalisue/01996ca7877f72b860b2

When I run vim in my terminal I get the following message

vim: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory

I searched where the library is located and found it in /usr/local/lib/libluajit-5.1.so.2.

Decided to look through the ./configure output and found the following line in vim/src/auto/config.status:

S["LUA_LIBS"]="-L/usr/lib -lluajit-5.1"

Just in case logged the output of a ./configure. Here is what I got:

checking --with-lua-prefix argument... no
checking LUA_PREFIX environment var... not set, default to /usr
checking --with-luajit... yes
checking for luajit... (cached) /usr/local/bin/luajit
checking LuaJIT version... (cached) 2.0
checking Lua version of LuaJIT... (cached) 5.1
checking if lua.h can be found in /usr/include/luajit-2.0... checking if lua.h can be found in /usr/include... yes
checking if link with -L/usr/lib -lluajit-5.1 is sane... yes

It looks like is saying that it can find luajit-5.1 lib in /usr/lib but it is actually not there.

Is this a ./configure failure or I'm doing something wrong?

Kazunobu Kuriyama

unread,
Apr 28, 2017, 9:29:29 AM4/28/17
to vim...@googlegroups.com
2017-04-28 14:25 GMT+09:00 flashburn <rail.sh...@gmail.com>:
I was trying to compile vim for CentOS 7 with LuaJit support.

The script that I used for installation is located here, https://gist.github.com/lambdalisue/01996ca7877f72b860b2

When I run vim in my terminal I get the following message

vim: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory

(Although the title says "unable to compile", but the error message above indicates that you actually succeeded in compile and did 'make install', and that the vim giving you the message was the one you built and installed successfully.    With this understanding, I'm going to write this to you.)

First of all, check which libluajit the vim is linked against.

    $ ldd /path/to/your/vim

If the vim is indeed linked against libluajit in /usr/local/lib, try this on the command line:

    $ LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH /path/to/your/vim

If it doesn't issue any error message, there're two different options you have.

(1) Add the following line

    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

to your ~/.profile, ~/.bashrc or whatever file your login shell reads at initialization.  You will need to change the line if you use a login shell other than bash, of course.

(2) (If you can exercise the root privilege)

Open /etc/ld-so.conf with Vim, and add the following line

    /usr/local/lib

to the file.  Save it and quit the editor.

Then, run

    $ ldconfig

to update the cache for the dynamic loader.

After you do either (1) or (2), 

    $ vim

should run without any error.


I searched where the library is located and found it in /usr/local/lib/libluajit-5.1.so.2.

Decided to look through the ./configure output and found the following line in vim/src/auto/config.status:

S["LUA_LIBS"]="-L/usr/lib -lluajit-5.1"

Just in case logged the output of a ./configure. Here is what I got:

checking --with-lua-prefix argument... no
checking LUA_PREFIX environment var... not set, default to /usr
checking --with-luajit... yes
checking for luajit... (cached) /usr/local/bin/luajit
checking LuaJIT version... (cached) 2.0
checking Lua version of LuaJIT... (cached) 5.1
checking if lua.h can be found in /usr/include/luajit-2.0... checking if lua.h can be found in /usr/include... yes
checking if link with -L/usr/lib -lluajit-5.1 is sane... yes

That's the most weird thing.   If there's no such a library in /usr/lib, the linker is supposed to issue an error and the configure script aborts due to that.

Did you try this?

     $ ./configure --with-lua-prefix=/usr/local  <other options>

If neither of the ways I mentioned above works for you, and you didn't try that yet, give it a try and see if that works for you.


It looks like is saying that it can find luajit-5.1 lib in /usr/lib but it is actually not there.

Is this a ./configure failure or I'm doing something wrong?

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages