Error working with two frameworks in Xcode - ios

I need to work with two third party frameworks in my Xcode project but the two of them use Google's Protocol Buffer library and they were compiled against different versions of that library. Both frameworks work fine separately but when I try to use them in the same project I get this error message:
[libprotobuf FATAL /Users/jari/dev/indooratlas-sdk/indooratlas-ios-sdk/target/framework/IDAAlgorithm/cpp-algorithms/cpp/protobuf/protobuf-cmake/protobuf-2.6.0/src/google/protobuf/stubs/common.cc:72] This program was compiled against version 2.4.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (2.6.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "".)
libc++abi.dylib: terminating with uncaught exception of type google::protobuf::FatalException: This program was compiled against version 2.4.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (2.6.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "".)
The error message states that I should contact the program author to get an update but I would like to know if there is something that I can do to fix the problem.

If you have the source code for the frameworks, you should be able to compile them both using the latest version of Protobufs. You will need to regenerate all of the .pb2.cc and .pb2.h files using the latest protoc and link against the latest library version.
If you do not have the source code for the frameworks, then you need to contact the authors and ask them to compile against the newer Protobufs. Without code there is no way to do this yourself.

Related

How to test if flag BUILD_LIBRARY_FOR_DISTRIBUTION = TRUE works

I got a complaint from a client that library i made was throwing an error when they try to import it. Error is saying: "Module compiled with Swift 5.3 cannot be imported by the Swift 5.4 compiler". After some research i found out about ABI, and I understand the cause of this error.
Now I want to test if this solution works before shipping the fix. I downloaded a few older toolchain versions hoping that by switching them I could simulate this kind of situation. Setting the distribution flag for the library, building it with older toolchain and then importing it to a project with newest version of toolchain. However I still get the same error. Im I doing this right? What I am missing?

How to prebuilt libraries to be compatible with future swift versions

We are prebuilding some libraries (mainly with carthage) for some of our projects to reduce development times. These libraries are not updated very often, but we want to update our XCode versions pretty fast.
Now every time a new XCode brings a new swift version, we are seeing this incompatibility issue
File.swift:4:8: error: module compiled with Swift 5.3.2 cannot be imported by the Swift 5.4 compiler: /......./Debug-iphoneos/Alamofire.framework/Modules/Alamofire.swiftmodule/arm64-apple-ios.swiftmodule
How can I pre-build my dependencies in a way that a swift update wont affect it and I dont have to re-build the dependencies with every xcode update (I thought thats what ABI stability was for? How can I activate that?)
It sounds like you're misunderstanding what ABI stability enables. The main benefit is that it allows the OS to include only one version of the Swift standard library, and for all Swift binaries to share it. What you want is "module stability". From the docs on ABI stability:
ABI stability is about mixing versions of Swift at run time. What
about compile time? Right now, Swift uses an opaque archive format
called “swiftmodule” to describe the interface of a library, such as a
framework “MagicKit”, rather than manually-written header files.
However, the “swiftmodule” format is also tied to the current version
of the compiler, which means an app developer can’t import MagicKit if
MagicKit was built with a different version of Swift. That is, the app
developer and the library author have to be using the same version of
the compiler.
To remove this restriction, the library author needs a feature
currently being implemented called module stability. This involves
augmenting the opaque format with a textual summary of a module,
similar to what you see in Xcodeʼs “Generated Interface” view, so that
clients can use a module without having to care what compiler it was
built with.
This is not yet supported in any version of Swift.

How to avoid "libraries attached to project that were compiled with kotlin/native compiler" error?

I am working on a Kotlin Multiplatform Mobile project. Tried adding in libraries for KMM, but I am getting
There are __ third-party libraries attached to the project that were compiled with an older Kotlin/Native compiler and can't be read in IDE.
The android project builds without problem so I was wondering if whether this error is only a warning and doesn't not affect the application at all?
Is there anyway to avoid this issue? How can I know if a library could be used for Kotlin Native?
Kotlin/Native doesn't guarantee binary compatability between versions - although as of 1.4 minor versions are experimentally binary backwards compatible. e.g. 1.4.10 should be compatible with 1.4.20 in the same project.
The easiest way to avoid the error is to ensure you're using KMM libraries with the same kotlin version as the kotlin version your project uses. Same goes for the IDE plugin.
Generally kotlin libraries by Jetbrains stay very up to date, as well as bigger libraries like SqlDelight. But smaller third party libraries can fall behind.
This issue is being actively worked on.

CocoaPods 'auto property synthesis' error in installed library

The project I am working in is a Swift project. I needed to import a Objective C library and installation was only available (advertised) through 'CocoaPods'. I proceeded and installed the required library and built a bridging header.
Now for some reason I have a single random error deep in one of the files in the library. I'm 99% sure this is a problem with my set up as I can't find anyone else using Braintree (a rather popular payment service by PayPal) with the same problem.
Any ideas?
This looks like a consequence of overriding NSObject's description whose definition changed in iOS 8. (See http://www.redwindsoftware.com/blog/post/2014/08/20/NSObject-has-some-new-properties-in-iOS-8.aspx). Is there a more recent release of this library available for you to use?

How to HTTPS/POST on iOS in latest Delphi using native calls?

The latest version of Delphi, XE4, allows for the building of iOS applications. There was some discussions on the newsgroups to use native iOS libraries for HTTPS/Posting to avoid issues with OpenSSL libraries and Indy 10. What's the recommended way of using native libraries to perform HTTP Posting? (In my example, JSON document upload and response.)
I figured it out...
Background:
Indy, the "native" code used for webservice calls in XE4, relies on OpenSSL. In most situations, OpenSSL is linked to via dynamic library (in windows a DLL). iOS does not support dynamic libraries, therefore once the code is compiled into a binary and sent to an iOS device, the OpenSSL calls fail because there is no backing library. The solution is to compile OpenSSL into your project. You can do this by downloading the OpenSSL source and adding it to your project, or source the static libraries from somewhere else and add them to your project. I found the static libraries here:
http://indy.fulgan.com/SSL/OpenSSLStaticLibs.7z
That is one of the indy mirrors, so hopefully it should be OK. You need to put the two files somewhere that your project is knowledgeable of and then add IdSSLOpenSSLHeaders_Static to your uses. Now, your compiled code will include the OpenSSL code and your issue should be resolved.

Resources