Search code examples
linuxvimraspbianraspberry-pi3ncurses

Raspbian building ncurses and vim from source


I don't have an internet connection and won't for at least a few weeks. I had to download a minimal version of Raspbian which vim isn't included by default. Without internet access on my Pi I'm not able to use the package manager.

I downloaded ncurses 6.0 from https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz and installed it to /opt/ncurses. In order to get it to build I had to export CPPFLAGS="-P" before running configure.

Next I grabbed vim 8.0 from ftp://ftp.vim.org/pub/vim/unix/vim-8.0.tar.bz2. When I try to run ./configure with the argument with-tlib=ncurses it fails with the message:

checking --with-tlib argument... ncurses
checking for linking with ncurses library... configure: error: FAILED

Looking in /opt/ncurses/lib I notice the development libraries aren't there.

pi@raspberrypi:/opt/ncurses/lib $ ls -l
total 7300
-rw-r--r-- 1 root root   92482 Nov 29 06:09 libform.a
-rw-r--r-- 1 root root 1138744 Nov 29 06:09 libform_g.a
-rw-r--r-- 1 root root   49122 Nov 29 06:09 libmenu.a
-rw-r--r-- 1 root root  653288 Nov 29 06:09 libmenu_g.a
-rw-r--r-- 1 root root  464600 Nov 29 06:09 libncurses.a
-rw-r--r-- 1 root root  135894 Nov 29 06:09 libncurses++.a
-rw-r--r-- 1 root root 4080812 Nov 29 06:09 libncurses_g.a
-rw-r--r-- 1 root root  498190 Nov 29 06:09 libncurses++_g.a
-rw-r--r-- 1 root root   20190 Nov 29 06:09 libpanel.a
-rw-r--r-- 1 root root  320340 Nov 29 06:09 libpanel_g.a
lrwxrwxrwx 1 root root      17 Nov 29 06:09 terminfo -> ../share/terminfo

Comparing this to what's in the libncurses5-dev (https://packages.ubuntu.com/trusty/arm64/libncurses5-dev/filelist) I can see the shared libraries here.

I haven't had to do this before manually so to be honest I'm not even sure if I'm on the right path. Should I have the shared libraries from the build or would I need to obtain them separately?


Solution

  • Originally I forgot the flag --with-shared during the configuration for ncurses. Because I also installed ncurses to /opt/ncurses I needed to first export LDPATH=-L/opt/ncurses/lib and then configure vim. enter image description here

    I got the hint for LDPATH from Cannot link ncurses while compiling vim.