Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Could not find "stdlib" - build failing sporadically due to missing konan libs #3415

Closed
AlecKazakova opened this issue Oct 2, 2019 · 10 comments

Comments

@AlecKazakova
Copy link

This only started happening recently - really hard to diagnose what's going on but my only two hypotheses are its related to a mac osx update or something in kotlin native, i've seen it occur in 1.3.30 up to 1.3.50

here is the full error:

e: Could not find "stdlib" in [/Users/[account]/Development/cash/Code/Kotlin/CashSearch, /Users/[account]/.konan/klib, /Users/[account]/.konan/kotlin-native-macos-1.3.50/klib/common, /Users/[account]/.konan/kotlin-native-macos-1.3.50/klib/platform/ios_arm64].

Caused by: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
    at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:396)
    at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:38)
    at org.gradle.process.internal.DefaultExecActionFactory.javaexec(DefaultExecActionFactory.java:129)
    at org.gradle.api.internal.project.DefaultProject.javaexec(DefaultProject.java:1105)
    at org.jetbrains.kotlin.compilerRunner.KonanCliRunner.run(KotlinNativeToolRunner.kt:126)
    at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinNativeCompile.compile(KotlinNativeTasks.kt:306)
    at org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink.compile(KotlinNativeTasks.kt:449)

It also happens semi-frequently with CI builds, but its not every time. if there's more info i can get to help in debugging please let me know.

@artdfel
Copy link
Contributor

artdfel commented Oct 2, 2019

Hello! Thank you for the report.
Can you elaborate some more and answer a few questions? For example, are you facing it with different projects or only some exact one? Maybe, there is some estimate percent of builds, that are falling like that?
Also, is this issueios_arm64 target-specific, or not?

@kpgalligan
Copy link
Contributor

We're working on getting better info. It seems like this starts happening after a while, and then the local build stops working, but I can't quite confirm that yet. Clearing ~/.konan and rebuilding works. This had mostly happened on CI, but at least one developer ran into it locally. Hopefully will have a way to repro soon.

@kpgalligan
Copy link
Contributor

I have more info now. There was one developer who saw this on their local machine consistently for sure. 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.

If you kill the process while extracting, future builds will think the runtime is there, but they'll fail because the whole thing isn't actually extracted.

It seems safer to extract to a temp location, then rename to the final when the extract is complete.

While I was able to repro this locally by killing the build mid-extract, I'm not very confident that this is causing the issues we've seen. However, if the user does manage to do this, their local build will certainly be broken from then on until they clean and rebuild ~.konan.

@ilmat192
Copy link
Contributor

ilmat192 commented Oct 9, 2019

Thank you for the investigation! I'll fix the downloader as you suggested to avoid this problem in future.

@hovi
Copy link

hovi commented Jan 2, 2020

Just fyi, I ran into same problem, my machine ran out of disk space while downloading:
https://stackoverflow.com/questions/59556319/compilekotlinios-failed-could-not-find-stdlib/59557320#59557320

@belovrv
Copy link

belovrv commented May 17, 2020

Same issue for me. Also due to running out of disk space during the download on update

@SvyatoslavScherbina
Copy link
Collaborator

According to migrating issue tracking to YouTrack, closing this issue in favour of https://youtrack.jetbrains.com/issue/KT-39016

@LNeway
Copy link

LNeway commented Jun 10, 2020

Still have this issue

@r4zzz4k
Copy link

r4zzz4k commented Jun 10, 2020

@LNeway the issue is not marked as resolved in YouTrack, you can follow and / or add any details if you have any there. Please see #4079 for further details on why this issue is closed here on GitHub.

@m4rr
Copy link

m4rr commented Apr 18, 2021

I have 20 GB left isn't it enough? Still have this Could not find "stdlib" issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants