Viktor Szakats 444f64b3e9
autotools: avoid passing LDFLAGS twice to libcurl
autotools passes `LDFLAGS` automatically linker commands. curl's
`lib/Makefile.am` customizes libcurl linker flags. In that
customization, it added `LDFLAGS` to the custom flags. This resulted in
passing `LDFLAGS` _twice_ to the `libtool` command.

Most of the time this is benign, but some `LDFLAGS` options can break
the build when passed twice. One such example is passing `.o` files,
e.g. `crt*.o` files necessary when customizing the C runtime, e.g. for
MUSL builds.

Passing them twice resulted in duplicate symbol errors:
```
libtool: link:  clang-15 --target=aarch64-unknown-linux-musl [...] /usr/lib/aarch64-linux-musl/crt1.o [...] /usr/lib/aarch64-linux-musl/crt1.o [...]
ld.lld-15: error: duplicate symbol: _start
>>> defined at crt1.c
>>>            /usr/lib/aarch64-linux-musl/crt1.o:(.text+0x0)
>>> defined at crt1.c
>>>            /usr/lib/aarch64-linux-musl/crt1.o:(.text+0x0)
[...]
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

This behaviour came with commit 1a593191c2769a47b8c3e4d9715ec9f6dddf5e36
(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 the
linker or in `libtool`.

The curl build does pass the list of detected libs via its own
`LIBCURL_LIBS` variable, which ends up before `LDFLAGS` on the `libtool`
command line, but it's the job of `libtool` to ensure that even
a peculiar linker gets the options in the expected order. Also because
autotools passes `LDFLAGS` last, making it hardly possible to pass
anything 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 1a593191c2769a47b8c3e4d9715ec9f6dddf5e36
Closes #12310
2023-11-14 19:28:15 +00:00
..
2023-09-20 13:38:42 +02:00
2023-11-11 23:35:47 +01:00
2021-09-09 07:53:42 +02:00
2023-11-11 23:35:47 +01:00
2023-07-20 23:41:47 +02:00
2023-08-31 23:02:10 +00:00
2023-11-11 23:35:47 +01:00
2023-10-04 23:22:16 +02:00
2023-09-03 18:42:37 +02:00
2023-11-11 23:35:47 +01:00
2023-11-11 23:35:47 +01:00
2023-11-11 23:35:47 +01:00
2023-11-11 23:35:47 +01:00
2023-10-27 00:37:34 +00:00
2023-09-28 22:58:36 +02:00
2023-11-11 23:35:47 +01:00
2023-11-11 23:35:47 +01:00
2023-05-23 10:42:09 +02:00
2023-07-31 11:51:34 +02:00
2023-10-21 10:29:02 +02:00
2023-10-27 00:37:34 +00:00
2023-10-27 00:37:34 +00:00
2023-05-18 20:45:04 +02:00
2023-11-11 23:35:47 +01:00
2023-10-09 18:34:17 +02:00
2023-10-21 14:36:51 +02:00
2023-10-21 14:36:51 +02:00
2023-04-25 23:16:51 +02:00
2023-09-30 11:45:39 +02:00
2023-09-30 11:45:39 +02:00
2023-09-16 11:37:57 +02:00
2023-11-02 20:35:20 +01:00
2023-11-11 23:35:47 +01:00
2023-09-05 16:36:03 +02:00
2023-04-14 09:26:26 +02:00
2023-09-20 13:38:42 +02:00
2023-10-28 00:27:20 -04:00
2023-11-11 23:35:47 +01:00
2023-09-25 20:12:18 +02:00
2023-09-25 20:12:18 +02:00
2023-11-11 23:35:47 +01:00
2023-09-25 20:12:18 +02:00
2023-11-11 23:35:47 +01:00
2023-11-11 23:35:47 +01:00
2023-07-29 23:42:53 +02:00
2023-07-29 23:42:53 +02:00
2023-11-08 17:55:22 +00:00
2023-09-16 11:37:57 +02:00
2023-09-16 11:37:57 +02:00
2023-10-09 18:34:17 +02:00
2023-11-11 23:35:47 +01:00
2023-09-16 11:37:57 +02:00
2023-10-21 14:38:21 +02:00
2023-08-30 11:38:27 +02:00
2023-06-07 13:06:08 +00:00
2023-11-11 23:35:47 +01:00
2023-11-11 23:35:47 +01:00
2023-10-27 16:55:54 +02:00
2023-11-11 23:35:47 +01:00
2023-10-30 17:02:13 +01:00
2023-09-25 17:06:33 +02:00
2023-10-27 00:37:34 +00:00
2023-04-25 23:16:51 +02:00