1e75edd3 | 17-Jul-2024 |
Viktor Szakats |
GHA/macos: improve, fix gcc/llvm, add new test matrix This PR began as an attempt to drop GCC support, after repeated reports on fallouts when trying to use it on macOS. Then it
GHA/macos: improve, fix gcc/llvm, add new test matrix This PR began as an attempt to drop GCC support, after repeated reports on fallouts when trying to use it on macOS. Then it transformed into a 3-week project turning up the issues causing the fallouts, ending up including llvm and all available Xcode / macOS SDK, macOS runner image, build tools and compiler vendors and versions. Accumulating 400 sub-commits. I developed and tested all fixes under this PR, then merged them as separate patches. This PR retained CI jobs updates, extensively reworking and extending them: [1] At first it seemed GCC and the Apple SDK is "naturally" growing more incompatible, as Apple added further non-standard features to their headers. This is partly true, but reality is more complicated. Besides some issues local to curl, there were bugs in Apple SDK headers, Homebrew GCC builds, feature missing in the old llvm version pre-installed on GitHub CI runner images, and subtle incompatibilities between GCC and llvm/clang when handling language extensions. Resulting compiler errors seldom pointed to a useful direction, and internet search was silent about these issues too. Thus, I had to peel them off layer by layer, using trial and error, and by recognizing patterns of failures accross 150-200 builds combinations. Exposing configure logs, and curl_config.h in the CI logs helped too. 1. GCC header compatibility layer ("hack" as GCC calls it) The toughest issue is GCC's built-in compatibility layer: https://github.com/gcc-mirror/gcc/tree/master/fixincludes This patch layer is further patched by a "Darwin compatibility" project applied on top by Homebrew GCC via: https://github.com/iains/gcc-12-branch https://github.com/iains/gcc-13-branch https://github.com/iains/gcc-14-branch The hack layer is designed in a way that breaks more builds than it fixes, esp. in context of GHA runners. The idea is to build GCC specifically for the SDK for the target macOS version. The problem with this approach is that the Xcode + SDK installed on the local/CI machine often does not match with the SDK used on while building GCC on Homebrew's build machines. In these cases the GCC compatibility layer turns into an "uncompatibility" layer and consistently breaks builds. curl cannot offer a fix for this, because the solution (I found) is to patch the toolchain on the local machine. I implemented this for our CI builds and curl-for-win. In other case the user must do this patching manually, or choose a compatible GCC + Xcode/SDK combination. An upstream fix doesn't seem trivial either, because the issue is ingrained in the compatibility layer's design. Offering an `-fapplesdk` (or recognizing `-target`) option and/or fixing them within the compiler would seem like a more robust option, and also how mainline llvm solves this. Here's a table summarizing the GCC + SDK combinations and curl build failures: [2] More info: https://github.com/curl/curl/issues/10356#issuecomment-2222734103 db135f8d7207b20d531e7e2100a49f3e16bdcfab #14119 macos: add workaround for gcc, non-c-ares, IPv6, compile error Ref: https://github.com/curl/curl-for-win/commit/e2db3c475f5981352e6e6a79854a255805b28deb Ref: https://github.com/curl/curl-for-win/commit/f5c58d7fef78e972be33ca2355dcb42ba56622a6 2. Homebrew GCC's `availability` extension A recent minor Homebrew GCC upgrade caused major breakage. The "Darwin compatibility" patch applied to GCC implemented the `availability` compiler attribute in GCC. Apple SDK detected this and enabled using them, but as it turns out GCC accepts compiler attributes with slightly different rules than llvm/clang, and how the Apple SDK uses them, breaking builds. Affected Homebrew GCC versions are: 12.4.0, 13.3.0 and 14.1.0. Possibly tracked here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796 More info: https://github.com/llvm/llvm-project/issues/81767 Commit implementing the `availability` macro: gcc-12: https://github.com/iains/gcc-12-branch/commit/fd5530b7cb0012bf4faeddd45e13054a1dfa6783 gcc-13: https://github.com/iains/gcc-13-branch/commit/cb7e4eca68cfc4763474e2eb0935a844458842a8 gcc-14: https://github.com/iains/gcc-14-branch/commit/ff62a108865a6403f5017380d7018250c1d3306f That applied to Homebrew GCC (12.4.0): https://github.com/Homebrew/homebrew-core/commit/b904223d9893f62bec2a8f7483bf5992747fc6c7#diff-89dd0b4176eca7fcc24b591943509bf8a8d6ea904d71e5dfcd6b78fed62fc574R44-R48 Ref: #13700 More info: https://github.com/curl/curl/pull/14091#issuecomment-2222703468 e91fcbac7d86292858718a0bfebad57978761af4 #14155 macos: undo `availability` macro enabled by Homebrew gcc 3. Proprietary Apple SDK macros Apple SDK expects certain macros predefined by the compiler. Missing them may causes odd issues. Mainline llvm is keeping up with Apple clang, but it needs a fresh version, while the one installed on GitHub runners is old (v15). I patched these in `lib/curl_setup.h`. baa3270846b2a7307cbd0dd5c02c4e5f00e388dd #14134 build: fix llvm 16 or older + Xcode 15 or newer, and gcc 4. Apple SDK header bug Without certain predefined macros, SDK headers can take a codepath where it mis-defines its own `TARGET_OS_OSX` macro, which make it break its own headers later. I patched it in `lib/curl_setup.h`. ff784af461175584c73e7e2b65af00b1a5a6f67f #14159 build: fix llvm 17 and older + macOS SDK 14.4 and newer 5. `TargetConditionals.h` requires `sys/types.h` Fixed in curl. It caused feature-detection failurs with autotools, and could break builds in certain configurations. e1f6192939c9c5ab2310b60bedf4c07d635193f6 #14130 configure: fix `SystemConfiguration` detection 6. Differences between autotools and CMake compiler options Fixed it by syncing compiler warning options. 59cadacfcc1d39472245979cdbd614c7a9af6f0d #14128 build: sync warning options between autotools, cmake & compilers 7. Differences between autotools and CMake dependency detection Fixed it by improving detection of libidn2, with some more fixes pending for the next feature window. f43adc2c4978f7f82a359e89186e58a31d17b0ad #14137 cmake: detect `libidn2` also via `pkg-config` Ref: #14136 cmake: detect `nghttp2` via `pkg-config`, enable by default 8. libidn2 detection bug with CMake Fixed the root cause and also the trigger in the CI config. 764fbabf6ed4c1d36c0ab2033ac8df52d9923cd7 #14175 cmake: fix builds with detected libidn2 lib but undetected header 9. Suppressed compiler warnings inside Apple-specific curl code Fixed these warnings, which allowed to stop silencing them. b05dc7eb3592305de9fa85640767f3dd2a8d4c93 #14122 sectransp: fix `HAVE_BUILTIN_AVAILABLE` checks to not emit warnings 5fa534b0dacdc120aaab0766047e0ecac37be4b3 #14162 sectransp: fix clang compiler warnings, stop silencing them 10. CMake mis-detecting a CA bundle path on macOS d2ef6255f4a040397d2f40ab7cbf65a203201cd9 #14182 cmake: sync CA bundle/path detection with autotools 11. Failure to build tests with LibreSSL or wolfSSL with CMake Fixed by dropping unnecessary includes, makign test builds dependent on dependency headers. 3765d75ce47b66289f946382b649d0e99389dc77 #14172 cmake: fix building `unit1600` due to missing `ssl/openssl.h` 12. curl tests with CMake curl's CMake was missing bits for running the C preprocessor accurately. It made tests 1119 and 1167 fail. I implemented the missing bits. efc2c5184d008fe2e5910fd03263e1ab0331d4e6 #14124 tests: include current directory when running test Perl commands c09db8b51b88ee6ad55bd637dcb4b47678e30906 #14129 cmake: create `configurehelp.pm` like autotools does 67cc1e3400b77536a3ca529c986247e1ef985e6e #14125 test1119: adapt for `.md` input 13. GCC missing `__builtin_available()` support curl source code assumes this is available to enable certain codepaths. It's also intermixed with monotonic timer support. 14. Monotonic timer support with GCC Detected by GCC, while it probably shouldn't be. llvm/clang detects it depending on target OS version. I've been playing with this, but so far without a conclusion or fix. 15. Runtime/test failures with GCC I couldn't find the reason for most of this. A bunch of RTSP tests fail with GCC. SecureTransport + HTTP/2 is failing a bunch of tests. With OpenSSL it fails two of those. SecureTransport builds also fail one DoH test. 16. Runtime/test failure in llvm/clang AppleIDN support received a fix with two more remaining. fd0250869f7837e4a48d7e6f54cc0801ad3820e8 #14179 #14176 IDN: fix ß with AppleIDN 17. Other issues found and fixed while working on this: 2c15aa5765900d4351e733671a1c8c3785beee1a GHA/macos: delete misplaced `CFLAGS`, drop redundant CMake option 80fb7c0bef209735ab352bf4afa31193a7bc65f1 #14126 configure: limit `SystemConfiguration` test to non-c-ares, IPv6 builds cfd6f43d6ca7e57670b422bab7bbf10221a2cf3e #14127 build: tidy up `__builtin_available` feature checks (Apple) bae555359979016999a9425a2d489f219a78abdd #14174 runtests: show name and keywords for failed tests in summary 09cdf7e5315711dea4ce7dcf5d99a4d41e7f658b #14178 cmake: delete unused `HAVE_LIBSSH2`, `HAVE_LIBSOCKET` macros d3595c74fab829f07ef44da1b7fc2f5668767020 #14186 configure: CA bundle/path detection fixes 58772b0e082eda333e0a5fc8fb0bc7f17a3cd99c #14187 runtests: set `SOURCE_DATE_EPOCH` to fix failing around midnight 18f1cd7a77c4beecfd977d43f55634eb593ac99e #14183 tests: sync feature names with `curl -V` 4c22d97be786ed801e050da6872dd3143d6d0a59 #14181 build: use `#error` instead of invalid syntax Pending merge:
show more ...
|
bae55535 | 13-Jul-2024 |
Viktor Szakats |
runtests: show name and keywords for failed tests in summary Useful to see what the numbers listed in the `TESTFAIL:` and `IGNORED:` lines mean. Also list test keywords to help catching
runtests: show name and keywords for failed tests in summary Useful to see what the numbers listed in the `TESTFAIL:` and `IGNORED:` lines mean. Also list test keywords to help catching failure patterns. Example: ``` FAIL 1034: 'HTTP over proxy with malformatted IDN host name' HTTP, HTTP GET, HTTP proxy, IDN, FAILURE, config file FAIL 1035: 'HTTP over proxy with too long IDN host name' HTTP, HTTP GET, HTTP proxy, IDN, FAILURE TESTFAIL: These test cases failed: 1034 1035 ``` Closes #14174
show more ...
|