readline: fix dependency in pkgconfig file#3303
Open
jagot wants to merge 2 commits into
Open
Conversation
Member
|
Does this work? I see |
Contributor
Author
|
Sorry, I was not being clear. readline builds fine, the issue is that the generated MWE
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
int main(int argc, char* argv[]) {
char* line = readline("input something> ");
printf("Read input: %s", line);
return 0;
}
all: test-readline
CFLAGS=`pkg-config --cflags readline`
LDFLAGS=`pkg-config --libs readline`
test-readline: test-readline.o
gcc -o $@ $< $(LDFLAGS)
%.o: %.c
gcc -o $@ -c $^ $(CFLAGS)
.PHONY: clean
clean:
rm -f *.o test-readlineWithout this PRTested using v8.2 because v8.3 was built with my fix, and I don't want to nuke my environment, but the results are the same. $ cat cat $(pkg-config --path readline)
prefix=/opt/homebrew/Cellar/spack/1.1.0/opt/spack/darwin-m3/readline-8.2-4ir47ylbi7sdzlba2y2ntqm7ffkq3lto
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Readline
Description: Gnu Readline library for command line editing
URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
Version: 8.2
Requires.private: termcap
Libs: -L${libdir} -lreadline
Cflags: -I${includedir}
$ make && ./test-readline
gcc -o test-readline.o -c test-readline.c `pkg-config --cflags 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
gcc -o test-readline test-readline.o `pkg-config --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
Undefined symbols for architecture arm64:
"_readline", referenced from:
_main in test-readline.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [test-readline] Error 1With this PRcat $(pkg-config --path readline)
prefix=/opt/homebrew/Cellar/spack/1.1.0/opt/spack/darwin-m3/readline-8.3-rxoyy4phdadh5isghpfz3orodumnbaqa
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Readline
Description: Gnu Readline library for command line editing
URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
Version: 8.3
Requires.private: ncurses
Libs: -L${libdir} -lreadline
Cflags: -I${includedir}
$ make && ./test-readline
gcc -o test-readline.o -c test-readline.c `pkg-config --cflags readline`
gcc -o test-readline test-readline.o `pkg-config --libs readline`
input something> hello there
Read input: hello there |
Contributor
Author
|
Friendly bump :) |
b696cbb to
f605ad2
Compare
f605ad2 to
19e77db
Compare
bernhardkaindl
approved these changes
Jun 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensure correct dependency on ncurses (and not the ancient termcap) is listed in the generated pkgconfig for readline. This is important for programs linking to readline, who will look for a (probably non-existent) termcap library, when readline was in fact built against ncurses.