Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Output files without the .kexe extension #967

Closed
chocolateboy opened this issue Oct 22, 2017 · 11 comments
Closed

Output files without the .kexe extension #967

chocolateboy opened this issue Oct 22, 2017 · 11 comments

Comments

@chocolateboy
Copy link

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.

@olonho
Copy link
Contributor

olonho commented Oct 22, 2017

Generally file extension seems to be a good way to identify type of particular file without closer examination. This was motivation for this particular feature. This functionality is pretty is easy to control/disable from inside compiler, as extension is target-specific, however it seems to be nice feature to have. If you dislike it, renaming kexe to anything you like is pretty easy with mv/cp command, or with the build system rule.

@chocolateboy
Copy link
Author

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

@chocolateboy
Copy link
Author

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)

@olonho
Copy link
Contributor

olonho commented Oct 23, 2017

Don't think extension is bound to Windows in any way. .jpg or .txt or .kt file extensions are relevant on any platform, and even on Linux there are some executable file extensions, such as .so or .ko.

@chocolateboy
Copy link
Author

even on Linux there are some executable file extensions, such as .so or .ko

As mentioned, a separate option to add a platform-specific extension might be useful, but that's not what the -o option is doing. Instead it adds extensions which have no meaning on any platform:

$ kotlinc-native -o hello.so -produce library hello.kt

hello.so.klib

This is the worst of both worlds as it not only forces everyone to take an extra step to restore the requested name, but doing so requires knowledge of the platform the compiler is running on since the extension varies for each.

@r4zzz4k
Copy link

r4zzz4k commented Oct 23, 2017 via email

@msink
Copy link
Contributor

msink commented Oct 23, 2017

Just make default "-produce program" extension empty on Linux.
On windows everything is ok already.

@nicerobot
Copy link

nicerobot commented Sep 17, 2018

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

@bdemers
Copy link

bdemers commented Dec 21, 2018

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)

@averynortonsmith
Copy link

averynortonsmith commented Apr 23, 2019

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.

@SvyatoslavScherbina
Copy link
Collaborator

According migration to YouTrack, closing this issue in favour of https://youtrack.jetbrains.com/issue/KT-25384. Please continue any discussions there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants