From 0eaf5b66612d8f7ad2b10e9aa4ce0edc2f8aeb24 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Tue, 31 Oct 2023 12:45:16 -0700 Subject: [PATCH 1/3] Build Mac symbols in .dSYM bundle, not single .dwarf file --- eng/liveBuilds.targets | 8 ++++++-- eng/native/functions.cmake | 6 ++++-- eng/native/naming.props | 3 ++- src/coreclr/.nuget/Directory.Build.targets | 3 ++- src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj | 4 ++-- .../pkg/runtime.native.System.IO.Ports.props | 8 +++++++- src/native/corehost/corehost.proj | 7 ++++++- 7 files changed, 29 insertions(+), 10 deletions(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 70a3cac8cbcdd..747b117d039b3 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -103,7 +103,9 @@ Include=" $(CoreCLRSharedFrameworkPdbDir)*.pdb; $(CoreCLRSharedFrameworkPdbDir)*.dbg; - $(CoreCLRSharedFrameworkPdbDir)*.dwarf" IsNative="true" /> + $(CoreCLRSharedFrameworkPdbDir)*.dwarf; + $(CoreCLRSharedFrameworkPdbDir)*.dSYM" + IsNative="true" /> + $(CoreCLRSharedFrameworkPdbDir)*.dwarf; + $(CoreCLRSharedFrameworkPdbDir)*.dSYM" /> runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native @@ -188,6 +191,7 @@ $(LibrariesNativeArtifactsPath)*.so; $(LibrariesNativeArtifactsPath)*.dbg; $(LibrariesNativeArtifactsPath)*.dwarf; + $(LibrariesNativeArtifactsPath)*.dSYM; $(LibrariesNativeArtifactsPath)*.pdb" IsNative="true" Exclude="@(ExcludeNativeLibrariesRuntimeFiles)" /> diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 543722a9c0a59..a0ac400cf2c83 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -369,7 +369,8 @@ endfunction() function (get_symbol_file_name targetName outputSymbolFilename) if (CLR_CMAKE_HOST_UNIX) if (CLR_CMAKE_TARGET_APPLE) - set(strip_destination_file $.dwarf) + # set(strip_destination_file $.dwarf) + set(strip_destination_file $.dSYM) else () set(strip_destination_file $.dbg) endif () @@ -416,7 +417,8 @@ function(strip_symbols targetName outputFilename) OUTPUT_VARIABLE DSYMUTIL_HELP_OUTPUT ) - set(DSYMUTIL_OPTS "--flat") + # set(DSYMUTIL_OPTS "--flat") + set(DSYMUTIL_OPTS "") if ("${DSYMUTIL_HELP_OUTPUT}" MATCHES "--minimize") list(APPEND DSYMUTIL_OPTS "--minimize") endif () diff --git a/eng/native/naming.props b/eng/native/naming.props index b50c0c131cda5..0aef054a27a25 100644 --- a/eng/native/naming.props +++ b/eng/native/naming.props @@ -18,7 +18,8 @@ lib .dylib .a - .dwarf + + .dSYM diff --git a/src/coreclr/.nuget/Directory.Build.targets b/src/coreclr/.nuget/Directory.Build.targets index 379fbd65030b3..f81ddf85efc50 100644 --- a/src/coreclr/.nuget/Directory.Build.targets +++ b/src/coreclr/.nuget/Directory.Build.targets @@ -47,7 +47,8 @@ - + + diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj index 522561c9c8a36..20b57ff1048ba 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj @@ -52,8 +52,8 @@ $(MicrosoftNetCoreAppRuntimePackNativeDir) false - .dwarf - --flat + + diff --git a/src/libraries/System.IO.Ports/pkg/runtime.native.System.IO.Ports.props b/src/libraries/System.IO.Ports/pkg/runtime.native.System.IO.Ports.props index 4e11f1b2414ee..f6373ca450f86 100644 --- a/src/libraries/System.IO.Ports/pkg/runtime.native.System.IO.Ports.props +++ b/src/libraries/System.IO.Ports/pkg/runtime.native.System.IO.Ports.props @@ -22,8 +22,14 @@ + + + + + + - diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj index 026cff6928567..7b87dffd59e8e 100644 --- a/src/native/corehost/corehost.proj +++ b/src/native/corehost/corehost.proj @@ -56,7 +56,12 @@ Command=""$(DotNetTool)" exec @(InjectResourceTool) --bin "$(DacPath)" --image "$(SingleFileHostDestinationPath)" --name MINIDUMP_EMBEDDED_AUXILIARY_PROVIDER" /> - + + + + + + Date: Thu, 15 Feb 2024 16:29:00 -0800 Subject: [PATCH 2/3] Minor comment updates --- eng/liveBuilds.targets | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 747b117d039b3..c9a7ed1125ffd 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -1,6 +1,6 @@ - + $([MSBuild]::NormalizeDirectory('$(CoreCLROverridePath)')) $([MSBuild]::NormalizeDirectory('$(MonoOverridePath)')) $([MSBuild]::NormalizeDirectory('$(LibrariesOverridePath)')) @@ -9,6 +9,8 @@ $([MSBuild]::NormalizeDirectory('$(RuntimeArtifactsPath)')) $([MSBuild]::NormalizeDirectory('$(RuntimeArtifactsPath)')) + + $(TargetOS)-$(LibrariesConfiguration)-$(TargetArchitecture) @@ -76,6 +78,7 @@ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework')) + $([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)')) @@ -123,6 +126,7 @@ true + From 36086893db3efc43559033d0078e0a5117b62216 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Sun, 25 Feb 2024 15:55:06 -0800 Subject: [PATCH 3/3] More tries to support .dSYM Treat .dSYM bundle as set of files. There are places where this doesn't work very well, such as in src/installer/pkg/projects/Directory.Build.targets, where the `GetSymbolPackageFiles` target is trying to construct a set of debug files to package, while also giving them a TargetPath property. I haven't been able to figure out how to get MSBuild to do my bidding in creating the right paths. --- eng/liveBuilds.targets | 26 ++++++-------- eng/native/functions.cmake | 2 -- eng/native/naming.props | 10 ++++-- .../aot/crossgen2/crossgen2_publish.csproj | 3 -- .../pkg/archives/dotnet-nethost.proj | 10 +++++- .../pkg/projects/Directory.Build.targets | 7 ++-- .../Microsoft.NETCore.App.Crossgen2.sfxproj | 1 + .../Microsoft.NETCore.App.Host.sfxproj | 34 +++++++++---------- .../Microsoft.NETCore.App.Runtime.props | 20 ++++++++++- .../pkg/sfx/installers/dotnet-host.proj | 1 + .../pkg/sfx/installers/dotnet-hostfxr.proj | 1 + 11 files changed, 68 insertions(+), 47 deletions(-) diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index c9a7ed1125ffd..76327b6312357 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -24,7 +24,9 @@ + $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'PDB')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework')) + $([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)', 'PDB')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc-published')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', '$(BuildArchitecture)', 'ilc')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk')) @@ -67,22 +69,10 @@ Text="The Mono artifacts path does not exist '$(MonoArtifactsPath)'. The 'mono' subset must be built before building this project. Configuration: '$(MonoConfiguration)'. To use a different configuration, specify the 'RuntimeConfiguration' property." /> - $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)')) - $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','PDB')) - - $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','sharedFramework')) - $([MSBuild]::NormalizeDirectory('$(CoreCLRSharedFrameworkDir)','PDB')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework')) - - $([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)')) - - <_nativeAotRuntimeFiles Include="$(CoreCLRAotSdkDir)*" /> @@ -97,18 +87,22 @@ true + + <_systemPrivateCoreLib Include="$(CoreCLRArtifactsPath)System.Private.CoreLib.dll" Condition="Exists('$(CoreCLRArtifactsPath)System.Private.CoreLib.dll')" /> <_systemPrivateCoreLib Include="$(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll" Condition="Exists('$(CoreCLRArtifactsPath)IL/System.Private.CoreLib.dll') and '@(_systemPrivateCoreLib)' == ''" /> + + + $(CoreCLRSharedFrameworkPdbDir)*.dSYM/**" + IsNative="true" /> + $(CoreCLRSharedFrameworkPdbDir)*.dSYM/**" /> runtime/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture)/native @@ -195,7 +189,7 @@ $(LibrariesNativeArtifactsPath)*.so; $(LibrariesNativeArtifactsPath)*.dbg; $(LibrariesNativeArtifactsPath)*.dwarf; - $(LibrariesNativeArtifactsPath)*.dSYM; + $(LibrariesNativeArtifactsPath)*.dSYM/**; $(LibrariesNativeArtifactsPath)*.pdb" IsNative="true" Exclude="@(ExcludeNativeLibrariesRuntimeFiles)" /> diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index a0ac400cf2c83..f6e79e6437291 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -369,7 +369,6 @@ endfunction() function (get_symbol_file_name targetName outputSymbolFilename) if (CLR_CMAKE_HOST_UNIX) if (CLR_CMAKE_TARGET_APPLE) - # set(strip_destination_file $.dwarf) set(strip_destination_file $.dSYM) else () set(strip_destination_file $.dbg) @@ -417,7 +416,6 @@ function(strip_symbols targetName outputFilename) OUTPUT_VARIABLE DSYMUTIL_HELP_OUTPUT ) - # set(DSYMUTIL_OPTS "--flat") set(DSYMUTIL_OPTS "") if ("${DSYMUTIL_HELP_OUTPUT}" MATCHES "--minimize") list(APPEND DSYMUTIL_OPTS "--minimize") diff --git a/eng/native/naming.props b/eng/native/naming.props index 0aef054a27a25..9f3f39056c326 100644 --- a/eng/native/naming.props +++ b/eng/native/naming.props @@ -11,6 +11,8 @@ .dll .lib .pdb + .pdb + false @@ -18,8 +20,9 @@ lib .dylib .a - .dSYM + .dSYM/** + true @@ -28,12 +31,15 @@ .so .a .dbg + .dbg + false - + + diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj index 20b57ff1048ba..083d56a9244d5 100644 --- a/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj +++ b/src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj @@ -51,9 +51,6 @@ $(MicrosoftNetCoreAppRuntimePackRidLibTfmDir) $(MicrosoftNetCoreAppRuntimePackNativeDir) false - - - diff --git a/src/installer/pkg/archives/dotnet-nethost.proj b/src/installer/pkg/archives/dotnet-nethost.proj index e6bc4e90c2dbc..db99ebc948cb2 100644 --- a/src/installer/pkg/archives/dotnet-nethost.proj +++ b/src/installer/pkg/archives/dotnet-nethost.proj @@ -34,7 +34,15 @@ Condition="'$(TargetsWindows)' == 'true'" DestinationFolder="$(SymbolsOutputPath)" /> + + + + + + diff --git a/src/installer/pkg/projects/Directory.Build.targets b/src/installer/pkg/projects/Directory.Build.targets index 74420fa76bb1f..0906f60056366 100644 --- a/src/installer/pkg/projects/Directory.Build.targets +++ b/src/installer/pkg/projects/Directory.Build.targets @@ -9,8 +9,8 @@ $(PackageOutputPath) @@ -95,8 +95,7 @@ --> - - + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj index f3fcd14b2a3d1..1e6c5d4de3976 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj @@ -73,6 +73,7 @@ <_Crossgen2SymbolFilesToPackage Include="@(_CrossgenPublishFiles)" Condition="'%(Extension)' == '.pdb'" /> <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPdbDir)%(FileName).pdb')" Condition="'$(TargetOS)' == 'windows' and '%(FileName)' != 'crossgen2'" /> + <_Crossgen2SymbolFilesToPackage Include="@(NativeRuntimeAsset->'$(CoreCLRArtifactsPath)%(FileName)%(Extension)$(SymbolsSuffix)')" Condition="'$(TargetOS)' != 'windows' and '%(FileName)' != 'crossgen2'" /> <_Crossgen2SymbolFilesToPackage Remove="@(_Crossgen2SymbolFilesToPackage)" Condition="!Exists('%(Identity)')" /> diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Host.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Host.sfxproj index fc7b8b90fe907..80cfc814413ce 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Host.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Host.sfxproj @@ -47,25 +47,23 @@ - - <_SymbolFiles Condition="'$(TargetOS)' == 'windows'" - Include="@(NativeRuntimeAsset->'%(RootDir)%(Directory)PDB/%(Filename).pdb')" - IsSymbolFile="true" - IsNative="true" /> - <_SymbolFiles Condition="'$(TargetOS)' != 'windows'" - Include="@(NativeRuntimeAsset->'%(RootDir)%(Directory)%(Filename)%(Extension)$(SymbolsSuffix)')" - IsSymbolFile="true" - IsNative="true" /> - + + <_SymbolFilesBase Condition="'$(TargetOS)' == 'windows'" + Include="@(NativeRuntimeAsset->'%(RootDir)%(Directory)PDB/%(Filename).pdb')" /> + <_SymbolFilesBase Condition="'$(TargetOS)' != 'windows'" + Include="@(NativeRuntimeAsset->'%(RootDir)%(Directory)%(Filename)%(Extension)$(SymbolsSuffixPath)')" /> + - <_SymbolFiles Condition="'$(TargetOS)' == 'windows'" - Include="$(DotNetHostBinDir)PDB/dotnet.pdb" - IsSymbolFile="true" - IsNative="true" /> - <_SymbolFiles Condition="'$(TargetOS)' != 'windows'" - Include="$(DotNetHostBinDir)dotnet$(ExeSuffix)$(SymbolsSuffix)" - IsSymbolFile="true" - IsNative="true" /> + <_SymbolFilesBase Condition="'$(TargetOS)' == 'windows'" + Include="$(DotNetHostBinDir)PDB/dotnet.pdb" /> + <_SymbolFilesBase Condition="'$(TargetOS)' != 'windows'" + Include="$(DotNetHostBinDir)dotnet$(ExeSuffix)$(SymbolsSuffixPath)" /> + + + + <_SymbolFiles Include="@(_SymbolFilesBase)" + IsSymbolFile="true" + IsNative="true" /> <_SymbolFiles Remove="@(_SymbolsToIncludeAlways)" /> diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props index 007249b9888f4..232393d7fdd3d 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.props @@ -72,6 +72,7 @@ <_HostFiles Include="$(DotNetHostBinDir)/$(LibPrefix)hostfxr$(LibSuffix)" PackOnly="true" /> + <_HostSymbolFiles Include="@(_HostFiles->'%(RootDir)%(Directory)PDB/%(Filename)$(SymbolsSuffix)')" Condition="'$(TargetOS)' == 'windows'" /> <_HostSymbolFiles Include="@(_HostFiles->'%(RootDir)%(Directory)%(Filename)%(Extension)$(SymbolsSuffix)')" Condition="'$(TargetOS)' != 'windows'" /> <_SymbolFilesToPackage Include="@(_HostSymbolFiles->Exists())" IsNative="true" /> @@ -80,9 +81,12 @@ - runtimes/$(RuntimeIdentifier)/native + runtimes/$(RuntimeIdentifier)/native/%(RecursiveDir) + + + tools @@ -121,11 +125,25 @@ tools/$(CoreCLRCrossTargetComponentDirName)_$(TargetArchitecture) + tools + + + + + + + + + + + + + diff --git a/src/installer/pkg/sfx/installers/dotnet-host.proj b/src/installer/pkg/sfx/installers/dotnet-host.proj index b62668f2a9596..e86992f9ba7ae 100644 --- a/src/installer/pkg/sfx/installers/dotnet-host.proj +++ b/src/installer/pkg/sfx/installers/dotnet-host.proj @@ -75,6 +75,7 @@ Condition="'$(TargetOS)' == 'windows'" DestinationFolder="$(SymbolsOutputPath)" /> + diff --git a/src/installer/pkg/sfx/installers/dotnet-hostfxr.proj b/src/installer/pkg/sfx/installers/dotnet-hostfxr.proj index d2a2c64a6a6ac..b9e6f499cc64f 100644 --- a/src/installer/pkg/sfx/installers/dotnet-hostfxr.proj +++ b/src/installer/pkg/sfx/installers/dotnet-hostfxr.proj @@ -34,6 +34,7 @@ Condition="'$(TargetOS)' == 'windows'" DestinationFolder="$(SymbolsOutputPath)" /> +