2

I am trying to compile my favorite nano command-line text editor with some of the options.

Actually, most of the options in order to enable all features.


First, I go to Downloads directory and download the tarball:

cd Downloads

wget --continue https://www.nano-editor.org/dist/v2.8/nano-2.8.0.tar.xz

Then, I verify its integrity:

wget --continue https://www.nano-editor.org/dist/v2.8/nano-2.8.0.tar.xz.asc

gpg --verify nano-2.8.0.tar.xz.asc

It should say:

gpg: Good signature from "Benno Schulenberg <bensberg@justemail.net>"

I have tried to run the configuration script as follows:

./configure --enable-nanorc --enable-color --enable-extra --enable-multibuffer --enable-utf8 --enable-libmagic --enable-speller --disable-wrapping-as-root

After compilation, I end up with this; directly executed in the compiled directory:

Compiled options: --disable-libmagic ...

I stress the:

--disable-libmagic

As I specifically configured it with:

--enable-libmagic    

After no success:

  1. I delete the folder to start the process over:

    rm -rf nano-2.8.0/
    
  2. I extract again the archive:

    tar -xJf nano-2.8.0.tar.xz
    
  3. I have tried different combinations of options, but no luck.


Is there anything missing in the system or am I just doing something wrong?


Direct execution after the compilation:

user@computer ~/Downloads/nano-2.8.0/src $ ./nano --version
GNU nano, version 2.8.0
(C) 1999..2016 Free Software Foundation, Inc.
(C) 2014..2017 the contributors to nano
Email: nano@nano-editor.org Web: https://nano-editor.org/
Compiled options: --disable-libmagic --disable-wrapping-as-root --enable-utf8
4

Nano doesn't store the compiled options as provided on the ./configure command-line, it reconstructs them based on detected features and the requested target ("tiny" Nano or normal Nano). For tiny Nano, it reports enabled options, since they add to the default; for normal Nano, it reports disabled options, since they remove from the default (in most cases).

In your case, you're building normal Nano, so for most options it only reports if they're disabled; the exceptions are debug, utf8 and slang. All your --enable options are defaults for normal Nano, so it doesn't report them in the compiled options; you'd get the same result with ./configure and no options. You end up with --disable-magic because you don't have the development files for libmagic (see Thomas Dickey's answer), and with --enable-utf8 because you do have the necessary features for UTF-8 support (and it's enabled by default).

2

You need a development package for libmagic. On my Debian system that's libmagic-dev for instance.

If you do not have the development library installed, the configure script tells you this. Here is what it shows without the library:

checking whether LINES and COLS can be redefined... yes
checking magic.h usability... no
checking magic.h presence... no
checking for magic.h... no
checking for magic_open in -lmagic... no

and after installing the package:

checking whether LINES and COLS can be redefined... yes
checking magic.h usability... yes
checking magic.h presence... yes
checking for magic.h... yes
checking for magic_open in -lmagic... yes

The feature that you are checking is a definition in config.h, i.e., HAVE_LIBMAGIC (though you also need the header file, as shown):

/* Define to 1 if you have the `magic' library (-lmagic). */
#define HAVE_LIBMAGIC 1

/* Define to 1 if you have the `z' library (-lz). */
#define HAVE_LIBZ 1

/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1

/* Define to 1 if you have the <magic.h> header file. */
#define HAVE_MAGIC_H 1
0

According to the bug report's reply:

All options are enabled by default (except debug), so all your --enable-nanorc etcetera are superfluous. And as Thomas has explained on Stackexhange, you need some -dev package if you want libmagic support (but I would advice against it -- it brings very little and is a major slowdown during startup).

Both of you are right. Thank you Thomas and Stephen.

Only one thing was still missing; nano does not read my /etc/nanorc file as reported.

According to the developer, the following may do, and it does:

sudo ln -nsf /etc/nanorc /usr/local/etc/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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