I use windows 10.
When I download and configure Kotlin Native on CLion.
I created a default Hello World project and want to try complied and run.
But there is a CMake error
CMake Error at KotlinCMakeModule/CMakeKotlinInformation.cmake:128 (message):
Unsupported host target
Call Stack (most recent call first):
KotlinCMakeModule/CMakeKotlinInformation.cmake:170 (prepare_konanc_args)
CMakeLists.txt:7 (konanc_executable)
-- Configuring incomplete, errors occurred!
See also "D:/KotlinNative/CSVParser/cmake-build-debug/CMakeFiles/CMakeOutput.log".
[Failed to reload]
Then i saw the file named CMakeKotlinInformation.cmake
if (NOT KONANC_TARGET)
if (APPLE)
set(KONANC_TARGET macbook)
elseif (UNIX)
set(KONANC_TARGET linux)
else ()
message(FATAL_ERROR "Unsupported host target")
endif ()
endif ()
@msink Thank you very much. ^_^
To make it work, i did:
set(KONANC_TARGET mingw)
inside the else() section.
It compiled, then i added an extension, but can't remember where.
I tried something like that - it's lost after any reconfiguration, so hardly usable.
@hpcorona
I tried to change it
set(KONANC_TARGET mingw)
but there still a CMake Error
KONANC_TARGETmingw
CMake Error at KotlinCMakeModule/CMakeKotlinInformation.cmake:174 (if):
if given arguments:
"STREQUAL" "wasm32"
Unknown arguments specified
in the CMakeKotlinInformation.cmake
if(${KONANC_TARGET} STREQUAL "wasm32")
set(EXECUTABLE_EXTENSION "wasm")
elseif (${KONANC_TARGET} STREQUAL "android_arm32")
set(EXECUTABLE_EXTENSION "so")
elseif (${KONANC_TARGET} STREQUAL "android_arm64")
set(EXECUTABLE_EXTENSION "so")
else()
set(EXECUTABLE_EXTENSION "kexe")
endif()
Using latest Clion and Kotlin/Native plugin installed, you need to make the following changes:
elseif (WIN32)
set(KONANC_TARGET mingw)
.exe
rm unix command line utility. I found it within already installed cmder. Be aware, you have to put it separately from other utilites, because of warning of the Clion cmake told it can't properly work with sh on path.After the foregoing changes, I had got Clion successfully building "hello world" project.
@wapxmas How I can change path? I changed RM path in cmake-build-debug/CMakeFiles/HelloWorld.compile.dir/build.make to Cmdr.exe but still this same issue with RM remains.
@Draciel Copy from cmder\vendor\msysgit\bin the following files: rm.exe, msys-1.0.dll to any other directory. After that put the foregoing directory on the path.
@wapxmas No need to change make files, just remove ${EXECUTABLE_EXTENSION} part from lines 220-223, so it looks like
add_executable(${KONANC_NAME} ${KONANC_SOURCES})
add_dependencies(${KONANC_NAME} ${KONANC_NAME}.compile)
set_target_properties(${KONANC_NAME} PROPERTIES LINKER_LANGUAGE Kotlin)
add_custom_command(TARGET ${KONANC_NAME}
and the full diff of changes mentioned in this thread is
142a143,144
> elseif(WINDOWS)
> set(KONANC_TARGET mingw)
148a151
>
195a199,200
> elseif (${KONANC_TARGET} STREQUAL "mingw")
> set(EXECUTABLE_EXTENSION "exe")
198a204
>
220,223c226,229
< add_executable(${KONANC_NAME}.${EXECUTABLE_EXTENSION} ${KONANC_SOURCES})
< add_dependencies(${KONANC_NAME}.${EXECUTABLE_EXTENSION} ${KONANC_NAME}.compile)
< set_target_properties(${KONANC_NAME}.${EXECUTABLE_EXTENSION} PROPERTIES LINKER_LANGUAGE Kotlin)
< add_custom_command(TARGET ${KONANC_NAME}.${EXECUTABLE_EXTENSION}
---
> add_executable(${KONANC_NAME} ${KONANC_SOURCES})
> add_dependencies(${KONANC_NAME} ${KONANC_NAME}.compile)
> set_target_properties(${KONANC_NAME} PROPERTIES LINKER_LANGUAGE Kotlin)
> add_custom_command(TARGET ${KONANC_NAME}
@neonailol Thank you, didn't dig as deep as you did.
@neonailol CMake does not know of any WINDOWS. You should use WIN32
https://cmake.org/cmake/help/latest/variable/WIN32.html
Still it will look something like:
"C:\Program Files\JetBrains\CLion 2017.2.2\bin\cmake\bin\cmake.exe" --build E:\w\w2\kn\hw\cmake-build-debug --target HelloWorld -- -j 4
Scanning dependencies of target HelloWorld.compile
[ 33%] Generating CMakeFiles/HelloWorld_TEMP.exe
Error occurred during initialization of VM
Could not reserve enough space for 3145728KB object heap
Hi, I'm trying to setup the plugin with the last release of CLion and I can't manage to setup a win32 equivalent of rm unix command line utility (like @wapxmas suggest).
I downloaded cmder, copied rm.exe with the necessary .dll files in a different directory and then changed RM path in cmake-build-debug/CMakeFiles/HelloWorld.compile.dir/build.make to that directory, but I still can't build the HelloWorld project. What I'm supposed to do? I don't understand what I'm doing wrong.
I've also tried to link the directory in the PATH of system environment variables of Windows, but still have the problem.
If anyone needs a working reference, I have created a repo for that: https://github.com/Mordag/helloworld
If you get this error, just ignore it and rebuild:
'rm' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'rm' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
@ttldtor the memory error
Could not reserve enough space for 3145728KB object heap
can be fixed by installing the 64-bit version of the JRE from here:
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Most helpful comment
@wapxmas No need to change make files, just remove ${EXECUTABLE_EXTENSION} part from lines 220-223, so it looks like
and the full diff of changes mentioned in this thread is