Skip to content

KNOWN_BUGS: drop the curl-config private details entry - #23102

Closed
xhon-pelushi wants to merge 1 commit into
curl:masterfrom
xhon-pelushi:knownbugs-curl-config-private-details
Closed

xhon-pelushi wants to merge 1 commit into
curl:masterfrom
xhon-pelushi:knownbugs-curl-config-private-details

Conversation

@xhon-pelushi

Copy link
Copy Markdown
Contributor

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.

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 bagder closed this in 4a17fbf Sep 25, 2026
@bagder

bagder commented Sep 25, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants