ss-abramchuk / OpenVPNAdapter

Objective-C wrapper for OpenVPN library. Compatible with iOS and macOS.
GNU Affero General Public License v3.0
482 stars 217 forks source link

Possibility of adding functionality for cross platform #128

Open mchlbowyer opened 5 years ago

mchlbowyer commented 5 years ago

Hi @ss-abramchuk ,

Is there any possibility of you modifying the library to allow the new cross platform macOS from iOS as seen in the Xcode 11 beta? I tested it last night and get a lot of errors:

"missing required architecture x86_64 in file /OpenVPNAdapter/Sources/OpenVPNAdapter/Libraries/Vendors/mbedtls/lib/ios/libmbedx509.a" and a lot of others similar (Understand the reasoning as it wouldn't include x86_64 for the iOS version, but not sure what changes to make to support it).

Thanks, Mike

ss-abramchuk commented 5 years ago

Hi @mchlbowyer,

Could you try feature/fat-libraries branch and let me know if it works for you? Libraries in this branch contains symbols for both iOS and Simulator.

mchlbowyer commented 5 years ago

@ss-abramchuk trying it now, will report back asap

mchlbowyer commented 5 years ago

@ss-abramchuk seems to build now, however get the error "Network extensions are not available when building for UIKit for Mac." - guessing I will just have to wait and see if this is added after the beta, unless you know of a workaround?

ss-abramchuk commented 5 years ago

Alas, I haven't touched beta versions yet so don't have any workaround. But maybe it worth to ask Apple support whether they are going to add Network Extension or not.

mchlbowyer commented 5 years ago

Hi Sergey,

Just looking at this again as it's been a while, but cannot see the features/fat-libraries any more. Which is the best branch to use for this? Or have you had time to have a look now?

Thanks, Mike

ss-abramchuk commented 5 years ago

Hi @mchlbowyer,

I merged fat-libraries into master branch so you can try the latest stable version. But I deliberately disabled Mac target for iOS framework in case network extension still not available because I didn't have a chance to check it yet.

mchlbowyer commented 5 years ago

Hi @ss-abramchuk,

Thanks for the quick reply. Is it an easy change to enable Mac target?

Cheers, Mike

ss-abramchuk commented 5 years ago

Just one checkbox in project settings -> OpenVPNAdapter iOS target -> general tab -> deployment info section. You can fork repo and try to switch it back.

mchlbowyer commented 5 years ago

I thought it would be more complicated than that...

So I did that, but now getting a build error: "ld: in /iOS-Development/Frameworks/OpenVPNAdapter/Sources/OpenVPNAdapter/Libraries/Vendors/lz4/lib/macos/liblz4.a(lz4.o), building for Mac Catalyst, but linking in object file built for macOS, for architecture x86_64" - will continue investigating unless you know the issue with that one?

ss-abramchuk commented 5 years ago

Probably, libraries for iOS should be compiled with flag -arch x86_64 in addition to other archs. I'm not sure about tomorrow but I will have some time on Sunday to check it.

mchlbowyer commented 5 years ago

Thanks Sergey :) If I manage to sort it before then I will report back.

mchlbowyer commented 5 years ago

@ss-abramchuk did you get any time to have a look at this?

ss-abramchuk commented 5 years ago

Hi @mchlbowyer,

I had a chance to take a look and I don't have good news for now. In order to support Mac Catalyst we need two static libraries compiled for Mac but for different targets. It should be done for every dependency. The problem is these libraries cannot be merged using lipo because both of them will have x86_64 arch. I could use different build conditions for iOS and macOS targets but it would break cocoapods because it doesn't support such configuration.

The solution is to use new framework format xcframework. All necessary archs can be combined there. The only thing is we have to wait till cocoapods devs update their tool and add support of this format. And hopefully, it won't affect min target version as I still want to support iOS 9.