compileKotlinIos FAILED - Could not find stdlib - ios

I am trying to compile kotlin multiplatform, which contains iOS target.
I tried different examples over github, but most of them are outdated and don't work, probably because of incompatibility with current tools. Thing, that seems most reasonable is creating Mobile Android/iOS | Gradle or Mobile Shared Library | Gradle project using IntelliJ Idea.
When I create brand new project, I am still getting same error:
> Task :app:compileKotlinIos FAILED
e: Could not find "stdlib" in [~/git/iosandroidtest, ~/.konan/klib, ~/.konan/kotlin-native-macos-1.3.61/klib/common, ~/.konan/kotlin-native-macos-1.3.61/klib/platform/ios_x64].
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileKotlinIos'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
I am using kotlin 1.3.61, xcode 11.3. Any ideas?
Edit:
I pushed empty project (without any changes from me) to github:
https://github.com/hovi/iostest

I think you just ran into a bug with partial archive download.
Per the author there, "I got a snapshot of the .konan directory. It's interesting as it looks like part of the runtime download is there, but some parts are missing. Specifically in this case the common folder in klib, but also the licenses folder.
I was able to repro this locally by killing the build process while the archive is being extracted. For reference, see NativeCompilerDownloader. It looks to see if the folder is there. If not, it'll download and extract. If yes, the build process assumes everything is OK. ... Their local build will certainly be broken from then on until they clean and rebuild ~.konan." I suggest you report your issue there as well. (btw - tried your project in IJ and AS (as well as creating new lib project in IJ), didn't have any issues. Somehow your bad luck with an interrupted download (:))
Link to GitHub issue

Related

Building iOS app using Xcode works, but building the same app with xcodebuild command fails

Both new flutter and new react-native projects fail to build because the xcodebuild tool fails. They, however, succeed when I build the projects manually inside Xcode.
Apparently, the reason is because xcodebuild adds additional flag during the build, that, is:
export OTHER_CPLUSPLUSFLAGS=" -fmodule-map-file="/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap""
The result is that the build is failing because it cannot find the said module map, with the following error:
<unknown>:0: error: module map file '/Users/aa/code/WW2/ios/Pods/Headers/Public/SSZipArchive/SSZipArchive.modulemap' not found
The said module map is from a previous project (called WW2) which I moved. But the problem is that even newly-created projects are affected.
I wasted two days to solve this, even reading through the documentation about xcode build settings, but to no avail. What I'm trying to do is to find the source of this additional flag or configuration. I even used grep to find a file containing the particular flag, but it's not yet finished scanning my system.
So the problem is somehow the $PODS_ROOT variable is set to /Users/aa/code/WW2/ios/Pods, probably due to a canceled npm build. I only needed to restart the terminal and the problem is solved.
As a side note, I should have used the search function in the finder as it's much faster because it uses an index unlike grep.

Fortify unable to load build session with ID when scanning iOS project

When scanning iOS project using Fortify, we are facing "unable to load build session with ID" issue.
What I did was, I opened the project by pointing to the folder of the source code. Then this error happened.
I am facing the same error while building a project written in C++. I am using VS 2017 and Fortify is throwing this error while running Analyze solution on .sln file.
Maybe this is occurring because of trying to translate and run -show-build-warnings in one command.
-show-build-warnings is a separate step, and will only work after translation, so try your command without that switch.
If it completes successfully, then you can run from VS dev cmdprompt sourceanalyzer -b -show-build-warnings to check for warnings.
You can check 'not show warning as errors' and reduce warning level to W3 and then build the solution in debug mode.
I resolved this by first doing the equivalent of a "make clean". If there are already executables there, sourceanalyzer make -s will no op and Fortify will not be able to work with them.

Why do I need to clean the xcode project everytime I build the project?

I have an iOS app written in Swift. Whenever I run the project, it gives Shell Script Invocation Errors:
When I clean the project, the subsequent build performs ok. But again, if I build the project next time, it again gives the same error.
Cleaning and rebuilding the project takes a lot of time. Is there some way around it?
It's difficult to know exactly what is causing this issue as it could be a number of things, So the question is quite broad.
Few things to try...
Check your build phases in the project and look for anything that might not be expected
Try checking out your project (if using version control) in another location such as your Documents folder to make sure there isn't a permissions issue.
Try cleaning the build folder using alt, cmd, shift + k.
If your still having issues after that try providing additonal information.
What version of xcode are you using?
Are you using any xcode plugins?
Are you using any package management solutions? carthage? pods?
Have you tried to build your project on another computer?
Are you using the latest version of the command line tools?

Pub error: Pub build failed, [255] Wrong script snapshot version

I have started getting this issue now after going through a lot of "chaos" with performing a system restore (I'm on Win8.1) while trying to get a certain game working again. Now that that mess is over and done with, I have been left with a few apps and such removed and needing to be reinstalled, including the JDK which I have already reinstalled. Since I have a project I need to work on I opened up DartEditor again and when I tried to do pub build I get this error:
Pub build failed, [255] Wrong script snapshot version, expected
'f6711525cff9f7d0d08595166664b767' found '836a274342f7f88d6b5a9bb59b2649a9'
Googling led me to this old issue but that's labelled as fixed...what could be going wrong here?
Ok, so deleting the dart directory (the one with the editor executable, relevant .jar files and all that other stuff) and downloading it anew did resolve my issue. I'm curious though as to whether anyone knows what might have caused the issue, and/or what other things I might have been able to do to resolve it.

Three20 Issues with Build and Archive on XCode 4

I have ported an existing Three20 xcode 3.2 project to xcode 4 using the tutorial
The code compiles and runs on the device. Now, I am trying to build an ipa (using the archive command) and am running into similar errors as this stackoverflow post
The error is:
cd: /Users/[username]/Library/Developer/Xcode/DerivedData/Pulse_News-cnosepsavjismxbmhuvmmvxnnpgh/ArchiveIntermediates/Pulse News/BuildProductsPath/Release-iphoneos/../three20/Three20Core: No such file or directory
Unfortunately, neither the tutorial nor the post have helped much. Is there something I am missing? Is funny that I am able to build the project and run it fine, but not able to build an archive! Please help.
My guess is the "No such file or directory" error message is correct. Considering this, the answer to your question depends on your providing more information about how you have project dependencies and search paths configured in your project.
For self-help, take a careful look at the path it's saying doesn't exist and see if you can figure out why. Note projects within the same workspace share build paths; if you're not using a workspace, you'll need to verify the search paths point to the build location of the other (three20) project.
This is probably the first of your problems. When you upgrade a three20 xcode 3.2 project to 4, you will probably also get an invalid binary message when you upload to itunes.
The only solution that worked for me was to create a new project, re-add all the source files and run the three20 python script with something like:
python /Users/yourpath/three20/src/scripts/ttmodule.py -p /Users/yourpath/YourProject.xcodeproj Three20 extThree20JSON:extThree20JSON+SBJSON --xcode-version=4 -c Debug -c Release
It's a pain to have to do this but it will probably save you more pain down the line

Resources