Solvedkotlin native Output files without the .kexe extension
✔️Accepted Answer
however it seems to be nice feature to have.
Why? It's not even a real extension, and even if it was it would be irrelevant on every platform apart from Windows.
If you dislike it, renaming kexe to anything you like is pretty easy with mv/cp command, or with the build system rule.
mv
and cp
are not portable, and requiring everyone to use a build tool to work around this forever is boring. Why not just do what every other compiler does and what the documentation says this option does?
-output (-o) <name> Output name
Other Answers:
Totally agree, IMHO an extension of kexe
causes more confusion than anything, I even had odd flashbacks of repackaged wine
apps. For windows, I would expect exe
, for any other *nix system I would expect the execution bit to be set (and NOT have a file extension)
If anyone really needs this feature, please add it under another option which doesn't break the standard behavior of -o
/--output
e.g.:
-o/-output hello # hello
-O/-output-exe hello # hello.exe (on Windows)
On macos.
kotlinc-native -produce program -o csvparser src/main/kotlin/CsvParser.kt
Unexpectedly produces csvparser.kexe
Note that the issue isn't about file extensions in general. Files intended to be edited and opened by certain applications are typically grouped/classified by means of file extensions. The problem is executables with extensions which is generally unneeded, uncommon, and unexpected on unix. Now and then you'll see people add extensions like .sh
but extensions mostly just get in the way for people who prefer the command line. Also, the executable bit is proper indicator for executables so using extensions is redundant.
ref: #665
I think it's telling that the Kotlin documentation has to go out of its way to say that the kexe
files are in fact native executables:
"The file is the actual binary produced for our target platform"
"It's important to understand that this is now a native application, and no runtime or virtual machine is required"
The first time I used the Kotlin native compiler and got a kexe
file as output I thought that I'd done something wrong. And it seems like whoever wrote the documentation realized that it would be confusing.
kotlinc-native: 1.1.60-dev-299 (JRE 1.8.0_144-b01)
OS: Linux (Arch)
There doesn't appear to be a way to output a file without the
.kexe
extension, and the discussion here doesn't shed any light on this "feature". Why was it added, and how can it be disabled?Linux doesn't identify executables with extensions, and every other compiler with an
-o
/--output
option creates a file with the specified filename.