autotools: avoid passing LDFLAGS
twice for libcurl
#12310
Closed
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.
autotools passes
LDFLAGS
automatically linker commands. curl'slib/Makefile.am
customizes libcurl linker flags. In thatcustomization, it added
LDFLAGS
to the custom flags. This resultedin passing
LDFLAGS
twice to thelibtool
command.Most of the time this is benign, but some
LDFLAGS
options can breakthe build when passed twice. One such example is passing
.o
files,e.g.
crt*.o
files necessary when customizing the C runtime, e.g. forMUSL builds.
Passing them twice resulted in duplicate symbol errors:
This behaviour came with commit 1a59319
(2013-07-23) as a fix for bug https://curl.haxx.se/bug/view.cgi?id=1217.
The patch was a works-for-me hack that ended up merged in curl:
https://sourceforge.net/p/curl/bugs/1217/#06ef
With the root cause remaining unclear.
Perhaps the SUNPro 12 linker was sensitive to
-L
-l
order, requiring-L
first? This would be unusual and suggests a bug in either thelinker or in
libtool
.The curl build does pass the list of detected libs via its own
LIBCURL_LIBS
variable, which ends up beforeLDFLAGS
on thelibtool
command line, but it's the job of
libtool
to ensure that evena peculiar linker gets the options in the expected order. Also because
autotools passes
LDFLAGS
last, making it hardly possible to passanything after it.
Perhaps in the 10 years since this issue, this already got a fix
upstream.
This patch deletes
LDFLAGS
from our customized libcurl options,leaving a single copy of them as passed by autotools automatically.
Reverts 1a59319
Closes #12310