- Notifications
You must be signed in to change notification settings - Fork 136
Fixed compilation on Mac Catalyst#306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Conversation
pokryfka commented Sep 11, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
swift-server-bot commented Sep 11, 2020
Can one of the admins verify this patch? |
3 similar comments
swift-server-bot commented Sep 11, 2020
Can one of the admins verify this patch? |
swift-server-bot commented Sep 11, 2020
Can one of the admins verify this patch? |
swift-server-bot commented Sep 11, 2020
Can one of the admins verify this patch? |
Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
Sources/AsyncHTTPClient/NIOTransportServices/TLSConfiguration.swift Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
pokryfka commented Sep 11, 2020
note that /** * @enum SSLProtocol enumeration * @abstract Enumerations for the set of supported TLS and DTLS protocol versions. * * @note This enumeration is deprecated. Use `tls_protocol_version_t` instead. */ publicenumSSLProtocol:Int32{@available(iOS, introduced:5.0, deprecated:13.0)@available(macCatalyst, introduced:13.0, deprecated:13.0) // ... } |
pokryfka commented Sep 11, 2020
CC @Lukasa |
Lukasa commented Sep 11, 2020
Hmm, given your notes above I went back and checked: I have no trouble building the package for macCatalyst. The fact that the macCatalyst guards are redundant suggests that you shouldn't be either. Are you confident that your Xcode build is using the Xcode toolchain and not an OSS one? |
Lukasa commented Sep 11, 2020
I'm increasingly wondering if some of the platform checking for |
Lukasa commented Sep 11, 2020
For now we can address the warning about |
pokryfka commented Sep 11, 2020
How do you build it? I have only Xcode installed, OSS Swift running typically in Docker; The problem came up after importing AHC as Swift package to another iOS Xcode project (supporting macCatalyst platform). |
Lukasa commented Sep 11, 2020
I've been building directly by opening the Package.swift in Xcode using Xcode 12 beta. |
pokryfka commented Sep 11, 2020
Lukasa commented Sep 11, 2020
This is when opening async-http-client directly, not when using it as a dependency? |
pokryfka commented Sep 11, 2020
yes |
Lukasa commented Sep 11, 2020
Hmm, let me get hold of a machine that matches your setup and I'll try to replicate it. |
pokryfka commented Sep 11, 2020
Thank you, please let me know if/what to check/change on my end. |
Lukasa commented Sep 11, 2020
Ok, I have validated this definitely occurs. I'm going to reach out to some colleagues to see if I can understand this better. So far as I know the macCatalyst availability is strictly the same as the iOS availability, so I think this is just a bug in Xcode. |
Lukasa commented Sep 14, 2020
Ok, after some chatting with my colleagues this appears to be due to the awkward combination of the following: I propose we change the block to this: This code is pretty hideous, but it avoids the concern I have about that block scaling up to being too big. We can do the same in the other block. Want to update to that? |
pokryfka commented Sep 14, 2020
@Lukasa thank you for following up on that, updated PR as suggested, let me know if you have more comments BTW when compiling for Mac Catalyst there is still warning:
Not sure if it makes sense to try to fix it (for example by putting the availability inside of targetEnvironment condition), |
Lukasa commented Sep 14, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Yeah, I'm aware of it: I've reported it as a bug upstream. For now I think we have to tolerate it. |
Lukasa left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, LGTM. Thanks!
Lukasa commented Sep 14, 2020
@swift-server-bot test this please |
Lukasa commented Sep 14, 2020
Just some minor formatting issues to cleanup there. |
pokryfka commented Sep 14, 2020
@swift-server-bot test this please |
1 similar comment
Lukasa commented Sep 14, 2020
@swift-server-bot test this please |
Lukasa commented Sep 14, 2020
Aaand now we bump into SR-11560. |
Lukasa commented Sep 14, 2020
There are probably no good routes out of this. Linux doesn't believe macCatalyst exists, so any reference to it will warn, but we have to refer to it in order to get a safe macCatalyst build because it has an explicit unavailable marker for the nonexistent macCatalyst 12-and-earlier version. |
pokryfka commented Sep 14, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
how to define one way to solve this would be to drop support for iOS12. that way AHC would support 2 stable iOS versions and Mac Catalyst |
Lukasa commented Sep 17, 2020
Ok, after some digging I've come up with a proposal. If we wrap the Does that sound acceptable to you @pokryfka? |
pokryfka commented Sep 22, 2020
Thank you for following on that.
To be honest supporting only iOS14/Sift5.3 is not ideal but an improvement nevertheless.
I am not sure I understood it correctly, just tried (ugly!): if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0,*){sec_protocol_options_set_min_tls_protocol_version(options.securityProtocolOptions,self.minimumTLSVersion.nwTLSProtocolVersion)}else{#if swift(>=5.3)#if !targetEnvironment(macCatalyst)sec_protocol_options_set_tls_min_version(options.securityProtocolOptions,self.minimumTLSVersion.sslProtocol)#elsepreconditionFailure("macCatalyst 13 is the first version of macCatalyst")#endif#endif}but it still fails on Linux with Swift 5.2: |
Lukasa commented Sep 22, 2020
Try |
pokryfka commented Sep 22, 2020
#if compiler(>=5.3)#if !targetEnvironment(macCatalyst)sec_protocol_options_set_tls_min_version(options.securityProtocolOptions,self.minimumTLSVersion.sslProtocol)#elsepreconditionFailure("macCatalyst 13 is the first version of macCatalyst")#endif#endifSame, does not compile on Linux and Swift5.2 tested using the docker compose file in the repo: |
weissi commented Jan 18, 2021
@swift-server-bot test this please |
| sec_protocol_options_set_min_tls_protocol_version(options.securityProtocolOptions,self.minimumTLSVersion.nwTLSProtocolVersion) | ||
| }else{ | ||
| sec_protocol_options_set_tls_min_version(options.securityProtocolOptions,self.minimumTLSVersion.sslProtocol) | ||
| #if !targetEnvironment(macCatalyst) |
weissiJan 18, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pokryfka you'll need to do
#if compiler(>=5.3) #if !targetEnvironment(macCatalyst) sec_protocol_options_set_tls_min_version(options.securityProtocolOptions, self.minimumTLSVersion.sslProtocol) #else preconditionFailure("macCatalyst 13 is the first version of macCatalyst") #endif #else sec_protocol_options_set_tls_min_version(options.securityProtocolOptions, self.minimumTLSVersion.sslProtocol) #endif There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
friendly ping @pokryfka
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the reminder and previous comment
my (personal) project using Catalyst and AHC, and in fact swift-server in general, is waiting for my professional contract to finish, which is in a few weeks 🎉
anyway, its a small change, and would be great to be able to use official AHC in my project
will test it and update the PR tomorrow
pokryfka commented May 12, 2021
@weissi actually, I did not push the change back then but I did try |
weissi commented May 12, 2021
@swift-server-bot test this please |
1 similar comment
weissi commented Oct 26, 2021
@swift-server-bot test this please |

Fix compilation on macCatalyst platform.
Motivation:
Support compilation on macCatalyst platform.
Modifications:
Updated availability guards in
TLSConfiguration.Result:
Fixes compilation on macCatalyst platform.
Closes#304