Opened 6 months ago
Last modified 6 months ago
#73700 new defect
MacPorts fails to build with `configure --enable-readline` when pkgsrc has also installed a `readline` package which is incompatible.
| Reported by: | robohack (Greg A. Woods) | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | base | Version: | |
| Keywords: | Cc: | ||
| Port: |
Description
I have MacPorts just checked out from git:
commit 8c8e12d390192799a71238cba2468fead0e1a0f7 (HEAD -> master, origin/master, origin/HEAD)
I'm trying to build it on:
$ sw_vers ProductName: macOS ProductVersion: 26.3 BuildVersion: 25D125 $ xcodebuild -version Xcode 26.3 Build version 17C529
It fails to build with configure --enable-readline when the system has also has a separately installed a readline (and curl) package which is incompatible, e.g. in this case from pkgsrc.
In file included from readline.c:22:
/opt/pkg/include/readline/readline.h:409:23: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
409 | extern int rl_message ();
| ^
| void
readline.c:133:23: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
133 | generator_func = USERNAME_COMPLETION_FUNCTION;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| rl_username_completion_function
readline.c:54:39: note: expanded from macro 'USERNAME_COMPLETION_FUNCTION'
54 | # define USERNAME_COMPLETION_FUNCTION username_completion_function
| ^
/opt/pkg/include/readline/readline.h:486:14: note: 'rl_username_completion_function' declared here
486 | extern char *rl_username_completion_function PARAMS((const char *, int));
| ^
5 warnings and 1 error generated.
I'm not sure where it got the idea it should add -I/opt/pkg/include. I first see that here:
===> making all in src/pextlib1.0 clang -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED -g -O2 -std=c99 -Wextra -Wall -pedantic -I/opt/pkg/include -I/opt/mports/macports-base/vendor/tcl/pkgs/sqlite3.50.4/compat/sqlite3 -DHAVE_CONFIG_H -I/opt/mports/macports-base/src -I/opt/mports/macports-base/src -I. -I/opt/mports/macports-base/vendor/vendor-destroot/opt/local/libexec/macports/include -I./../compat -fno-common Pextlib.c -o Pextlib.o
config.log also contains:
CFLAGS_LIBCURL='-I/opt/pkg/include' CURL_CONFIG='/opt/pkg/bin/curl-config'
maybe that's where.
MacPorts should probably not look for dependencies outside of itself!
MacPorts should either supply its own libcurl, or use the one supplied by Apple in the appropriate MacOSX SDK.
I will retry with --with-curlprefix set to the SDK directory, but I argue this should not be necessary. This could/should be done automatically by tacking on "/usr" to the output of xcrun --show-sdk-path.
Change History (2)
comment:1 Changed 6 months ago by jmroot (Joshua Root)
| Component: | ports → base |
|---|
comment:2 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)
Replying to robohack:
It fails to build with
configure --enable-readlinewhen the system has also has a separately installed areadline
As Josh says, the problem with readline is known and tracked in #51969.
I'm not sure where it got the idea it should add
-I/opt/pkg/include.
From curl-config, as you suspected. That's tracked in #57160.
A fix for these issues was just proposed.
MacPorts should either supply its own libcurl
This is a protracted discussion; see #51516.
or use the one supplied by Apple in the appropriate MacOSX SDK.
MacPorts does use Apple's curl by default; it is only supposed to use a different curl if you point ./configure at it with --with-curlprefix or if you have a path in PATH preceding /usr/bin that contains another curl-config.
Instead of ./configure, use ./standard_configure.sh to remove non-system paths from PATH in which configure might otherwise find things you don't want it to find.

People building from source do often want to use dependencies in all kinds of places.
PATH,CFLAGS,CPPFLAGSandLDFLAGSin the environment when you run the configure script will affect where things are found. This is basically the same situation as #51969.