Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nativeMain build error (commonMain -> mingwX64 native #29

Closed
hansimmmi opened this issue Oct 5, 2022 · 8 comments
Closed

nativeMain build error (commonMain -> mingwX64 native #29

hansimmmi opened this issue Oct 5, 2022 · 8 comments
Assignees

Comments

@hansimmmi
Copy link

Hi, I am trying to test the module on Multiplatform on android, iOS and native platform, Kmm project build fine for android and IOS project, but error with native Main.

simply added sourceSet of commonMain with

implementation("com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7")

My mingwX64 setup is

mingwX64("native") { binaries { sharedLib { baseName = "libnative" } } }

Any idea?

`mtkSharedModule:nativeMain: Could not resolve com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7.
Required by:
project :

Possible solution:

@ionspin ionspin self-assigned this Oct 5, 2022
@hansimmmi
Copy link
Author

more error message,

`Execution failed for task ':compileKotlinNative'.
Could not resolve all files for configuration ':nativeCompileKlibraries'.

Could not resolve com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7.
Required by:
project :
> No matching variant of com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 was found. The consumer was configured to find a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64' but:
- Variant 'debugApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares an API of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'debugRuntimeElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a runtime of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'iosArm32ApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm32' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'iosArm32MetadataElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm32' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'iosArm64ApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'iosArm64MetadataElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'iosSimulatorArm64ApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'iosSimulatorArm64MetadataElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'iosX64ApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'iosX64MetadataElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'jsApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a usage of 'kotlin-api' of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'jsRuntimeElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a library:
- Incompatible because this component declares a usage of 'kotlin-runtime' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js' and the consumer needed a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'jvmApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares an API of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'jvmRuntimeElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a runtime of a library:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native'
- Other compatible attribute:
- Doesn't say anything about org.jetbrains.kotlin.native.target (required 'mingw_x64')
- Variant 'linuxArm64ApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'linux_arm64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'
- Variant 'linuxX64ApiElements-published' capability com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.7 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'linux_x64' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64'`

@ionspin
Copy link
Owner

ionspin commented Oct 5, 2022

Thanks for the logs! I'll have a look into it.

@ionspin
Copy link
Owner

ionspin commented Oct 5, 2022

The artifact for mingwx64 is published, but the common library module.xml doesn't contain it. I'll have to look into what is going on with gradle publishing there.

@ionspin
Copy link
Owner

ionspin commented Oct 5, 2022

Hey @hansimmmi this should be fixed in the snapshot release now.

The original cause was somewhat of a regression. When kotlin enabled automatic cross-compiling on linux for windows targets I disabled windows target on linux build because it didn't have access to libsodium that was being built on a real windows machine. I forgot that it will remove mingw from the module.xml. Now it's fixed by leaving the target on linux, but disabling linking, compilation and publishing.

Could you please try the snapshot and tell me if everything is working as expected?

This is the snapshot version setup:

repositories {
    maven("https://oss.sonatype.org/content/repositories/snapshots")
}
implementation("com.ionspin.kotlin:multiplatform-crypto-libsodium-bindings:0.8.8-SNAPSHOT")

If everything is fine I'll release a stable 0.8.8 with this fix.

Thanks!

@hansimmmi
Copy link
Author

@ionspin Thank you for prompt reply!
Unfortunately, I got different error with snapshot build now.

`Task :compileCommonMainKotlinMetadata FAILED
e: java.lang.IllegalStateException: e: Could not find "/Users///*/build/kotlinSourceSetMetadata/commonMain/com.ionspin.kotlin-multiplatform-crypto-libsodium-bindings/com.ionspin.kotlin-multiplatform-crypto-libsodium-bindings-commonMain.klib" in [/Users//Library/Application Support/kotlin/daemon]
at org.jetbrains.kotlin.library.SingleFileResolveKt$resolveSingleFileKlib$1.fatal(SingleFileResolve.kt:21)
at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:175)
at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:181)
at org.jetbrains.kotlin.library.CompilerSingleFileKlibResolveStrategy.resolve(SearchPathResolver.kt:302)
at org.jetbrains.kotlin.library.SingleFileResolveKt.resolveSingleFileKlib(SingleFileResolve.kt:24)
at org.jetbrains.kotlin.library.SingleFileResolveKt.resolveSingleFileKlib$default(SingleFileResolve.kt:15)
at org.jetbrains.kotlin.cli.metadata.KlibMetadataDependencyContainer.(K2MetadataKlibSerializer.kt:124)
at org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer.serialize(K2MetadataKlibSerializer.kt:53)
at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:115)
at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:40)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1618)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

java.lang.IllegalStateException: e: Could not find "/Users///*/build/kotlinSourceSetMetadata/commonMain/com.ionspin.kotlin-multiplatform-crypto-libsodium-bindings/com.ionspin.kotlin-multiplatform-crypto-libsodium-bindings-commonMain.klib" in [/Users//Library/Application Support/kotlin/daemon]
at org.jetbrains.kotlin.library.SingleFileResolveKt$resolveSingleFileKlib$1.fatal(SingleFileResolve.kt:21)
at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:175)
at org.jetbrains.kotlin.library.KotlinLibrarySearchPathResolver.resolve(SearchPathResolver.kt:181)
at org.jetbrains.kotlin.library.CompilerSingleFileKlibResolveStrategy.resolve(SearchPathResolver.kt:302)
at org.jetbrains.kotlin.library.SingleFileResolveKt.resolveSingleFileKlib(SingleFileResolve.kt:24)
at org.jetbrains.kotlin.library.SingleFileResolveKt.resolveSingleFileKlib$default(SingleFileResolve.kt:15)
at org.jetbrains.kotlin.cli.metadata.KlibMetadataDependencyContainer.(K2MetadataKlibSerializer.kt:124)
at org.jetbrains.kotlin.cli.metadata.K2MetadataKlibSerializer.serialize(K2MetadataKlibSerializer.kt:53)
at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:115)
at org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler.doExecute(K2MetadataCompiler.kt:40)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1618)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

Execution failed for task ':compileCommonMainKotlinMetadata'.

Internal compiler error. See log for more details

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

@hansimmmi
Copy link
Author

Just in case, I ran build the module in Windows machine, has similar issue with snapshot build.

Could not find "C:\Users\*\.gradle\caches\modules-2\files-2.1\com.ionspin.kotlin\multiplatform-crypto-libsodium-bindings-mingwx64\0.8.8-SNAPSHOT\b9379b704812f6ae81738b6abc20ef3ec1c06371\multiplatform-crypto-libsodium-bindings-mingwx64-0.8.8-SNAPSHOT.klib" in [D:\*\work\*, C:\Users\*\.konan\klib, C:\Users\*\.konan\kotlin-native-prebuilt-windows-x86_64-1.6.0\klib\common, C:\Users\*\.konan\kotlin-native-prebuilt-windows-x86_64-1.6.0\klib\platform\mingw_x64]

@ionspin
Copy link
Owner

ionspin commented Oct 6, 2022

Hi @hansimmmi , I tried the latests snapshot by using a standalone project on mac, windows and a fresh linux virtual machine and I cannot reproduce the problem you are seeing and I suspect it might be a problem with your gradle caches. Could you try to run your gradle build with --refresh-dependencies and if that doesn't work clear the gradle cache?

@hansimmmi
Copy link
Author

@ionspin After remove all the caches it build ok now. Thank you for prompt action!
I think you can update 0.8.8 now!

@ionspin ionspin closed this as completed in d8fb4b4 Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants