runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Default out filename of crossgen is confusing

Open hqueue opened this issue 9 years ago • 6 comments

I made a helloworld.dll example as follows. Default extension of helloword application is dll.

$ uname -a
Linux 48b709a6472b 3.13.0-107-generic dotnet/runtime#3928-Ubuntu SMP Tue Dec 20 09:57:27 UTC 2016 x86_64 GNU/Linux
$ dotnet --info
.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1
 Commit SHA-1 hash:  005db40cd1

Runtime Environment:
 OS Name:     debian
 OS Version:  8
 OS Platform: Linux
 RID:         debian.8-x64
 Base Path:   /usr/share/dotnet/sdk/1.0.1
$ dotnet new console
Content generation time: 52.2026 ms
The template "Console Application" created successfully.
$ dotnet restore
...
$ dotnet build
...
$ ls bin/Debug/netcoreapp1.1/
helloworld.deps.json  helloworld.pdb                     helloworld.runtimeconfig.json
helloworld.dll        helloworld.runtimeconfig.dev.json

Make native image from helloworld.dll using crossgen.

$ ./crossgen /ReadyToRun /Platform_Assemblies_Paths `pwd` helloworld.dll 
Microsoft (R) CoreCLR Native Image Generator - Version 4.5.22220.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Native image /home/hqueue/tmp/coreoverlay/helloworld.ni.exe generated successfully.

Expected Result

Expected out filename is helloworld.ni.dll, since input filename is helloworld.dll.

Actual Result

Actual out filename is helloworld.ni.exe

It was quite confusing that input filename and output filename have different extension.

Is this intended behavior of crossgen ? Or should helloworld have exe as extension at the first place when generated from dotnet cli?

hqueue avatar Mar 29 '17 03:03 hqueue

It seems that extension is determined at https://github.com/dotnet/coreclr/blob/master/src/zap/zapper.cpp#L1587

And for non-dll file, it appends ni.exe to module name.

hqueue avatar Mar 29 '17 05:03 hqueue

Is anybody working on this? If not, I'm willing to take this one.

But what's the expected behavior actually? Should we generate .exe instead of .dll at the beginning, or append the extension according to the file name instead of checking IsDll() ?

mazong1123 avatar Mar 31 '17 12:03 mazong1123

Is there any update on this?

cc @alpencolt @jkotas

gbalykov avatar Mar 01 '19 12:03 gbalykov

@fadimounir Any changes planned here?

crossgen is typically run from a build script that passes explicit name for the output.

The default is there for convenience if you run the tool manually. I think the most convenient default for that would be to replace the input file.

jkotas avatar Mar 01 '19 16:03 jkotas

There are no changes planned here so far. We typically use the /out to specify output file names as @jkotas explained. I think we should probably change the output extension to be the same as the input file. That would be a reasonable change. Anyways, the typical way we use crossgen is to specify the /out parameter, and replace the input file with the output file created by crossgen.

fadimounir avatar Mar 06 '19 18:03 fadimounir

The crossgen tool has been replaced with crossgen2. This query represents a retired workflow. @hqueue If this remains with crossgen2, please let us know.

AaronRobinsonMSFT avatar Aug 24 '22 22:08 AaronRobinsonMSFT