Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readline: pkg-config support doesn't work #38972

Closed
3 of 6 tasks
andreabolognani opened this issue Apr 16, 2019 · 3 comments
Closed
3 of 6 tasks

readline: pkg-config support doesn't work #38972

andreabolognani opened this issue Apr 16, 2019 · 3 comments
Labels
outdated PR was locked due to age

Comments

@andreabolognani
Copy link
Contributor

  • are reporting a bug others will be able to reproduce and not asking a question or requesting software. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh. To get software added or changed in Homebrew please file a Pull Request
  • have a problem with brew install (or upgrade, reinstall) a single, Homebrew/homebrew-core formula (not cask) on macOS? If it's a general brew problem please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/issues/new/choose. If it's a Linux problem please file this issue at https://github.com/Homebrew/linuxbrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

Note: the missing 'x's above are caused by the fact that I don't have a macOS installation handy: I'm experiencing the issue in the context of Travis CI builds, and I don't have CLI access there.

What you were trying to do (and why)

libvirt tries to detect readline availability using pkg-config, and this works on Linux and FreeBSD but not on macOS.

See it in action:

https://travis-ci.org/andreabolognani/libvirt/jobs/520773233#L1088-L1093

The problem is that the readline.pc file contains

Requires.private: termcap

but the termcap.pc is nowhere to be found, so pkg-config reports readline as non-usable.

I believe the problem lies in the fact that readline does not depend on ncurses: readline tries to figure out at configure time what dependencies it needs, and since ncurses is not present in the build environment it ends up picking termcap (possibly from the base system?) and storing that into readline.pc, which ultimately leads to the file not being usable. If ncurses was present at build time, then the file would contain

Requires.private: ncurses

as it does on Linux instead and, since the ncurses package contains a working ncurses.pc file, readline.pc would be usable as well.

Note that I haven't tested any of the above, so it might not be completely accurate :)

An alternative approach would be to do what FreeBSD does and ditch the Requires.private directive altogether:

https://github.com/freebsd/freebsd-ports/blob/master/devel/readline/Makefile#L42-L44

This will also work, as seen in:

https://travis-ci.org/andreabolognani/libvirt/jobs/520783508#L1092-L1093

but it seems to me that depending on ncurses would be a less hacky way to solve the issue.

What happened (include command output)

$ export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig:$PKG_CONFIG_PATH"
$ pkg-config --cflags --libs readline
Package termcap was not found in the pkg-config search path.
Perhaps you should add the directory containing `termcap.pc'
to the PKG_CONFIG_PATH environment variable
Package 'termcap', required by 'readline', not found

$

What you expected to happen

$ export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig:$PKG_CONFIG_PATH"
$ pkg-config --cflags --libs readline
-I/usr/local/Cellar/readline/8.0.0/include/readline -L/usr/local/Cellar/readline/8.0.0/lib -lreadline
$

Step-by-step reproduction instructions (by running brew install commands)

$ brew update
$ brew install readline
$ export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig:$PKG_CONFIG_PATH"
$ pkg-config --cflags --libs readline
@fxcoudert
Copy link
Member

An alternative approach would be to do what FreeBSD does and ditch the Requires.private directive

We would welcome a pull request to that effect.

@andreabolognani
Copy link
Contributor Author

An alternative approach would be to do what FreeBSD does and ditch the Requires.private directive

We would welcome a pull request to that effect.

I'll happily provide one, with the obvious caveat that it will be pretty much completely untested since I don't have access to a macOS machine :)

Just so we're on the same page, I take it that you don't consider adding depends_on: "ncurses" to readline to be a suitable solution to the problem?

@fxcoudert
Copy link
Member

adding depends_on: "ncurses" to readline

No, we won't do that.

andreabolognani added a commit to andreabolognani/homebrew-core that referenced this issue Apr 26, 2019
Closes Homebrew#38972.

Signed-off-by: Andrea Bolognani <eof@kiyuko.org>
@lock lock bot added the outdated PR was locked due to age label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants