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?
Related
I'm new to KMM but I really wanna get into it. It is obvious that I will make a lot of mistakes during my journey. What makes me a little bit frustrated is, that I'm not able to translate given errors to the reason why it happen. I'm working on a M1 Mac mini.
It would be awesome if someone could show me how he / she would investigate the following issue:
Issue
Does anyone know what causes an error if I try to build iOS:
Task
> Task :shared:compileKotlinIosSimulatorArm64 UP-TO-DATE
./gradlew :shared:embedAndSignAppleFrameworkForXcode
Log
/Users/.../iosApp/ld:1:1: object file (/var/folders/yt/4pjlxzfn48n28yxvdsnrw6n40000gn/T/included3352453535999755831/libparticles.a(libparticles.SkParticleBinding.o))
was built for newer iOS Simulator version (15.2) than being linked (9.0)
I'm using the "Regular framework" approach.
What I already did
Checked the project of "9 occurrences because of the mentioning of iOS 9
I checked my versions, but maybe I have a Version mismatch somewhere in my Kolin code?
I created it freshly new
Gist
Full stacktrace:
https://gist.github.com/tscholze/6d67bc21a2b8e1bdc575e6b80ca8af2b
Check several publications with the same compilation error, and it really seems annoying that some libraries do not have support for current versions, well Apple also updates the Xcode many times along with the Swift version. Then after reviewing many publications and research, I discovered this post where they indicate:
Swift 5 provides binary compatibility for applications: a guarantee
that, in the future, an application created with one version of the
Swift compiler will be able to communicate with a library built with
another version. This applies even when using the version
compatibility mode from previous languages (-swift-version 4.2).
In other cases, they indicate using carthage update --platform iOS --no-use-binaries but I am using cocoapod so I cannot use that solution and finally indicate enabling Build Libraries For Distribution, but nothing really worked for me until now and I can't help thinking that maybe tomorrow they will launch swift 5.1.4 and the support they make for swift 5.1.3 is unusable.
I really hope you can help me with the solution to the problem I present with the compilation error and if anyone knows about the post ABI STABILITY
In Xcode 9, I am trying to do the automatic conversion to Swift 4.
It fails with the following message:
Convert to Current Swift Syntax Failed
Please ensure that all selected targets build successfully with the currently configured Swift version before attempting a migration.
It's complaining of a missing module. But when I do a regular build there are no issues. Not sure if this is relevant, but the module (which Xcode is complaining is missing) was already converted to Swift 4 earlier (in it's own project).
Note: No Cocoapods / Carthage used here.
Note: Two solutions tried (and worked) but do not address the underlying issue.
One solution is to do the conversion manually (change Swift version to 4 in build setting and apply Fix-Its one by one until no more build errors).
Another solution is to disable the third party framework (comment out all code where it's used), do the auto-migration, and then re-enable the framework. This could get pretty difficult with bigger projects.
I can't find any solution yet.
For now I fix manually setting Swift Language Version
After changing from 3.2 to 4.0 I compile and fix errors and warnings manually.
I'm waiting for a better solution!
I also got this problem while converting my project to Swift 4.0. Looks like problem appears when you try to convert target which imports a framework which is already in Swift 4.0. At your screenshot you try to convert 'RecipeTextParser' which imports 'SovaTools' which is already Swift 4.0.
I found dirty, but working solution. You can use older(Swift 3.2) version of 'SovaTools' when converting. You should NOT check it's mark in target selection window of conversion tool. Then, when 'RecipeTextParser' will be successfully converted you can use Swift 4.0 'SovaTools' version again.
I got this error and in my case one of my Pods(the one Xcode was complaining about) was a Swift 4 target and the rest were Swift 3.2. Looking at the build logs it looks like Xcode built that framework in one location and was searching for it in another. When I reverted that Pod to an older version(that used Swift3.2) the problem went away. Obviously a Xcode bug. HTH
Just update your pod and it will resolve the issue.
To update pod:
open terminal and go to your project directory
type pod update
This resolved my issue.
Xcode (Xcode 9) language migration feature is not as much accurate that it can migrate your complete code/project from one swift version to another with zero tolerance. It skips few code migration for us (developers). It may be bug or inaccuracy of tool. But you need to put some manual effort also, to completely migrate swift language version for your project/code.
Now, according to your snapshot, Xcode is showing and error for 'RecipeTextParser' framework. I think this is an external/third party framework. Another point to note, you've integrated this framework using CocoaPods:
Any one of following can be reason for failure of code migration:
CocoaPods locks framework (files) for editing. So language migration process may not be able to migrate (or identify) code for external/thirdparty framework.
In general terms, Framework is package of code files, so framework itself may not allow file/source code editing.
Suggestion as solution:
Update your cocoa pods as well as all frameworks integrated using cocoa pods compatible to latest swift language version.
If you've manually integrated/added external/third party frameworks, then you need to update/replace those also.
Some manual effort is required to completely migrate code between swift languages. I tried swift migration with above options and my all projects are now compatible with swift 4.
I have a slight issue when build my Xcode project, get tones of warning after update pod. It looks like this
Already search the whole site here but still no luck. it doesn't affect the project but it is quite annoying. Anyone could help?
It probably means their binary file has non-aligned pointer when they compile their code. In those cases the alignment basically defaults to 1 byte and hypothetically might impact performance.
After updating to Xcode 8.3 public release I am still seeing this error, so Google might need to compile their static library with different settings to make it go away.
Got this response from firebase support:
This is a known issue with Xcode 8.3 beta, so it might be a beta thing
and Xcode being extra verbose. It works well though with 8.2.1 so I
recommend temporarily use it to avoid the warnings or ignore the
warnings on 8.3 beta if it does not affect your app.
This has been fixed in Firebase 3.16.0 (Firebase Core 3.6 + Firebase Analytics 3.8.0)
guys, it is all fixed now. Tested it all myself on two projects. You got to go to the correct directory of your project so that your pod spec file is visible to your command line commands, run
pod update
and see it all fixed and working properly!
These problems are addressed, and likely fixed, with release 3.16.0.
how can I fix this error?:
http://i.stack.imgur.com/zmZea.jpg
I got this error when compiling a simple c++ file but I don't know why
When I compile this file with iOS 6.1 sdk it works but I want it to work in iOS sdk 8.1
My iPad:ipad 3 wifi
My iOS version:8.4
It shouldn't be problem with the architecture. As far as I know Apple hasn't changed Armv7. From what I see, its a linker error, probably caused by libraries not being linked in correctly. Pretty clear when it says: ignoring nonexistent library. This type of error could occur if you import a header and fail to link it against the correct library OR if you just straight up include a header for the wrong architecture -_-.
So thats the diagnosis. I guess the rest of the hacking is up to you since no one here has any clue what you have done to the poor iPad.