Samsung / netcoredbg

NetCoreDbg is a managed code debugger with GDB/MI, VSCode DAP and CLI interfaces for CoreCLR.
MIT License
832 stars 103 forks source link

Unable to load `dbgshim.dll` after building from source #158

Closed GniLudio closed 10 months ago

GniLudio commented 10 months ago

I get the following error when executing netcoredbg.exe after building from source.

Unable to load ...\netcoredbg\build\src\Debug\dbgshim.dll

Setup (netcoredbg_setup.bat)

git clone https://github.com/Samsung/netcoredbg.git
cd netcoredbg && md build && cd build
cmake .. -G "Visual Studio 17 2022"
cmake --build .
pause 
.\src\Debug\netcoredbg.exe
pause

Misc

The build/src folder has the dbgshim.dll file.

Logs

Microsoft Windows [Version 10.0.23481.1000]
(c) Microsoft Corporation. All rights reserved.

C:\Users\user\Documents>netcoredbg_setup.bat

C:\Users\user\Documents>git clone https://github.com/Samsung/netcoredbg.git
Cloning into 'netcoredbg'...
remote: Enumerating objects: 8773, done.
remote: Counting objects: 100% (1840/1840), done.
remote: Compressing objects: 100% (436/436), done.
remote: Total 8773 (delta 1425), reused 1777 (delta 1400), pack-reused 6933
Receiving objects: 100% (8773/8773), 3.74 MiB | 4.90 MiB/s, done.
Resolving deltas: 100% (5677/5677), done.

C:\Users\user\Documents>cd netcoredbg   && md build   && cd build

C:\Users\user\Documents\netcoredbg\build>cmake .. -G "Visual Studio 17 2022"
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.23481.
-- The C compiler identification is MSVC 19.38.33134.0
-- The CXX compiler identification is MSVC 19.38.33134.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.36.1.windows.1")
Cloning into 'C:/Users/user/Documents/netcoredbg/.coreclr'...
remote: Enumerating objects: 67022, done.
remote: Counting objects: 100% (67022/67022), done.
remote: Compressing objects: 100% (41311/41311), done.
remote: Total 67022 (delta 29188), reused 35710 (delta 23725), pack-reused 0
Receiving objects: 100% (67022/67022), 86.22 MiB | 4.56 MiB/s, done.
Resolving deltas: 100% (29188/29188), done.
Updating files: 100% (60132/60132), done.
VERBOSE: dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
VERBOSE: dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
VERBOSE: dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
VERBOSE: dotnet-install: To set up a development environment or to run apps, use installers rather than this script.
Visit https://dotnet.microsoft.com/download to get the installer.
VERBOSE: dotnet-install: Get-CLIArchitecture-From-Architecture -Architecture "x64"
VERBOSE: dotnet-install: Get-NormalizedQuality -Quality ""
VERBOSE: dotnet-install: Normalized quality: ''
VERBOSE: dotnet-install: Get-NormalizedChannel -Channel "7.0"
VERBOSE: dotnet-install: Normalized channel: '7.0'
VERBOSE: dotnet-install: Get-NormalizedProduct -Runtime ""
VERBOSE: dotnet-install: Normalized product: 'dotnet-sdk'
VERBOSE: dotnet-install: â?± Action 'Product discovery' took 0.1147279 seconds
VERBOSE: dotnet-install: Resolve-Installation-Path -InstallDir "C:/Users/user/Documents/netcoredbg/.dotnet"
VERBOSE: dotnet-install: InstallRoot: C:/Users/user/Documents/netcoredbg/.dotnet
VERBOSE: dotnet-install: Get-AkaMSDownloadLink -Channel "7.0" -Quality "" -Internal "False" -Product "dotnet-sdk"
-Architecture "x64"
VERBOSE: dotnet-install: Retrieving primary payload URL from aka.ms link for channel: '7.0', quality: '' product:
'dotnet-sdk', os: 'win', architecture: 'x64'.
VERBOSE: dotnet-install: Constructed aka.ms link: 'https://aka.ms/dotnet/7.0/dotnet-sdk-win-x64.zip'.
VERBOSE: dotnet-install: Received response:
StatusCode: 301, ReasonPhrase: 'Moved Permanently', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Request-Context: appId=cid-v1:9b037ab9-fa5a-4c09-81bd-41ffa859f01e
  X-Response-Cache-Status: True
  Pragma: no-cache
  Connection: keep-alive
  Strict-Transport-Security: max-age=31536000 ; includeSubDomains
  Cache-Control: no-store, no-cache, max-age=0
  Date: Wed, 10 Jan 2024 09:32:17 GMT
  Location: https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip
  Server: Kestrel
  Content-Length: 0
  Expires: Wed, 10 Jan 2024 09:32:17 GMT
}
VERBOSE: dotnet-install: The redirect location retrieved:
'https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip'.
VERBOSE: dotnet-install: Received response:
StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Age: 41401
  X-Cache: HIT
  x-ms-blob-type: BlockBlob
  x-ms-lease-status: unlocked
  x-ms-request-id: b3d8ac57-901e-0021-8047-435558000000
  x-ms-version: 2009-09-19
  Accept-Ranges: bytes
  Date: Wed, 10 Jan 2024 09:32:17 GMT
  ETag: 0x8DC111958DE7701
  Server: ECAcc
  Server: (ama/48C6)
  Content-Length: 288920308
  Content-Type: application/octet-stream
  Last-Modified: Tue, 09 Jan 2024 13:46:14 GMT
}
VERBOSE: dotnet-install: Retrieved primary named payload URL from aka.ms link:
'https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip'.
VERBOSE: dotnet-install: Downloading using legacy url will not be attempted.
VERBOSE: dotnet-install: Version: '7.0.405'.
VERBOSE: dotnet-install: Get-Product-Version -SpecificVersion "7.0.405" -PackageDownloadLink
"https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip"
VERBOSE: dotnet-install: Get-Product-Version-Url -Flattened "True" -AzureFeed "" -SpecificVersion "7.0.405"
-PackageDownloadLink "https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip"
VERBOSE: dotnet-install: Constructed productVersion link:
https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/sdk-productVersion.txt
VERBOSE: dotnet-install: Get-Product-Version-Url -Flattened "False" -AzureFeed "" -SpecificVersion "7.0.405"
-PackageDownloadLink "https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip"
VERBOSE: dotnet-install: Constructed productVersion link:
https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/productVersion.txt
VERBOSE: dotnet-install: Checking for the existence of
https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/sdk-productVersion.txt
VERBOSE: dotnet-install: Product version: '7.0.405'.
VERBOSE: dotnet-install: Generated aka.ms link
https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip with version 7.0.405
VERBOSE: dotnet-install: Checking if the version 7.0.405 is already installed
VERBOSE: dotnet-install: Is-Dotnet-Package-Installed -InstallRoot "C:/Users/user/Documents/netcoredbg/.dotnet"
-RelativePathToPackage "sdk" -SpecificVersion "7.0.405"
VERBOSE: dotnet-install: Is-Dotnet-Package-Installed:
DotnetPackagePath=C:\Users\user\Documents\netcoredbg\.dotnet\sdk\7.0.405
VERBOSE: dotnet-install: Failed to check the disk space. Installation will continue, but it may fail if you do not have
 enough disk space.
VERBOSE: dotnet-install: â?± Action 'Installation directory preparation' took 0.0151927 seconds
VERBOSE: dotnet-install: Zip path: C:\Users\user\AppData\Local\Temp\xurvq2wm.25r
VERBOSE: dotnet-install: Downloading "aka.ms" link
https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip
VERBOSE: HEAD with 0-byte payload
VERBOSE: received 288920308-byte response of content type application/octet-stream
dotnet-install: Remote file https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip size is 288920308 bytes.
dotnet-install: Downloaded file https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.405/dotnet-sdk-7.0.405-win-x64.zip size is 288920308 bytes.
dotnet-install: The remote and local file sizes are equal.
VERBOSE: dotnet-install: â?± Action 'Package download' took 59.2230233 seconds
VERBOSE: dotnet-install: Download succeeded.
dotnet-install: Extracting the archive.
VERBOSE: dotnet-install: Extract-Dotnet-Package -ZipPath "C:\Users\user\AppData\Local\Temp\xurvq2wm.25r" -OutPath
"C:/Users/user/Documents/netcoredbg/.dotnet"
VERBOSE: dotnet-install: Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package -Zip
"System.IO.Compression.ZipArchive" -OutPath "C:/Users/user/Documents/netcoredbg/.dotnet"
VERBOSE: dotnet-install: Directories to unpack:
host/fxr/7.0.15/;packs/Microsoft.AspNetCore.App.Ref/7.0.15/;packs/Microsoft.NETCore.App.Host.win-arm/7.0.15/;packs/Micr
osoft.NETCore.App.Host.win-arm64/7.0.15/;packs/Microsoft.NETCore.App.Host.win-x64/7.0.15/;packs/Microsoft.NETCore.App.H
ost.win-x86/7.0.15/;packs/Microsoft.NETCore.App.Ref/7.0.15/;packs/Microsoft.WindowsDesktop.App.Ref/7.0.15/;packs/NETSta
ndard.Library.Ref/2.1.0/;sdk/7.0.405/;sdk-manifests/7.0.100/;shared/Microsoft.AspNetCore.App/7.0.15/;shared/Microsoft.N
ETCore.App/7.0.15/;shared/Microsoft.WindowsDesktop.App/7.0.15/;templates/7.0.15/
VERBOSE: dotnet-install: â?± Action 'Package extraction' took 29.3399804 seconds
VERBOSE: dotnet-install: Checking installation: version = 7.0.405
VERBOSE: dotnet-install: Is-Dotnet-Package-Installed -InstallRoot "C:/Users/user/Documents/netcoredbg/.dotnet"
-RelativePathToPackage "sdk" -SpecificVersion "7.0.405"
VERBOSE: dotnet-install: Is-Dotnet-Package-Installed:
DotnetPackagePath=C:\Users\user\Documents\netcoredbg\.dotnet\sdk\7.0.405
VERBOSE: dotnet-install: The temporary file "C:\Users\user\AppData\Local\Temp\xurvq2wm.25r" was removed.
dotnet-install: Adding to current process PATH: "C:\Users\user\Documents\netcoredbg\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
VERBOSE: dotnet-install: â?± Action 'Setting up shell environment' took 0.015475 seconds
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install/windows#dependencies
dotnet-install: Installed version is 7.0.405
dotnet-install: Installation finished
Building with 7.0.16 CoreCLR
CMake Deprecation Warning at third_party/linenoise-ng/CMakeLists.txt:3 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Warning (dev) at third_party/linenoise-ng/CMakeLists.txt:10 (set):
  implicitly converting 'string' to 'STRING' type.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Build mode: Release
CMake Warning (dev) at third_party/linenoise-ng/CMakeLists.txt:16 (set):
  implicitly converting 'path' to 'STRING' type.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Compiler type MSVC: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe
-- Configuring done (162.4s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/user/Documents/netcoredbg/build

C:\Users\user\Documents\netcoredbg\build>cmake --build .
MSBuild version 17.8.3+195e7f5a3 for .NET Framework

  1>Checking Build System
  Building Custom Rule C:/Users/user/Documents/netcoredbg/src/CMakeLists.txt
  Compiling ManagedPart.dll
  MSBuild version 17.7.4+3ebbd7c49 for .NET
    Determining projects to restore...
    Restored C:\Users\user\Documents\netcoredbg\src\managed\ManagedPart.csproj (in 1,19 sec).
    ManagedPart -> C:\Users\user\Documents\netcoredbg\build\src\bin\Release\netstandard2.0\win-x64\ManagedPart.dll
    ManagedPart -> C:\Users\user\Documents\netcoredbg\build\src\
  Building Custom Rule C:/Users/user/Documents/netcoredbg/src/CMakeLists.txt
  Building Custom Rule C:/Users/user/Documents/netcoredbg/src/CMakeLists.txt
  clrdata_i.cpp
  clrinternal_i.cpp
  clrprivappxhosting_i.cpp
  cordebug_i.cpp
  corprof_i.cpp
  corpub_i.cpp
  corsym_i.cpp
  sospriv_i.cpp
  xclrdata_i.cpp
  xcordebug_i.cpp
  corguids.vcxproj -> C:\Users\user\Documents\netcoredbg\build\src\Debug\corguids.lib
  Building Custom Rule C:/Users/user/Documents/netcoredbg/third_party/linenoise-ng/CMakeLists.txt
  ConvertUTF.cpp
  linenoise.cpp
  wcwidth.cpp
  linenoise.vcxproj -> C:\Users\user\Documents\netcoredbg\build\third_party\linenoise-ng\Debug\linenoise.lib
  Building Custom Rule C:/Users/user/Documents/netcoredbg/third_party/linenoise-ng/CMakeLists.txt
  example.c
  LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker per
  formance
  example.vcxproj -> C:\Users\user\Documents\netcoredbg\build\third_party\linenoise-ng\Debug\example.exe
  Creating new dotnet project
  The template "Console App" was created successfully.

  Processing post-creation actions...
  Restoring C:\Users\user\Documents\netcoredbg\build\src\generrmsg\generrmsg.csproj:
    Determining projects to restore...
    Restored C:\Users\user\Documents\netcoredbg\build\src\generrmsg\generrmsg.csproj (in 82 ms).
  Restore succeeded.

  Building Custom Rule C:/Users/user/Documents/netcoredbg/src/CMakeLists.txt
  Compiling generrmsg/bin/generrmsg.dll
  MSBuild version 17.7.4+3ebbd7c49 for .NET
    Determining projects to restore...
    Restored C:\Users\user\Documents\netcoredbg\build\src\generrmsg\generrmsg.csproj (in 111 ms).
    generrmsg -> C:\Users\user\Documents\netcoredbg\build\src\generrmsg\bin\generrmsg.dll

  Build succeeded.
      0 Warning(s)
      0 Error(s)

  Time Elapsed 00:00:06.87
  Extracting C:/Users/user/Documents/netcoredbg/.coreclr/src/coreclr/inc/corerror.xml
  breakpoint_break.cpp
  breakpoint_entry.cpp
  breakpoint_hotreload.cpp
  breakpoints_exception.cpp
  breakpoints_func.cpp
  breakpoints_line.cpp
  breakpoints.cpp
  breakpointutils.cpp
  callbacksqueue.cpp
  evalhelpers.cpp
  evalstackmachine.cpp
  evaluator.cpp
  evalwaiter.cpp
  evalutils.cpp
  frames.cpp
  hotreloadhelpers.cpp
  managedcallback.cpp
  manageddebugger.cpp
  threads.cpp
  stepper_async.cpp
  stepper_simple.cpp
  steppers.cpp
  valueprint.cpp
  variables.cpp
  waitpid.cpp
  types.cpp
  interop.cpp
  attributes.cpp
  async_info.cpp
  jmc.cpp
  modules.cpp
  modules_app_update.cpp
  modules_sources.cpp
  typeprinter.cpp
  cliprotocol.cpp
  escaped_string.cpp
  protocol_utils.cpp
  miprotocol.cpp
  tokenizer.cpp
  vscodeprotocol.cpp
  sourcestorage.cpp
  utf.cpp
  errormessage.cpp
  main.cpp
  dynlibs_unix.cpp
  dynlibs_win32.cpp
  filesystem.cpp
  filesystem_unix.cpp
  filesystem_win32.cpp
  ioredirect.cpp
  iosystem_unix.cpp
  iosystem_win32.cpp
  interop_unix.cpp
  interop_win32.cpp
  platform_unix.cpp
  platform_win32.cpp
  streams.cpp
  logger.cpp
  buildinfo.cpp
  netcoredbg.vcxproj -> C:\Users\user\Documents\netcoredbg\build\src\Debug\netcoredbg.exe
  Building Custom Rule C:/Users/user/Documents/netcoredbg/CMakeLists.txt

C:\Users\user\Documents\netcoredbg\build>pause
Press any key to continue . . .

C:\Users\user\Documents\netcoredbg\build>.\src\Debug\netcoredbg.exe
Unable to load C:\Users\user\Documents\netcoredbg\build\src\Debug\dbgshim.dll

C:\Users\user\Documents\netcoredbg\build>pause
Press any key to continue . . .

C:\Users\user\Documents\netcoredbg\build>
gbalykov commented 10 months ago

cmake --build .

Please try cmake --build . --target install instead

viewizard commented 10 months ago
cmake .. -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX="..\bin"
cmake --build . --target install
GniLudio commented 10 months ago

Still get the same error after adding -DCMAKE_INSTALL_PREFIX="..\bin" and --target install.

viewizard commented 10 months ago

After your build with --target install you should use"install" folder (not build folder), for example, netcoredbg/bin (or check were you initial location was and calculate "..\bin" location), and launch netcoredbg from this location.

Note, in bin folder you should see all files, as you could see in downloaded from this project release netcoredbg-win64.zip (since we just pack this files for releases).

GniLudio commented 10 months ago

Thanks. That worked.