cmake: limit libidn2 pkg-config detection to UNIX#14408
cmake: limit libidn2 pkg-config detection to UNIX#14408vszakats wants to merge 1 commit intocurl:masterfrom
pkg-config detection to UNIX#14408Conversation
|
Does UNIX include MSYS? The documentation isn't clear about that, it only mentions CYGWIN [0]. The only bad case I can think of is #14365, when targeting MSVC, so I think it would be good to have the pkg-config detection enabled for MSYS. |
|
I've made a PR to make these CMake flags transparent: #14417 Using #14365 looks like an explictly misconfigured env, though still awaiting feedback. An earlier failed attempt to tackle this: #14140. With no answers and adding to |
|
#14365 resolved by deleting the local/manual |
This comment was marked as resolved.
This comment was marked as resolved.
05d7c67 to
85a5aa8
Compare
Which answers were missing?
This means: the limited environment which doesn't understand C:/ or C:\. |
|
It's good that vcpkg is cleared, and AFAIK it's the only platform besides UNIX which is known to tolerate (or support) It doesn't seem good behaviour to make these build-cases suddenly broken, and make them require some tweak to make it work again. What's still unclear is how to define/detect the affected build cases. It's also unclear what is the best way to opt-in-to / opt-out-from |
I had a clear opinion/suggestion for CMake builds, but I failed to convince you to that fixing problems in CMake builds should be done with CMake features alone.
This is a normal cross-build scenario. Even with autotools, you would be expected to setup either the enviroment or to use a wrapper which does it for you. I don't see anything special. |
That solution broke on CMake internals. IMO a pkg-config-specific solution is fine for a pkg-config-specific problem,
The envs, userbase, expectations, build options and the histories are quite
Perhaps that's the reason why Either way there is/was great efforts put into syncing cmake/autotools, but Hence my seeking actual answers to these questions. If there are none or |
|
The FindGnuTLS thing is a cmake bug and won't go away quickly, even when the fix is simple. There isn't just a CMake side to the pkg-config problems. There are also many pc files with problems, at least for transitive usage requirements.
I'm still patching many up-to-date autotools projects to use pkg-config instead of hardcoded library searches. Indicating that projects don't care about static linkage, or are unaware of different binary names, or that they lack contributions. I'm glad to see curl better fill |
/OFF Can you be more specific?:
Sadly
|
I don't think any system for this can be introduced without being fragile since it requires that the info provided is correctly setup and filled in, and usually the ones providing the info isn't themselves using it so it is bound to end up wrong every now and then. I'm sure libcurl's pkg-config fits that pattern as well. |
I didn't find time to validate it so far so the port just doesn't use it. (Curl release must be adopted quickly for security concerns, and at that time your (positive) work has the consequence that updating the patches in the port is more difficult than usual. Between releases time goes into housekeeping for other peoples' contributions. And that time isn't available for upstreaming useful stuff such as exporting CURL components to CMake config. Which is necessary to make CURL config a full replacement for
Drop it for using pkg-config? AFAIU this is what pkg-config was invented for. (I know that some |
libidn2 is detected by default, which triggers a `pkg-config` detectio attempt by default. This in turn may pick up libidn2 inadvertently from the disk, and append the libidn2 header directory to the include path. This header directory might contain incompatible system and or component headers, causing confusion and failed builds. Some of these side-effects may be the result of an unknowningly configured (or misconfigured) `pkg-config`. Until we understand the reasons and come up with a technique to avoid these issues, limit `pkg-config` detection to UNIX platforms, like we already do in `Find*` modules. Notice that `-DCURL_USE_LIBSSH=ON`, `-DCURL_USE_GSASL=ON`, and `-DCURL_USE_LIBUV=ON` options continue to have the above side-effects, though these options are disabled by default. Follow-up to f43adc2 curl#14137 Closes curl#14408
85a5aa8 to
8ebfcea
Compare
|
#14405 turned out to be an env with an explicit One more related update: #13947 plans to switch system IDN on by default on Windows and Apple. The consequence is that libidn2 will no longer be detected by default for these targets, also avoiding the issue fixed by this PR in default builds. |
|
Update regarding #14405: Even though the env had a manual This may change the situation a little bit because this could be present in envs and in PATH on many machines. (It's present on AppVeyor CI runners, but our MSVC jobs were not affected.) Perhaps this condition could replace Let me know what you think. |
No. All those variables (incl. In the meantime I did https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9709: Guard all use of
A known pain. Note that you don't get completely rid of it with |
I agree
Nice! In the meantime we learned (Thanks @micahsnyder!) that
I'm aware. It's a condition that was used in curl for a decade. This doesn't in itself make it accurate, but there were apparently no reports about issues, so either everyone managed to work it around or it did not cause grave problems. On the other hand, omitting the condition triggered two bug reports in a week. |
Why shouldn't it be legit? The find modules should be seen as private implementation details. CURL ships CMake config. If it has to ship and use extra find modules, they should be scoped to finding transitive depedencies, and they shouldn't be allowed to find something signitificantly different then used during the build. Implementation-wise, CURL CMake config would set |
|
OK, so we must replicate the Do you think there anything special to do in the restore-before-existing-scope step there? (I know very little about variable caching) |
Before this patch, `pkg-config` was used for `UNIX` builds only (with a few exceptions like wolfSSL, libssh, gsasl, libuv). This patch extends `pkg-config` use to all envs except: `MSVC` without vcpkg. Meaning MSVC with vcpkg will now use it. Also mingw on Windows. Also apply the new condition to options where `pkg-config` was used unconditionally (= for all targets). These are: `-DCURL_USE_WOLFSSL=ON`, `-DCURL_USE_LIBSSH=ON`, `-DCURL_USE_GSASL=ON` and `-DCURL_USE_LIBUV=ON` This patch may still cause regressions for cross-builds (e.g. mingw cross-build from Unix) and potentially other cases. If that happens, we recommend using some of these methods to explicitly disable `pkg-config` when using CMake: - CMake option: `-DPKG_CONFIG_EXECUTABLE=` (or `-DPKG_CONFIG_EXECUTABLE=nonexistent` or similar) This is similar to the (curl-specific) `PKG_CONFIG` env for autotools. - export env: `PKG_CONFIG_LIBDIR=` (or `PKG_CONFIG_PATH`, `PKG_CONFIG_SYSROOT_DIR`, or the CMake-specific `PKG_CONFIG`) We may improve control over this in a future patch, also allowing opting in MSVC (without vcpkg). Ref: #14405 Ref: #14408 Ref: #14140 Closes #14483
libidn2 is detected by default, which triggers a
pkg-configdetectioattempt by default. This in turn may pick up libidn2 inadvertently from
the disk, and append the libidn2 header directory to the include path.
This header directory might contain incompatible system and/or component
headers, causing confusion and failed builds.
Some of these side-effects may be the result of an unknowningly
configured (or misconfigured)
pkg-config. In another reported case,it was hit by the
pkg-configfrom Strawberry Perl. Until weinvestigate the reasons and come up with a technique to avoid these
issues, limit
pkg-configdetection to UNIX platforms, like we alreadydo in
Find*modules.Notice that
-DCURL_USE_LIBSSH=ON,-DCURL_USE_GSASL=ON, and-DCURL_USE_LIBUV=ONoptions continue to have the above side-effects,though these options are disabled by default.
Follow-up to f43adc2 #14137
Reported-by: Micah Snyder
Fixes #14405
Closes #14408