Skip to content

cannot compile tig with readline support on macOS Big Sur (11.1) #1072

@edentsai

Description

@edentsai

Sorry for my poor english 🙏

I am trying to install tig with readline support on macOS to record ~/.tig_history,
but the ./configure can't detect the version of installed readline library while compile tig.

In short:

$ brew info readline
readline: stable 8.1 (bottled) [keg-only]
...

$ ./autogen.sh
$ ./configure prefix="${PWD}/local" --with-readline="/usr/local/opt/readline"
...
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
checking version of installed readline library... none.
configure: WARNING: Could not test version of installed readline library.
configure: WARNING: Minimum required version of readline is 6.3
...

the output of ./configure displayed:

checking version of installed readline library... none
configure: WARNING: Could not test version of installed readline library.
configure: WARNING: Minimum required version of readline is 6.3

I can't figure out where is the problem. :(


Details

my workstation information:

  • macOS Big Sur (11.1)
  • Homebrew 2.7.5-74-g7242cd6
  • Readline 8.1 (installed via Homebrew)
  • tig version 2.5.1

Install tig via Homebrew can't enable readline support:

$ brew uninstall tig
$ brew install tig

# tig doesn't enable readline support
$ tig --version
tig version 2.5.1
ncurses version 5.7.20081102
$ brew info tig
tig: stable 2.5.1 (bottled), HEAD
Text interface for Git repositories
https://jonas.github.io/tig/
/usr/local/Cellar/tig/2.5.1 (15 files, 880.8KB) *
  Poured from bottle on 2021-01-20 at 15:41:27
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/tig.rb
License: GPL-2.0
==> Dependencies
Required: readline ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
A sample of the default configuration has been installed to:
  /usr/local/opt/tig/share/tig/examples/tigrc
to override the system-wide default configuration, copy the sample to:
  /usr/local/etc/tigrc

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
$ brew info readline
readline: stable 8.1 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/8.1 (49 files, 1.6MB)
  Poured from bottle on 2020-12-10 at 21:48:09
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/readline.rb
License: GPL-3.0-or-later
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BSD libedit.

For compilers to find readline you may need to set:
  export LDFLAGS="-L/usr/local/opt/readline/lib"
  export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

I also tried manually compile tig from the source code,
it still cannot enable readline support,
I think the reason is ./configure cannot detect the version of installed readline library for me.

$ git clone git@github.com:jonas/tig.git
$ cd tig
$ git checkout tig-2.5.1

$ brew --prefix readline
/usr/local/opt/readline
$ mkdir ./local
$ ./autogen.sh
$ ./configure prefix="${PWD}/local" --with-readline="/usr/local/opt/readline" \
    && make install
...
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
# ↓↓↓ NOTE: It cannot detect the version of installed readline library.
checking version of installed readline library... none
configure: WARNING: Could not test version of installed readline library.
configure: WARNING: Minimum required version of readline is 6.3
...

# tig still doesn't enable readline support
$ ./local/bin/tig --version
tig version 2.5.1
ncurses version 5.7.20081102

I can't figure out where is the problem about this:

checking version of installed readline library... none

but I found a workaround to manually set ac_cv_rl_version="8.1" variable while execute ./configure:

# clean previous build/compiled
$ cd ..
$ rm -rf tig
$ git clone git@github.com:jonas/tig.git
$ cd tig
$ git checkout tig-2.5.1

$ mkdir ./local
$ ./autogen.sh
$ ac_cv_rl_version="8.1" ./configure prefix="${PWD}/local" --with-readline="/usr/local/opt/readline" \
    && make install
...
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
# ↓↓↓ NOTE: It works if I manually set `ac_cv_rl_version="8.1"`
checking version of installed readline library... (cached) 8.1
...

# This time, tig enable readlline support.
$ ./local/bin/tig --version
tig version 2.5.1
ncurses version 5.7.20081102
readline version 8.1  # <<< IT WORKS

When I manually set ac_cv_rl_version="8.1" to run ./configure,
it will enable readline support.

checking version of installed readline library... (cached) 8.1

but I don't know how to fix this problem without set ac_cv_rl_version variable by myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions