Kotlin-native: Build failed with an exception.

Created on 7 Feb 2018  路  18Comments  路  Source: JetBrains/kotlin-native

when I execute the command sudo./gradlew dependencies:update,
After a period of execution. It return

Configure project :
Evaluating root project 'kotlin-native' using build file '/Users/*/workspace/kotlin-native/build.gradle'.

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/*/workspace/kotlin-native/build.gradle' line: 44

  • What went wrong:
    A problem occurred evaluating root project 'kotlin-native'.

    The /usr/bin/xcrun command returned non-zero exit code: 72.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

my system is osx 10.12.6 and java version "1.8.0_144"

Most helpful comment

I tried all the things above and they didn't work. Apparently even thought I have xCode installed the command line tools weren't installed. Use xCode preferences to select the command line tool. Solution is here:
https://stackoverflow.com/questions/40743713/command-line-tool-error-xcrun-error-unable-to-find-utility-xcodebuild-n?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

All 18 comments

The command of Line 44 in build.gradle is
platformManager = new PlatformManager(konanProperties, dependenciesDir.absolutePath)

*@MacBook-Air kotlin-native$ xcode-select --version
xcode-select version 2347.

*@MacBook-Air kotlin-native$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

What happens if you run gradlew with --stacktrace?

sudo ./gradlew with --stacktrace
Password:
Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

  • Where:
    Build file '/Users/*/workspace/kotlin-native/build.gradle' line: 44

  • What went wrong:
    A problem occurred evaluating root project 'kotlin-native'.

    The /usr/bin/xcrun command returned non-zero exit code: 72.

  • Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Exception is:
    org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'kotlin-native'.
    at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:92)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:204)
    at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:209)
    at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:61)

and so on

What happens if you run xcrun xcodebuild -version manually then?

xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

I think I just install Command Line Tools .I didn't install Xcode

XCode 9.2 is required to compile Kotlin/Native, as stated in docs.

thanks,I have been install Xcode.
However,when I execute sudo kotlinc k.kt -o k to compile the programs,it return errors.

the programs is

fun main(args: Array<String>) {
    println("Hello World!");
}

return:

exception: java.lang.UnsupportedOperationException
    at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:123)
    at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326)
    at org.jetbrains.kotlin.konan.file.FileKt.zipFileSystem(File.kt:174)
    at org.jetbrains.kotlin.konan.file.FileKt.zipFileSystem$default(File.kt:170)
    at org.jetbrains.kotlin.konan.file.FileKt.zipPath(File.kt:183)
    at org.jetbrains.kotlin.konan.file.FileKt.getAsZipRoot(File.kt:186)
    at org.jetbrains.kotlin.backend.konan.library.impl.ZippedKonanLibrary$libDir$2.invoke(KonanLibrary.kt:37)
    at org.jetbrains.kotlin.backend.konan.library.impl.ZippedKonanLibrary$libDir$2.invoke(KonanLibrary.kt:24)
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
    at org.jetbrains.kotlin.backend.konan.library.impl.ZippedKonanLibrary.getLibDir(KonanLibrary.kt)
    at org.jetbrains.kotlin.backend.konan.library.KonanLibraryLayout$DefaultImpls.getTargetsDir(KonanLibrary.kt:34)
    at org.jetbrains.kotlin.backend.konan.library.KonanLibrary$DefaultImpls.getTargetsDir(KonanLibrary.kt)
    at org.jetbrains.kotlin.backend.konan.library.impl.ZippedKonanLibrary.getTargetsDir(KonanLibrary.kt:24)
    at org.jetbrains.kotlin.backend.konan.library.impl.LibraryReaderImpl.<init>(KonanLibraryReaderImpl.kt:53)
    at org.jetbrains.kotlin.backend.konan.library.SearchPathResolverKt.resolveImmediateLibraries(SearchPathResolver.kt:56)
    at org.jetbrains.kotlin.backend.konan.KonanConfig$immediateLibraries$2.invoke(KonanConfig.kt:90)
    at org.jetbrains.kotlin.backend.konan.KonanConfig$immediateLibraries$2.invoke(KonanConfig.kt:38)
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
    at org.jetbrains.kotlin.backend.konan.KonanConfig.getImmediateLibraries$backend_native_compiler(KonanConfig.kt)
    at org.jetbrains.kotlin.backend.konan.KonanConfig.loadLibMetadata(KonanConfig.kt:126)
    at org.jetbrains.kotlin.backend.konan.KonanConfig.<init>(KonanConfig.kt:108)
    at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:58)
    at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:39)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:108)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:52)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:70)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:36)
    at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:157)
    at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:148)
    at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:183)
    at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:174)
    at org.jetbrains.kotlin.backend.konan.util.UtilKt.profileIf(util.kt:34)
    at org.jetbrains.kotlin.backend.konan.util.UtilKt.profile(util.kt:29)
    at org.jetbrains.kotlin.cli.bc.K2Native$Companion.main(K2Native.kt:176)
    at org.jetbrains.kotlin.cli.bc.K2NativeKt.main(K2Native.kt:188)
    at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:27)

without sudo, return the same

What is your JDK version? Did you run ./gradlew clean dist distPlatformLibs?
And you there's no need in superuser priviledges when running compiler, so I would suggest avoid using sudo.

java -version

java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

I just run ./gradlew dist distPlatformLibs

Please do clean as well, seems your klibs are somehow corrupted.

@olonho hello, same issue and get here :) And would you mind if it's possible to add a line in the README.md around _Prerequisites_ section saying "XCode command line is not compatible with this build" or similar? Thanks

I tried all the things above and they didn't work. Apparently even thought I have xCode installed the command line tools weren't installed. Use xCode preferences to select the command line tool. Solution is here:
https://stackoverflow.com/questions/40743713/command-line-tool-error-xcrun-error-unable-to-find-utility-xcodebuild-n?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

I tried all the things above and they didn't work. Apparently even thought I have xCode installed the command line tools weren't installed. Use xCode preferences to select the command line tool. Solution is here:
https://stackoverflow.com/questions/40743713/command-line-tool-error-xcrun-error-unable-to-find-utility-xcodebuild-n?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

thanks, and if xcode version not match please open ignoreXcodeVersionCheck in konan.properties

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dpomada picture dpomada  路  3Comments

msink picture msink  路  4Comments

Marcopohlo picture Marcopohlo  路  4Comments

Cortlandd picture Cortlandd  路  4Comments

barsan-md picture barsan-md  路  4Comments