Kotlin / kotlinx.serialization

Kotlin multiplatform / multi-format serialization
Apache License 2.0
5.43k stars 621 forks source link

Shared and static libraries fail to compile with macosX64 target #502

Closed luca992 closed 5 years ago

luca992 commented 5 years ago

On mac compiling an executable works, but shared and static libaries are failing.

The stacktrace when build with a shared library as output

> Task :app:linkDebugSharedMac
e: Compilation failed: no function childSerializers in org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl@51bfcb7

 * Source files: ......Removed......
 * Compiler version info: Konan: 1.3 / Kotlin: 1.3.40
 * Output kind: DYNAMIC

e: java.lang.IllegalStateException: no function childSerializers in org.jetbrains.kotlin.ir.declarations.impl.IrFileImpl@51bfcb7
        at org.jetbrains.kotlin.backend.konan.llvm.CodeGenerator.llvmFunction(CodeGenerator.kt:23)
        at org.jetbrains.kotlin.backend.konan.ExportedElement.generateCAdapter(CAdapterGenerator.kt:214)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:164)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.ExportedElementScope.generateCAdapters(CAdapterGenerator.kt:167)
        at org.jetbrains.kotlin.backend.konan.CAdapterGenerator.generateBindings(CAdapterGenerator.kt:709)
        at org.jetbrains.kotlin.backend.konan.CAdapterGenerator.generateBindings(CAdapterGenerator.kt:677)
        at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.appendCAdapters(IrToBitcode.kt:298)
        at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitModuleFragment(IrToBitcode.kt:328)
        at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid$DefaultImpls.visitModuleFragment(IrElementVisitorVoid.kt:28)
        at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitModuleFragment(IrToBitcode.kt:199)
        at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitModuleFragment(IrToBitcode.kt:199)
        at org.jetbrains.kotlin.ir.declarations.impl.IrModuleFragmentImpl.accept(IrModuleFragmentImpl.kt:41)
        at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoidKt.acceptVoid(IrElementVisitorVoid.kt:258)
        at org.jetbrains.kotlin.backend.konan.llvm.BitcodePhasesKt$codegenPhase$1.invoke(BitcodePhases.kt:107)
        at org.jetbrains.kotlin.backend.konan.llvm.BitcodePhasesKt$codegenPhase$1.invoke(BitcodePhases.kt)
        at org.jetbrains.kotlin.backend.konan.KonanLoweringPhasesKt$makeKonanModuleOpPhase$1.invoke(KonanLoweringPhases.kt:54)
        at org.jetbrains.kotlin.backend.konan.KonanLoweringPhasesKt$makeKonanModuleOpPhase$1.invoke(KonanLoweringPhases.kt:52)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper$runBody$1.invoke(CompilerPhase.kt:113)
        at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.downlevel(CompilerPhase.kt:23)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.runBody(CompilerPhase.kt:112)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.invoke(CompilerPhase.kt:92)
        at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:28)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper$runBody$1.invoke(CompilerPhase.kt:113)
        at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.downlevel(CompilerPhase.kt:23)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.runBody(CompilerPhase.kt:112)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.invoke(CompilerPhase.kt:92)
        at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:28)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper$runBody$1.invoke(CompilerPhase.kt:113)
        at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.downlevel(CompilerPhase.kt:23)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.runBody(CompilerPhase.kt:112)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.invoke(CompilerPhase.kt:92)
        at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:28)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper$runBody$1.invoke(CompilerPhase.kt:113)
        at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.downlevel(CompilerPhase.kt:23)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.runBody(CompilerPhase.kt:112)
        at org.jetbrains.kotlin.backend.common.phaser.AbstractNamedPhaseWrapper.invoke(CompilerPhase.kt:92)
        at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:41)
        at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:27)
        at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:79)
        at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:34)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:82)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:50)
        at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:215)
        at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMain(CLITool.kt:207)
        at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:215)
        at org.jetbrains.kotlin.cli.bc.K2Native$Companion$main$1.invoke(K2Native.kt:212)
        at org.jetbrains.kotlin.konan.util.UtilKt.profileIf(Util.kt:40)
        at org.jetbrains.kotlin.konan.util.UtilKt.profile(Util.kt:34)
        at org.jetbrains.kotlin.cli.bc.K2Native$Companion.main(K2Native.kt:214)
        at org.jetbrains.kotlin.cli.bc.K2NativeKt.main(K2Native.kt:296)
        at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:16)

> Task :app:linkDebugSharedMac FAILED

FAILURE: Build failed with an exception.

Environment

glootjofo commented 5 years ago

Can confirm this happens for static libraries on ios too