iOS: fatal error: 'Security/cssmtype.h' file not found · Issue #14269 · curl/curl · GitHub
Skip to content You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert iOS: fatal error: 'Security/cssmtype.h' file not found #14269 New issue Copy link New issue Copy link Closed Closed iOS: fatal error: 'Security/cssmtype.h' file not found #14269 Copy link Labels appleOS specific to an Apple operating system specific to an Apple operating system build regression Description sergio-nsk opened on Jul 25, 2024 Issue body actions I did this Got build errors: In file included from curl/lib/vtls/sectransp.c:58: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:28: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h:50:10: fatal error: 'Security/cssmtype.h' file not found #include <Security/cssmtype.h> ^~~~~~~~~~~~~~~~~~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h:50:10: note: did not find header 'cssmtype.h' in framework 'Security' (loaded from '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/System/Library/Frameworks') 1 error generated. @vszakats , the error is caused by this change: ff784af I expected the following No response curl/libcurl version curl 8.9.0 operating system macOS 14.5, target platforn iOS 17.5 Activity cajus commented on Jul 25, 2024 cajus on Jul 25, 2024 More actions Same here. vszakats commented on Jul 25, 2024 vszakats on Jul 25, 2024 Member More actions Can you try reducing that change, and see which one fixes it, e.g. by deleting the local TARGET_* logic. deleting the sys/types.h include. moving back the TargetConditionals.h include to its original position.
If we know which one is causing this, we can continue figuring out why. vszakats added appleOS specific to an Apple operating system specific to an Apple operating system build on Jul 25, 2024 sergio-nsk commented on Jul 25, 2024 sergio-nsk on Jul 25, 2024 Contributor Author More actions Sure, I can try to localize a line, tomorrow or next day. sergio-nsk commented on Jul 25, 2024 sergio-nsk on Jul 25, 2024 Contributor Author More actions Wonder, why you use such construct like defined(TARGET_OS_MAC) && TARGET_OS_MAC .
See 3.8.1 Conditional inclusion - Semantics in C89: <...> then all remaining identifiers are replaced with 0. <...> If TARGET_OS_MAC is defined as 0: #if defined(TARGET_OS_MAC) && TARGET_OS_MAC is 1 && 0 is 0 If TARGET_OS_MAC is defined as 1 (not zero): #if defined(TARGET_OS_MAC) && TARGET_OS_MAC is 1 && 1 is 1 If TARGET_OS_MAC is undefined: #if defined(TARGET_OS_MAC) && TARGET_OS_MAC is 0 && 0 (replaced) is 0. #if defined(TARGET_OS_MAC) && TARGET_OS_MAC can be reduced to #if TARGET_OS_MAC .
The second part defined(TARGET_OS_OSX) && !TARGET_OS_OSX can't be reduced and perhaps is a root error here. MarcelRaad commented on Jul 25, 2024 MarcelRaad on Jul 25, 2024 Member More actions According to https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets , TARGET_OS_MAC is for all Apple platforms, not just macOS. The commit looks like it assumes TARGET_OS_MAC being specific to macOS, right?
Reacted by Viktor Szakats vszakats commented on Jul 25, 2024 vszakats on Jul 25, 2024 Member More actions Wonder, why you use such construct like defined(TARGET_OS_MAC) && TARGET_OS_MAC . See 3.8.1 Conditional inclusion - Semantics in C89: <...> then all remaining identifiers are replaced with 0. <...> If TARGET_OS_MAC is defined as 0: #if defined(TARGET_OS_MAC) && TARGET_OS_MAC is 1 && 0 is 0 If TARGET_OS_MAC is defined as 1 (not zero): #if defined(TARGET_OS_MAC) && TARGET_OS_MAC is 1 && 1 is 1 If TARGET_OS_MAC is undefined: #if defined(TARGET_OS_MAC) && TARGET_OS_MAC is 0 && 0 (replaced) is 0. #if defined(TARGET_OS_MAC) && TARGET_OS_MAC can be reduced to #if TARGET_OS_MAC .
Are you saying the logic is wrong, or that it's unnecessarly verbose? I used to fix compiler warnings when the macro is undefined and checking for its value anyway. Hence this. The second part defined(TARGET_OS_OSX) && !TARGET_OS_OSX can't be reduced and perhaps is a root error here. My intent was to set OSX to the MAC value, if OSX was set 0, and MAC was set to non-0. I assumed (confirmed by testing macOS builds) that MAC is a synonym for OSX.
Perhaps this is wrong? llvm 18 source code sets them like this: // Apple (Mac) targets. TARGET_OS(TARGET_OS_MAC, Triple.isOSDarwin()) TARGET_OS(TARGET_OS_OSX, Triple.isMacOSX()) It's both "Mac", but with slight difference for the source of these values. Can you verify how are the TARGET_* macros pre-defined when compiling for iOS? sergio-nsk commented on Jul 25, 2024 sergio-nsk on Jul 25, 2024 Contributor Author More actions #define TARGET_OS_OSX TARGET_OS_MAC breaks iOS build.
It should not be changed from 0 to something on iOS. See the llvm::Triple Class Reference : [ bool ]( https : //llvm.org/doxygen/classbool.html) llvm::Triple::isOSDarwin ( ) const Is this a "Darwin" OS (macOS, iOS , tvOS, watchOS, XROS, or DriverKit). So, TARGET_OS_MAC is always 1 for both macOS and iOS. Moreover, checking TARGET_OS_MAC inside #if defined(__APPLE__) looks redundant. I really don't understand the change of TARGET_OS_OSX from 0 to 1.
IMO the commit is wrong, it must not change the pre-defined TARGET_OS_OSX . Especially when it happens AFTER #include <TargetConditionals.h> . So, some system framework headers are included with TARGET_OS_OSX set to 0, other system framework headers are included with TARGET_OS_OSX set to 1. I strongly disagree with such commit and suggest that you revert it and look for other fixes for LLVM clang 18. It also might be a bug in LLVM that should be reported to them. vszakats commented on Jul 25, 2024 vszakats on Jul 25, 2024 Member More actions The problem the commit fixes is valid.
The SDK (via TargetConditionals.h ) is setting these macros wrongly for macOS given a combination of pre-defined macros, in llvm's before v18. The fix is clearly not good in this form by interfering with iOS. How to fix this, I don't know. vszakats commented on Jul 25, 2024 vszakats on Jul 25, 2024 Member More actions Perhaps checking for non-mac TARGET's being set would fix this, but I have no iOS SDK to test it with, and so far nobody contributed iOS CI tests to test it there.
I'm reluctant to spend more days on this just to endure more bashing, but feel free to propose a fix that doesn't break the macOS case while fixing the rest. The 3 weeks spent on macOS and the mess that is Apple and non-Apple (aka open-source) compilers, was probably the worst idea to spend my time on in my FLOSS contribution history. sergio-nsk commented on Jul 25, 2024 sergio-nsk on Jul 25, 2024 Contributor Author More actions Are you sure it was not an issue in the SDK 14.4 or your local?
I don't get errors with the iOS and macOS SDK 14.5 if I revert that commit. This is macOS successful build dump with the reverted commit. -- The CXX compiler identification is Clang 18.1.8 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /opt/homebrew/opt/llvm/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- The C compiler identification is Clang 18.1.8 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /opt/homebrew/opt/llvm/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done <...> % cmake --build out/clien
The rest of this page is on the live site.