Repository navigation
Conversation
getpass_r with Applegetpass_r() with Apple
|
The workaround for 8.11.0 is passing |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
Upstream issues that look similar to the fallouts reported for curl: Based on these, this CMake setting: set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)breaks CMake's built-in CMake manual says:
[...]
# ENABLE_STRICT_TRY_COMPILE: (ON|OFF) Enables or disables strict try_compile() on all Check* directives (will run linker
# to actually check if linking is possible). Default OFF (will set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY)
[...]
if(NOT DEFINED ENABLE_STRICT_TRY_COMPILE)
# Unless specified, disable strict try_compile()
set(ENABLE_STRICT_TRY_COMPILE OFF)
message(STATUS "[DEFAULTS] Using NON-strict compiler checks by default. ENABLE_STRICT_TRY_COMPILE not provided!")
endif()
set(ENABLE_STRICT_TRY_COMPILE_INT ${ENABLE_STRICT_TRY_COMPILE} CACHE BOOL
"Whether or not to use strict compiler checks" FORCE)
[...]
if(NOT ENABLE_STRICT_TRY_COMPILE_INT)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
endif()
[...](An odd option to use by default because linking is supposed to work in cross-compilation.) Earlier versions enabled this behavior unconditionally, later modified to do it for the In report #15557, the CMake configuration already has a workaround for a TL;DR: curl can try to work this around, but I don't consider this a curl issue. It's A possible clean workaround is passing |
getpass_r() with Applegetpass_r() with Apple
It's not offered by Apple operating systems, but in some cases it gets mis-detected when using `check_function_exists()`. Then making the build fail later. A better fix would be to figure out why are these mis-detections. One common pattern seen is this option, but it may or not be the cause: ``` -DCMAKE_TOOLCHAIN_FILE=[...]/toolchains/ios.toolchain.cmake ``` Ref: curl#15525 Regression from 8e34505 curl#15164 Reported-by: Dan Rosser Fixes curl#15557 Closes curl#15558
It requires Linux, so it's safe to ignore this for Apple
c072091 to
4ded3a4
Compare
getpass_r() with Appleios.toolchain.cmake feature-detection issues
ios.toolchain.cmake feature-detection issuesios.toolchain.cmake breaking feature-detections
|
Analysis of PR #15559 at 62c5d298: Test 1114 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Test 313 failed, which has NOT been flaky recently, so there could be a real issue in this PR. Generated by Testclutch |
|
I've pushed a commit that overrides the problematic setting with the one This may have a risk for cases when the problematic setting is supposed to (We can limit it to |
|
@danoli3 Does this patch resolve the issue you reported? |
|
Yes and thank you! Some insights into some other library issues with the findings in ios toolchain thanks mate! |
Fix builds with CMake configured to falsely return successful detection when using `check_function_exists()` (and `check_library_exists()`, and anything based on `try_compile()` that's relying on the linker). After such mis-detection the build fails when trying to use the feature that doesn't in fact exist. The mis-detection is caused by this CMake setting: ``` set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) ``` It is set by default (or on conditions) when using 3rd-party toolchain: https://github.com/leetal/ios-cmake/blob/master/ios.toolchain.cmake After this patch the curl build overrides this setting for the duration of feature tests, and logs a message about it. Also preset and skip feature tests for known mis-detections: - `connect()` in `libsocket` - `getpass_r()` - `eventfd()` (did not cause an issue due to a separate bug) - `sendmmsg()` (did not cause an issue because it's Linux-only) If mis-detections are still seen, the workaround is to force-set the specific feature by passing `-DHAVE_*=OFF` to cmake. Also consider passing `-DENABLE_STRICT_TRY_COMPILE=ON` for `ios.toolchain.cmake` to fix the root cause. Interestingly curl itself uses this setting to speed up compile-only detections: be17f29 curl#3744 Also: - OtherTests.cmake: restore original value of `CMAKE_TRY_COMPILE_TARGET_TYPE`. Before this patch it reset it to empty. - OtherTests.cmake: unset a local variable after use, quote a string. Follow-up to 8e34505 curl#15164 Follow-up to 8b76a8a curl#15525 Ref: leetal/ios-cmake#47 Ref: https://gitlab.kitware.com/cmake/cmake/-/issues/18121 Ref: https://cmake.org/cmake/help/latest/variable/CMAKE_TRY_COMPILE_TARGET_TYPE.html Reported-by: Dan Rosser Fixes curl#15557 Closes curl#15559
Follow-up to 93e6e4b curl#15559
Fix builds with CMake configured to falsely return successful detection
when using
check_function_exists()(andcheck_library_exists(), andanything based on
try_compile()that's relying on the linker). Aftersuch mis-detection the build fails when trying to use the feature that
doesn't in fact exist.
The mis-detection is caused by this CMake setting:
It is set by default (or on conditions) when using 3rd-party toolchain:
https://github.com/leetal/ios-cmake/blob/master/ios.toolchain.cmake
After this patch the curl build overrides this setting for the duration
of feature tests, and logs a message about it.
Also preset and skip feature tests for known mis-detections:
connect()inlibsocketgetpass_r()eventfd()(did not cause an issue due to a separate bug)sendmmsg()(did not cause an issue because it's Linux-only)If mis-detections are still seen, the workaround is to force-set the
specific feature by passing
-DHAVE_*=OFFto cmake.Also consider passing
-DENABLE_STRICT_TRY_COMPILE=ONforios.toolchain.cmaketo fix the root cause.Interestingly curl itself uses this setting to speed up compile-only
detections: be17f29 #3744
Also:
CMAKE_TRY_COMPILE_TARGET_TYPE. Before this patch it reset itto empty.
Follow-up to 8e34505 #15164
Follow-up to 8b76a8a #15525
Ref: leetal/ios-cmake#47
Ref: https://gitlab.kitware.com/cmake/cmake/-/issues/18121
Ref: https://cmake.org/cmake/help/latest/variable/CMAKE_TRY_COMPILE_TARGET_TYPE.html
Reported-by: Dan Rosser
Fixes #15557