I would like to compile
less with latest fixes.
I do this:
git clone https://github.com/gwsw/less cd less/ autoheader autoconf ./configure make
make says this:
make: *** No rule to make target 'funcs.h', needed by 'main.o'. Stop.
There are no Makefile rules that create
So, how to compile
less from source?
Here is Solutions:
We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.
As explained in Thomas Dickey’s answer, the git repository needs preparation before it can be used to build, and one required file can’t be recreated using the provided files.
To build less, download its latest release tarball and build that:
wget http://greenwoodsoftware.com/less/less-530.tar.gz tar xf less-530.tar.gz cd less-530 ./configure && make
Note however that version 530 has a few annoying bugs which are fixed in the git repository. (This could be why the Debian package hasn’t been updated.)
Alternatively, you can update the Debian package:
sudo apt build-dep less sudo apt install devscripts apt source less cd less-487 uscan cd .. tar xf less_530.orig.tar.gz cd less-530 cp -a ../less-487/debian . dch -v 530-0.1 "New upstream release." dch -r ignored debuild -uc -uc
This will produce a
yourarch is probably
amd64), which you can install using
sudo dpkg -i. As JdeBP points out, this will ensure that the Debian patches are applied, and that the appropriate
configure options are used; it will also give you the benefits of using a package instead of a manual installation.
gbp fans like myself, the following recipe uses a git repository which makes any changes more obvious:
sudo apt build-dep less sudo apt install devscripts git-buildpackage gbp import-dsc --pristine-tar apt://less/sid cd less gbp import-orig --pristine-tar --uscan dch -v 530-0.1 "New upstream release." dch -r ignored gbp buildpackage -us -uc --git-ignore-new
(In both cases, strictly speaking you should use
dch -n and
dch -v, or at least add “Non-maintainer upload.” to the changelog, but that’s harder to do in a copy-pastable way.)
“Makefile.in” is an input to “configure”, which generates “Makefile”. You need not specify “Makefile” in the make-command. So this should work better:
(though you may have left files in that directory which should be removed before re-running configure).
Running from git, you’re missing the distribution files such as configure. If you have a suitable version of autoconf installed, you would have to prepare the build by first running
However, the git tree also omits “defines.h.in” — more preparation is needed: none of the files in git appears to match the needed template. You might be able to reuse the corresponding file from a release tar-ball, though that’s unreliable (like any other source-file, it changes). Since the documentation doesn’t mention this step, a bug report to the developer might help.
The revised question asks about
funcs.h, which can be created using the rule in
Makefile.aut (“Makefile for authoring less”, according to the comment at the top of the file). But as of 2018/09/17, there still is no rule to create
defines.h.in (use grep to answer these questions).
Here’s the method I just successfully used on Ubuntu 18.04:
git clone https://github.com/gwsw/less.git
autoreconf -i# install the
autoconfpackage if you haven’t already
make -f Makefile.aut dist
This creates a directory
less-550.zip. It also attempts to create a gpg signature for
less-550.tar.gz. That hung on my system, so I killed the
gpg --detach-sign ... process from another window. You could also just kill the
less-550.tar.gz is a standard buildable source tarball, which you can install as usual:
tar xf less-550.tar.gz
./configure --prefix=some-directory other-options
The most interesting options for
./configure are probably:
--with-regex=LIB select regular expression library (LIB is one of auto,none,gnu,pcre,pcre2,posix, regcmp,re_comp,regcomp,regcomp-local) [auto] --with-editor=PROGRAM use PROGRAM as the default editor [vi]
./configure --help for a full list of options.
This sequence does the job, but I’m not sure that it is correct:
git clone https://github.com/gwsw/less cd less/ autoheader autoconf ./configure make -f Makefile.aut funcs.h make make -f Makefile.aut less.nro make -f Makefile.aut lesskey.nro make -f Makefile.aut lessecho.nro make install
Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂