Repository navigation
KNOWN_BUGS: drop the curl-config private details entry - #23102
Closed
xhon-pelushi wants to merge 1 commit into
Closed
xhon-pelushi wants to merge 1 commit into
xhon-pelushi wants to merge 1 commit into
Conversation
The entry says that `curl-config --libs` includes details set in LDFLAGS when configure was run, and that `curl-config --cflags` does the same with CFLAGS/CPPFLAGS. Neither is true any more. It was added in 2005 (c7a6346) with no linked issue, which is probably why nobody re-checked it. Two later changes fixed it without removing it: - 97aca09 (2020) made --libs echo LIBCURL_PC_LIBS_PRIVATE only when ENABLE_SHARED=no, so a normal shared build prints just '-L$libdir -lcurl'. - e244d50 (2024) filtered inherited LDFLAGS down to -L/-F/ --library-path=/-framework before they reach LIBCURL_PC_LDFLAGS_PRIVATE, and that variable is referenced only by --static-libs. --cflags cannot carry user flags at all: curl-config.in prints only @LIBCURL_PC_CFLAGS@ plus -I@includedir@, and configure.ac sets LIBCURL_PC_CFLAGS to either empty or the literal '-DCURL_STATICLIB', so CFLAGS and CPPFLAGS are never substituted into curl-config. Checked with a cmake build configured with poisoned flags: CFLAGS='-DPRIVATE_CFLAG_MARKER=1 -O2' CPPFLAGS='-I/opt/PRIVATE-INCDIR -DPRIVATE_CPPFLAG_MARKER=1' LDFLAGS='-L/opt/PRIVATE-LIBDIR -Wl,-rpath,/opt/PRIVATE-RPATH' BUILD_SHARED_LIBS=ON: --libs : -L/usr/local/lib -lcurl --cflags : -I/usr/local/include BUILD_SHARED_LIBS=OFF: --libs : -L/usr/local/lib -lcurl -lz -lbrotlidec -lbrotlicommon -lzstd -lz --cflags : -DCURL_STATICLIB -I/usr/local/include No marker appears in either output in either configuration. To be precise about what that does and does not cover: cmake generates curl-config from CMake/curl-config.in.cmake, which is a different template from the autotools curl-config.in, so the run above is evidence for the cmake path only. For the autotools path the claim rests on reading configure.ac and curl-config.in as cited above, not on a build -- I did not have autotools available to run it. Someone with an autotools tree may want to confirm. Note also that the LDFLAGS filter keeps -L, so -L/opt/PRIVATE-LIBDIR does still reach --static-libs in an autotools build. That is deliberate per e244d50 and is a library search path that static linking needs; the entry being removed names --libs and --cflags, which are clean.
bagder
approved these changes
Sep 25, 2026
Member
|
Thanks! |
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.
The entry says that
curl-config --libsincludes details set in LDFLAGSwhen configure was run, and that
curl-config --cflagsdoes the same withCFLAGS/CPPFLAGS. Neither is true any more.
It was added in 2005 (c7a6346) with no linked issue, which is probably
why nobody re-checked it. Two later changes fixed it without removing it:
ENABLE_SHARED=no, so a normal shared build prints just
'-L$libdir -lcurl'.
--library-path=/-framework before they reach LIBCURL_PC_LDFLAGS_PRIVATE,
and that variable is referenced only by --static-libs.
--cflags cannot carry user flags at all: curl-config.in prints only
@LIBCURL_PC_CFLAGS@ plus -I@includedir@, and configure.ac sets
LIBCURL_PC_CFLAGS to either empty or the literal '-DCURL_STATICLIB', so
CFLAGS and CPPFLAGS are never substituted into curl-config.
Checked with a cmake build configured with poisoned flags:
CFLAGS='-DPRIVATE_CFLAG_MARKER=1 -O2'
CPPFLAGS='-I/opt/PRIVATE-INCDIR -DPRIVATE_CPPFLAG_MARKER=1'
LDFLAGS='-L/opt/PRIVATE-LIBDIR -Wl,-rpath,/opt/PRIVATE-RPATH'
BUILD_SHARED_LIBS=ON:
--libs : -L/usr/local/lib -lcurl
--cflags : -I/usr/local/include
BUILD_SHARED_LIBS=OFF:
--libs : -L/usr/local/lib -lcurl -lz -lbrotlidec -lbrotlicommon -lzstd -lz
--cflags : -DCURL_STATICLIB -I/usr/local/include
No marker appears in either output in either configuration.
To be precise about what that does and does not cover: cmake generates
curl-config from CMake/curl-config.in.cmake, which is a different template
from the autotools curl-config.in, so the run above is evidence for the cmake
path only. For the autotools path the claim rests on reading configure.ac and
curl-config.in as cited above, not on a build -- I did not have autotools
available to run it. Someone with an autotools tree may want to confirm.
Note also that the LDFLAGS filter keeps -L, so -L/opt/PRIVATE-LIBDIR does
still reach --static-libs in an autotools build. That is deliberate per
e244d50 and is a library search path that static linking needs; the entry
being removed names --libs and --cflags, which are clean.