Allow overriding the `IMPORT_LIB_SUFFIX` default with an empty value.
Also:
- add a fatal error if the implib and static lib filename are identical.
- clarify `IMPORT_LIB_SUFFIX` default value in the documentation.
Reported-by: RubisetCie on Github
Fixes#16324
Ref: 1199308dbc902c52be67fc805c72dd2582520d30 #11505Closes#16332
TL;DR: Save 10 minutes of CI time for GHA/macos jobs using pre-fills and
add pre-fill verification for Apple and Windows. Also restores Xcode job
and saves 1.5-10 minutes configuring iOS jobs.
Pre-filling feature detection results can bring down the CMake configure
step to ~5 seconds on most GHA runners, ~10 seconds in slow envs like
Cygwin/MSYS2.
The potential savings per job are:
- 5-40 (average 19) seconds on GHA/macos (33 jobs)
- ~10 seconds on GHA for iOS GNU Makefile (1 job)
- 1.5-10 minutes on GHA for iOS Xcode generator (1 job)
- 10 seconds on GHA/linux with native Ubuntu (12 jobs)
- 40 seconds for Cygwin/MSYS2 (2 jobs)
- 5-10 seconds for virtualized BSDs, native CPU (3 jobs)
- ~60 seconds for virtualized BSDs, emulated CPU (1 job)
On native Windows pre-filling has been in place for a long time and
saving 8 minutes (VS2019-VS2015) to 1.5-2 minutes (VS2022), 3 minutes
(VS2022 UWP), and 30-60 seconds (MinGW), per CI job.
The downside is that detection results need to be manually collected and
filtered to those that universally apply to all platforms that they are
enabled on. Another downside is that by using a cache, we're not running
the actual detections, and thus won't catch regressions in them. It
means we must make sure that the cache is solid and matches with actual
detections results. An upside is that it gives a rough overview of which
features are available on which platforms. Another upside is pre-filled
values do work for feature detections skipped for cross-builds, e.g.
`HAVE_WRITABLE_ARGV`.
This PR adds a pre-fill cache that supports all Unixes (except OmniOS)
used in CI, and makes it usable with an internal option. It also enables
it for GHA/macos CI jobs, where the maximum savings are. And also for
the two iOS [1] and two Cygwin/MSYS2 jobs. The latters don't have
pre-fill checks and we can drop them if they turn into a hassle.
Saving:
- 10 minutes of CI time per GHA/macos workflow run. [2]
- ~80 seconds per GHA/windows workflow run with Cygwin/MSYS2.
(offsetting the cost of pre-fill verifications)
- 1.5-10 minutes per GHA/non-native runs with iOS jobs. [3]
You can enable pre-fill locally with `-D_CURL_PREFILL=ON`. It's
experimental, and if you experience a problem, file a PR or an Issue.
This PR also adds a pre-fill checker for macOS and MinGW/MSVC Windows
GHA jobs to catch if the cache diverges from real detections. It also
adds this logic to AppVeyor, but doesn't enable it due to the perf
penalty of 2 minutes mininum.
The pre-fill checker works by configuring out-of-tree with and without
pre-fill, then diffing their `lib/curl_config.h` outputs.
Exceptions are 3 detection results exposed indirectly [4], and missing
to expose 2, of which one is the C89 header `stddef.h`. While we assume
the C99 `stdint.h` available outside iOS. We can expose them in the
future, if necessary.
The pre-fill checks cost in total:
- ~20 seconds for macOS
- ~40 seconds for MinGW on GHA
- ~80 seconds for MSVC on GHA (UWP would be 2x this)
An extra time saving potential is caching type sizes. They are
well-known, and seldom change, esp. in CI. GHA/Windows jobs spend 8-17
seconds per job on these ~12 feature checks. ~5s on Cygwin/MSYS2. Couple
of seconds on other platforms. (This PR doesn't make this optimization.)
Another opportunity is doing the same for autotools, which typically
spends more time in the configuration step than cmake.
[1] Xcode job restored as a
follow-up to be5f20202c1618788b3d8f6d255543638f48bd65 #16302
[2] GHA/macos cmake configure times in seconds:
Job | Bef. | After | Gain
:----------------------------------------------- | ----: | ----: | ----:
CM clang GnuTLS !ldap krb5 | 21.2 | 4.5 | 16.7
CM clang LibreSSL !ldap heimdal c-ares +examples | 13.3 | 3.9 | 9.4
CM clang OpenSSL +static libssh +examples | 20.0 | 4.6 | 15.4
CM clang OpenSSL IDN clang-tidy~ (w/chkprefill) | 15.7 | 18.6 | -2.9
CM clang OpenSSL gsasl rtmp AppleIDN | 25.0 | 4.7 | 20.3
CM clang OpenSSL torture !FTP | 15.3 | 4.5 | 10.8
CM clang OpenSSL torture FTP | 25.0 | 5.9 | 19.1
CM clang SecureTransport debug | 18.0 | 3.8 | 14.2
CM clang macos-13 SecureTransport | 45.8 | 12.4 | 33.4
CM clang macos-14 SecureTransport | 15.8 | 4.6 | 11.2
CM clang macos-15 SecureTransport | 26.8 | 6.1 | 20.7
CM clang mbedTLS openldap brotli zstd | 15.1 | 6.5 | 8.6
CM clang wolfSSL !ldap brotli zstd | 27.0 | 4.4 | 22.6
CM gcc-12 GnuTLS !ldap krb5 | 39.1 | 8.7 | 30.4
CM gcc-12 LibreSSL !ldap heimdal c-ares +examples| 23.8 | 7.2 | 16.6
CM gcc-12 OpenSSL +static libssh +examples | 20.7 | 8.5 | 12.2
CM gcc-12 OpenSSL gsasl rtmp AppleIDN | 23.1 | 10.1 | 13.0
CM gcc-12 SecureTransport debug | 21.1 | 4.8 | 16.3
CM gcc-12 mbedTLS openldap brotli zstd | 21.4 | 5.8 | 15.6
CM gcc-12 wolfSSL !ldap brotli zstd | 21.1 | 6.9 | 14.2
CM gcc-14 macos-13 SecureTransport | 61.9 | 18.7 | 43.2
CM gcc-14 macos-14 SecureTransport | 30.5 | 6.4 | 24.1
CM gcc-14 macos-15 SecureTransport | 32.7 | 8.4 | 24.3
CM llvm@15 GnuTLS !ldap krb5 | 21.1 | 7.5 | 13.6
CM llvm@15 LibreSSL !ldap heimdal c-ares +exampl~| 24.6 | 6.8 | 17.8
CM llvm@15 OpenSSL +static libssh +examples | 19.0 | 6.4 | 12.6
CM llvm@15 OpenSSL gsasl rtmp AppleIDN | 19.0 | 8.2 | 10.8
CM llvm@15 SecureTransport debug | 18.0 | 5.4 | 12.6
CM llvm@15 macos-13 SecureTransport | 66.2 | 25.7 | 40.5
CM llvm@15 macos-14 SecureTransport | 31.9 | 6.1 | 25.8
CM llvm@15 mbedTLS openldap brotli zstd | 19.5 | 8.9 | 10.6
CM llvm@15 wolfSSL !ldap brotli zstd | 24.3 | 5.9 | 18.4
CM llvm@18 macos-15 SecureTransport | 33.8 | 6.4 | 27.4
Total | 856.8 | 257.3 | 599.5
Before: https://github.com/curl/curl/actions/runs/13311042735/job/37173478424
After: https://github.com/curl/curl/actions/runs/13313927119/job/37183206426?pr=15841
[3] iOS:
Before: https://github.com/curl/curl/actions/runs/13326401704?pr=15841
After: https://github.com/curl/curl/actions/runs/13332177764?pr=15841
[4] detection results exposed indirectly in `curl_config.h`:
- `HAVE_FILE_OFFSET_BITS` via `_FILE_OFFSET_BITS`
- `HAVE_GETHOSTBYNAME_R_*_REENTRANT` via `NEED_REENTRANT`
- `HAVE_SOCKADDR_IN6_SIN6_ADDR` via `USE_IPV6`
Closes#15841
- Remove the workaround that disabled peer verification in DEBUGBUILDs
when CA certs were provided.
The workaround was part of a TODO that disabled verification in
DEBUGBUILDs with a CAfile/path because apparently there's no way to set
those options in msh3 and that caused some tests to fail. Instead the
tests should fail and this problem should not be covered up.
Ref: https://github.com/curl/curl/pull/16327#issuecomment-2661039423
Closes https://github.com/curl/curl/pull/16342
- add hex and octal parsers to the Curl_str_* family
- make curlx_strtoofft use these parsers
- remove all use of strtol() and strtoul() in library code
- generally use Curl_str_* more than strtoofft, for stricter parsing
- supports 64-bit universally, instead of 'long' which differs in size
between platforms
Extended the unit test 1664 to verify hex and octal parsing.
Closes#16336
Drop check for `SSL_set0_wbio`, `SSL_CTX_set_srp_username`.
The wolfSSL backend doesn't implement these features. The checks were
wrong, and also missing from `./configure`.
If they get implemented, the feature checks should use distinct macros
from OpenSSL; they should check for the `wolfSSL_`-prefixed APIs via
wolfSSL headers; and matching checks should be added to `./configure`.
Follow-up to 781242ffa44a9f9b95b6da5ac5a1bf6372ec6257 #11967#11964Closes#16339
Instead of strtoul() and strtol() calls.
Easier API with better integer overflow detection and built-in max check
that now comes automatic everywhere this is used.
Closes#16319
To reduce the number `-Wunused-macro` compiler warnings:
- delete unused macros.
- comment out unused macro that are part of a set.
- move macros into the scope they are used.
This may be useful to enable by default, but there are tricky cases that
I didn't manage to fix and paused the effort. E.g. internal features
checks in `openssl.c`. There is more, once those are fixed.
Closes#16279
By dropping the unused enum wrappers for `AF_*` macros.
Also fix `./configure` to apply `--enable-werror` options to
`tests/servers`, to catch this next time.
Seen with Intel C compiler:
```
socksd.c(184): warning #188: enumerated type mixed with another type
socksd.c(881): warning #188: enumerated type mixed with another type
[...]
sws.c(76): warning #188: enumerated type mixed with another type
sws.c(229): warning #188: enumerated type mixed with another type
[...]
```
Ref: https://github.com/curl/curl/actions/runs/13296520425/job/37129676921#step:40:338Closes#16314
Before this patch curl code was redefining `getaddrinfo` and
`freeaddrinfo` system symbols to plug in its debug wrappers. This was
causing pains to avoid applying the redefinitions to system headers
defining these functions, and to the local debug wrappers. Especially
in unity builds. It also required workarounds for systems where these
symbols are already macros.
Introduce curl-namespaced macros for these functions and use them.
This allows to drop all workarounds and makes it work in all envs,
local targets and unity/bundle combinations.
Also drop GHA/windows workaround and use the same unity batch across
all jobs. Follow-up to 29e4eda631f46368c2adf833ba3065b1b46c2a7d #16272
Ref: #16272
Ref: 71cf0d1fca9e1f53524e1545ef0c08d174458d80 #14772
Ref: 3efba94f773db5d8ae19e33aa749ab7914cafeea #14765
Ref: f7d5f47059c381502824ef9c1c9a2ca484930c91 #14399Closes#16274
1. make sure the check is done before the backticks are replaced
2. ignore less-than and greater-than used within backticks
(adjust proxy.md that now showed a two-space warning)
Closes#16315
Prior to this change %header{} and %output{} were explained in remarks
but not listed in the --write-out variable list.
Closes https://github.com/curl/curl/pull/16299
Since last week the Ubuntu arm runner became flaky while installing `stunnel`.
```
08:07:26 Setting up stunnel4 (3:5.72-1build2) ...
08:07:26 Failed to check if group stunnel4 already exists: Connection refused
08:07:26 Group stunnel4 not found.
08:07:28 Reload daemon failed: Failed to activate service 'org.freedesktop.systemd1': timed out (service_start_timeout=25000ms)
08:07:28 Created symlink /etc/systemd/system/multi-user.target.wants/stunnel.target -> /usr/lib/systemd/system/stunnel.target.
08:08:18 Failed to get unit file state for stunnel.target: Connection timed out
08:08:43 Failed to retrieve unit state: Connection timed out
08:08:43 stunnel.target is a disabled or a static unit, not starting it.
08:08:43 /bin/chown: invalid user: ‘stunnel4:stunnel4’
08:08:43 dpkg: error processing package stunnel4 (--configure):
08:08:43 installed stunnel4 package post-installation script subprocess returned error exit status 1
08:08:43 [...]
08:08:47 Errors were encountered while processing:
08:08:47 stunnel4
08:08:54 Error: Timeout was reached
08:08:55 E: Sub-process /usr/bin/dpkg returned an error code (1)
08:08:55 Error: Process completed with exit code 100.
```
Ref: https://github.com/curl/curl/actions/runs/13280736653/job/37078440398?pr=16300#step:2:94Closes#16303
Almost all feature detection results are pre-filled on Windows
for performance, so none of the issues fixed here affected builds.
For good measure, this patch add missing detections and fixes others
to make sure they work even when omitting the pre-fill.
It also fixes detecting IPv6 for MS-DOS.
- fix `HAVE_STRUCT_TIMEVAL` detection for MSVC.
Follow-up to c1bc090d65b8d7d14e811dd36f5e8674be43dff3 #12495
- add `HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` detection for Windows.
- fix `HAVE_STRDUP` detection for MSVC.
- fix `HAVE_SNPRINTF` detection for Windows.
Regression from 8e345057761a8f796403923a96f2c8fd3edca647 #15164
- fix `HAVE_IOCTLSOCKET` detection for non-UWP MSVC.
- exclude `if_nametoindex` detection for Windows.
Although it exists on Windows, detection, usage and availability is
complicated, and curl doesn't use it on this platform.
Regression from 8e345057761a8f796403923a96f2c8fd3edca647 #15164
- move IPv6 detections so that pre-filling and MS-DOS Watt-32
configuration applies to them. This fixes
`HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID` detection with MS-DOS.
Ref: https://github.com/curl/curl/actions/runs/13260511764/job/37015877585#step:7:306
Follow-up to a3585c9576abccddbd27200058912cef900c3c0f #15543
Also:
- add debug option to test without pre-filling.
- replace `NOT LESS` with `GREATER_EQUAL`
Closes#16278
Seen in curl-for-win daily, building against libssh2 1.11.2_DEV:
```
curl-for-win/curl/lib/vssh/libssh2.c:2644:9: warning: 'libssh2_scp_send_ex' is deprecated:
since libssh2 1.2.6. Use libssh2_scp_send64() [-Wdeprecated-declarations]
2644 | SCP_SEND(sshc->ssh_session, sshp->path, data->set.new_file_perms,
```
Ref: https://github.com/curl/curl-for-win/actions/runs/13229370277/job/36924363438#step:3:5805
Follow-up to 553248f501762735c6aa5531f5748e88aefb5314 #16199Closes#16291
Reapply an accidental, and unrelated, change committed in
3c128966edc86c89de85f72671f9f627c984af53 which unwantedly reverted
the preceding commit fcd5c2baffff95b858b43bfbc3d03dac2ef1b5ce.
Caused by doing a local rebase when `git am` did not apply cleanly,
and most likely using a local base behind master.