sdk icon indicating copy to clipboard operation
sdk copied to clipboard

dotnet-compile-native should support Debug Build Configuation

Open krwq opened this issue 11 years ago • 22 comments

This is causing E2E tests to fail.

CI output: http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_cli_debug_windows_nt_prtest/478/console CI log copy: https://gist.github.com/krwq/4d06b494905a7e7e856c

krwq avatar Nov 26 '15 10:11 krwq

@gkhanna79 this seems like a codegen issue...

TheRealPiotrP avatar Nov 28 '15 17:11 TheRealPiotrP

@schellap Can you please look into this?

gkhanna79 avatar Dec 02 '15 19:12 gkhanna79

@brthor, we do not have debug runtime libs, like we discussed in your PR . I thought you were going to hold off until we figure the packaging out:

https://github.com/dotnet/cli/pull/322#issuecomment-160720311

Is this still occuring after switching to pure retail?

schellap avatar Dec 02 '15 19:12 schellap

I am working on this since Mon. Is it blocking anyone?

schellap avatar Dec 02 '15 19:12 schellap

@schellap Debug is our default configuration so for the moment a raw dotnet compile --native won't work on windows. I skipped the test with a reference to this issue for the time being.

brthor avatar Dec 02 '15 19:12 brthor

@brthor Instead of skipping the test, can we update dotnet-compile-native to override the configuration to always be release so that the native compilation would continue to be tested. @schellap can use this issue to enable debug builds.

gkhanna79 avatar Dec 02 '15 19:12 gkhanna79

@gkhanna79 Debug configuration does not appear to be broken on other platforms besides Windows though (not sure if it only appears this way). Do you want to disable debug configuration across the board anyway?

brthor avatar Dec 02 '15 20:12 brthor

@schellap can help take a look at this. I suspect its got to do with differences between how linkages are exported for CRT on Windows.

gkhanna79 avatar Dec 02 '15 21:12 gkhanna79

@blackdwarf This is breaking dotnet compile --native default experience on Windows, should we move this for Jan?

Edit: It is not breaking but only showing this warning: LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

brthor avatar Dec 16 '15 23:12 brthor

@brthor, right now we have the capability to produce debug/release bits right? I meant with your publish changes for native?

schellap avatar Dec 16 '15 23:12 schellap

Supporting Debug and Release configurations for the app should still link against release versions of the CRT/CoreRT/Supporting libraries. There should not be a need to link against the debug versions of those - @schellap please let me know if I am missing something.

That said, @brthor, Debug or Release configuration of an app will differ in terms of what preprocessor defines are passed during the compilation of the app, what compile-time options would be passed, how to tell the compiler (JIT or AOT) to use optimizations or not, etc. This will require defining where this is going to be defined and how this information is going to flow to the compilers.

CC @richlander @blackdwarf @piotrpMSFT

gkhanna79 avatar Dec 17 '15 00:12 gkhanna79

@gkhanna79 Looks like defines and optimizations are already set up here based on passed in configuration (default Debug) https://github.com/dotnet/cli/blob/master/src/Microsoft.DotNet.ProjectModel/ProjectReader.cs#L357

@schellap RyuJit can produce both, yes. Cpp mode is breaking on debug mode with this error: C:\Users\brthor\code\testnative\bin\Debug\dnxcore50\native\testnative.exe : fatal error LNK1319: 82 mismatches detected

We need to shake out if we are linking against the right things for debug mode in cpp. @schellap Do your layout changes and my associated publish subdirectory changes give us what we need to solve this problem?

brthor avatar Dec 17 '15 01:12 brthor

Supporting Debug and Release configurations for the app should still link against release versions of the CRT/CoreRT/Supporting libraries. There should not be a need to link against the debug versions of those - @schellap please let me know if I am missing something.

@gkhanna79, No, our runtime libraries will contain references to the corresponding CRT flavor from our build processes. @brthor, debug version of the app native exe should be produced linking with runtime libraries from Microsoft.DotNet.ILCompiler.SDK.Debug (contains msvcrtd.lib references) and msvcrtd.lib

schellap avatar Dec 17 '15 01:12 schellap

@schellap Why should debug version of the app link against debug version of the runtime?

gkhanna79 avatar Dec 17 '15 01:12 gkhanna79

@schellap This is what I understood from our previous conversations :smile:

brthor avatar Dec 17 '15 01:12 brthor

@gkhanna79, I see the disconnect. There is a distinction that needs to be made for --ilcpath and when not specified.

For the app compilation scenario, we could always use MSVCRT.LIB and Runtime libs from ILCompiler.SDK. This is a policy decision whether we want to use ILCompiler.SDK.Debug for app compilation.

If --ilcpath is specified, we need to use MSVCRTD for Debug outputs and MSVCRT for Release outputs.

schellap avatar Dec 17 '15 01:12 schellap

Lets chat tomorrow - for app compile, I believe we should always use the release version of the libraries since building an app in Release/Debug shouldnt be connected to debug/release version of toolchain/libraries.

If --ilcpath is specified, we need to use MSVCRTD for Debug outputs and MSVCRT for Release outputs.

I dont follow - can you please elaborate?

gkhanna79 avatar Dec 17 '15 01:12 gkhanna79

If --ilcpath is specified, then our runtime libs from build is either Debug or Release containing corresponding CRT references. So we have to link the appropriate CRT. @brthor, I think your work will be quite minimal here.

schellap avatar Dec 17 '15 01:12 schellap

@gkhanna79, what does it mean for the app to be compiled in debug mode for CPP CodeGen? I mean to suggest that the OBJ produced from the CPP file would be a Debug OBJ.

schellap avatar Dec 17 '15 01:12 schellap

By default, it should be the same experience as JIT - the app specific debug configuration defines get passed to the C++ compiler but the executable is linked against release version of the binaries.

To link against debug libraries should be an explicit opt-in by the developer and not coupled with the configuration knobs used to indicate app's debug configuration (since any asserts coming out of our libraries are not actionable by the developer, as an example) - instead, we should have something like "--ilcconfig debug" to indicate that app needs to link against debug libraries.

gkhanna79 avatar Dec 17 '15 02:12 gkhanna79