I was playing with project some time and everything was compiling fine.
Now i try to produce dynamic library from native module, I added dynamic block in native build.gradle but nowe ./gradlew build produces error.
Task :native:compileKonanNative-dynamicLinux
Produced dynamic library API in libnative-dynamic_api.h
/tmp/api255397263770132155.cpp:1:24: warning: extra tokens at end of #ifndef directive [-Wextra-tokens]
ifndef KONAN_LIBNATIVE-DYNAMIC_H
^
//
/tmp/api255397263770132155.cpp:2:24: warning: ISO C99 requires whitespace after the macro name [-Wc99-extensions]
define KONAN_LIBNATIVE-DYNAMIC_H
^
/tmp/api255397263770132155.cpp:6:34: error: expected ';' after top level declarator
typedef unsigned char libnative-dynamic_KBoolean;
^
;
/tmp/api255397263770132155.cpp:7:25: error: typedef redefinition with different types ('char' vs 'unsigned char')
typedef char libnative-dynamic_KByte;
^
/tmp/api255397263770132155.cpp:6:25: note: previous definition is here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:7:34: error: expected ';' after top level declarator
typedef char libnative-dynamic_KByte;
^
;
/tmp/api255397263770132155.cpp:8:25: error: typedef redefinition with different types ('unsigned short' vs 'unsigned char')
typedef unsigned short libnative-dynamic_KChar;
^
/tmp/api255397263770132155.cpp:6:25: note: previous definition is here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:8:34: error: expected ';' after top level declarator
typedef unsigned short libnative-dynamic_KChar;
^
;
/tmp/api255397263770132155.cpp:9:25: error: typedef redefinition with different types ('short' vs 'unsigned char')
typedef short libnative-dynamic_KShort;
^
/tmp/api255397263770132155.cpp:6:25: note: previous definition is here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:9:34: error: expected ';' after top level declarator
typedef short libnative-dynamic_KShort;
^
;
/tmp/api255397263770132155.cpp:10:25: error: typedef redefinition with different types ('int' vs 'unsigned char')
typedef int libnative-dynamic_KInt;
^
/tmp/api255397263770132155.cpp:6:25: note: previous definition is here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:10:34: error: expected ';' after top level declarator
typedef int libnative-dynamic_KInt;
^
;
/tmp/api255397263770132155.cpp:11:25: error: typedef redefinition with different types ('long long' vs 'unsigned char')
typedef long long libnative-dynamic_KLong;
^
/tmp/api255397263770132155.cpp:6:25: note: previous definition is here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:11:34: error: expected ';' after top level declarator
typedef long long libnative-dynamic_KLong;
^
;
/tmp/api255397263770132155.cpp:12:25: error: typedef redefinition with different types ('float' vs 'unsigned char')
typedef float libnative-dynamic_KFloat;
^
/tmp/api255397263770132155.cpp:6:25: note: previous definition is here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:12:34: error: expected ';' after top level declarator
typedef float libnative-dynamic_KFloat;
^
;
/tmp/api255397263770132155.cpp:13:25: error: typedef redefinition with different types ('double' vs 'unsigned char')
typedef double libnative-dynamic_KDouble;
^
/tmp/api255397263770132155.cpp:6:25: note: previous definition is here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:13:34: error: expected ';' after top level declarator
typedef double libnative-dynamic_KDouble;
^
;
/tmp/api255397263770132155.cpp:14:25: error: typedef redefinition with different types ('void ' vs 'unsigned char')
typedef void libnative-dynamic_KNativePtr;
^
/tmp/api255397263770132155.cpp:6:25: note: previous definition is here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:14:34: error: expected ';' after top level declarator
typedef void* libnative-dynamic_KNativePtr;
^
;
/tmp/api255397263770132155.cpp:15:8: error: typedef 'libnative' cannot be referenced with a struct specifier
struct libnative-dynamic_KType;
^
/tmp/api255397263770132155.cpp:6:25: note: declared here
typedef unsigned char libnative-dynamic_KBoolean;
^
/tmp/api255397263770132155.cpp:15:17: error: expected unqualified-id
struct libnative-dynamic_KType;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
error: compilation failed: The /home/kkalisz/.konan/dependencies/clang-llvm-5.0.0-linux-x86-64/bin/clang++ command returned non-zero exit code: 1.
Compiler version info: Konan: EAP 0.6.0.0 / Kotlin: 1.2.0
Output kind: DYNAMIC
exception: org.jetbrains.kotlin.konan.KonanExternalToolFailure: The /home/kkalisz/.konan/dependencies/clang-llvm-5.0.0-linux-x86-64/bin/clang++ command returned non-zero exit code: 1.
at org.jetbrains.kotlin.konan.exec.Command.handleExitCode(ExecuteCommand.kt:96)
at org.jetbrains.kotlin.konan.exec.Command.execute(ExecuteCommand.kt:66)
at org.jetbrains.kotlin.backend.konan.CAdapterCompileKt.produceCAdapterBitcode(CAdapterCompile.kt:25)
at org.jetbrains.kotlin.backend.konan.CompilerOutputKt.produceOutput(CompilerOutput.kt:46)
at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4$2.invoke(KonanDriver.kt:96)
at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4$2.invoke(KonanDriver.kt)
at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:139)
at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:118)
at org.jetbrains.kotlin.backend.konan.util.UtilKt.profileIf(util.kt:34)
at org.jetbrains.kotlin.backend.konan.PhaseManager.phase$backend_native_compiler(KonanPhases.kt:138)
at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4.invoke(KonanDriver.kt:94)
at org.jetbrains.kotlin.backend.konan.KonanDriverKt$runTopLevelPhases$4.invoke(KonanDriver.kt)
at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:139)
at org.jetbrains.kotlin.backend.konan.PhaseManager$phase$$inlined$with$lambda$1.invoke(KonanPhases.kt:118)
at org.jetbrains.kotlin.backend.konan.util.UtilKt.profileIf(util.kt:34)
at org.jetbrains.kotlin.backend.konan.PhaseManager.phase$backend_native_compiler(KonanPhases.kt:138)
at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:88)
at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:61)
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:182)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:173)
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:175)
at org.jetbrains.kotlin.cli.bc.K2NativeKt.main(K2Native.kt:187)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:27)
I also tried other target platforms but same error occurred, no other files have been modified.
Maybe i missing some configuration ?
Any suggestion would be helpful.
I renamed dynamic('native-dynamic') to dynamic('native_dynamic') and now everything working fine.
I will investigate situation and start discussion on kotlin native repo.
I was playing with project some time and everything was compiling fine. Now i try to produce dynamic library from native module, I added dynamic block in native build.gradle but nowe ./gradlew build produces error.
My build.gradle in native folder looks this:
I also tried other target platforms but same error occurred, no other files have been modified. Maybe i missing some configuration ? Any suggestion would be helpful.