https://kotlinlang.org logo
#kotlin-native
Title
# kotlin-native
p

Piasy

02/04/2023, 3:59 AM
Hi guys, I’m trying to wrap some existing C++ code into a kotlin multiplatform library on windows x64, but I run into a link error:
error: LIBCMT.lib(std_type_info_static.obj): machine type x86 conflicts with x64
. I didn’t specify the LIBCMT.lib dependency anywhere in my build scripts, so it seems like a bug in the konan toolchain, which uses the wrong x86 version of LIBCMT.lib instead of x64 version, could anybody help me take a look into it? thanks! The attachment is my minimum reproduce project, run the
runDebugExecutableNative
gradle task could reproduce it. The C++ code static library is built by the
build_xlog_windows.bat
batch script. BTW, I’m using the latest 1.8.0 kotlin version, but I also tried 1.7.21, which also didn’t work.
Copy code
C:\Users\Admin\source\kmp-windows-x64-repro>.\gradlew runDebugExecutableNative

> Task :linkDebugExecutableNative FAILED
e: C:\Users\Admin\.konan\dependencies\llvm-11.1.0-windows-x64-essentials/bin/clang++ invocation reported errors

The C:\Users\Admin\.konan\dependencies\llvm-11.1.0-windows-x64-essentials/bin/clang++ command returned non-zero exit code: 1.
output:
lld-link: error: LIBCMT.lib(std_type_info_static.obj): machine type x86 conflicts with x64
lld-link: error: LIBCMT.lib(delete_scalar_size.obj): machine type x86 conflicts with x64
lld-link: error: LIBCMT.lib(delete_scalar.obj): machine type x86 conflicts with x64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

FAILURE: Build failed with an exception.
5 Views