Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetbrains Rider profiler fails to start #304769

Open
anpin opened this issue Apr 17, 2024 · 7 comments
Open

Jetbrains Rider profiler fails to start #304769

anpin opened this issue Apr 17, 2024 · 7 comments

Comments

@anpin
Copy link
Contributor

anpin commented Apr 17, 2024

Describe the bug

Jetbrains Memory Profiler fails to start due to missing dependency

Steps To Reproduce

Steps to reproduce the behavior:

  1. Run Rider
  2. Open memory profiling tab

Expected behavior

Plugin works

Screenshots

image

Additional context

The plugin uses avalonia under the hood, so adding following list of libraries to ldpath should do the trick (waiting for the update to finish to verify that):

with pkgs.xorg; [
        libGL
        libX11
        libXi
        zlib
        openssl
        libICE
        libSM
        fontconfig
        gtk3
       ]

Rider logs

10:46:46.897 |E| JetHostParametersCaller       | :1                 | Failed to initialize host with handler {myArgs={WindowManagementModelLink=JetBrains.Profilers.Rider_WindowManagement,ProcessReadinessModelLink=JetBrains.Profilers.Rider_ProcessReadinessModel,RiderAppModelLink=JetBrains.Profilers.Rider_RiderAppModel,BackendAppModelLink=JetBrains.Profilers.Rider_$JetBrains.Rider.Model.DotMemoryBackendModel_BackendAppModel,RiderActionModelLink=JetBrains.Profilers.Rider_RiderActionModel,BackendActionModelLink=JetBrains.Profilers.Rider_BackendActionModel,BackgroundTasksModelLink=JetBrains.Profilers.Rider_RiderBackgroundTaskModel,ForceGpu=True}}. Unable to load shared library 'libX11.so.6' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: /nix/store/r03qw1qyhrkpj2sgyr6m7s94rd6kdm6n-dotnet-sdk-7.0.405/shared/Microsoft.NETCore.App/7.0.15/libX11.so.6.so: cannot open shared object file: No such file or directory /nix/store/wcgc4bv0abhbrmiy0zzrp5ql9rfw0znf-rider-2023.3.3/rider/plugins/dotTrace.dotMemory/DotFiles/libX11.so.6.so: cannot open shared object file: No such file or directory /nix/store/r03qw1qyhrkpj2sgyr6m7s94rd6kdm6n-dotnet-sdk-7.0.405/shared/Microsoft.NETCore.App/7.0.15/liblibX11.so.6.so: cannot open shared object file: No such file or directory /nix/store/wcgc4bv0abhbrmiy0zzrp5ql9rfw0znf-rider-2023.3.3/rider/plugins/dotTrace.dotMemory/DotFiles/liblibX11.so.6.so: cannot open shared object file: No such file or directory /nix/store/r03qw1qyhrkpj2sgyr6m7s94rd6kdm6n-dotnet-sdk-7.0.405/shared/Microsoft.NETCore.App/7.0.15/libX11.so.6: cannot open shared object file: No such file or directory /nix/store/wcgc4bv0abhbrmiy0zzrp5ql9rfw0znf-rider-2023.3.3/rider/plugins/dotTrace.dotMemory/DotFiles/libX11.so.6: cannot open shared object file: No such file or directory /nix/store/r03qw1qyhrkpj2sgyr6m7s94rd6kdm6n-dotnet-sdk-7.0.405/shared/Microsoft.NETCore.App/7.0.15/liblibX11.so.6: cannot open shared object file: No such file or directory /nix/store/wcgc4bv0abhbrmiy0zzrp5ql9rfw0znf-rider-2023.3.3/rider/plugins/dotTrace.dotMemory/DotFiles/liblibX11.so.6: cannot open shared object file: No such file or directory

--- EXCEPTION #1/2 [DllNotFoundException]
Message = “
  Unable to load shared library 'libX11.so.6' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
  /nix/store/r03qw1qyhrkpj2sgyr6m7s94rd6kdm6n-dotnet-sdk-7.0.405/shared/Microsoft.NETCore.App/7.0.15/libX11.so.6.so: cannot open shared object file: No such file or directory
  /nix/store/wcgc4bv0abhbrmiy0zzrp5ql9rfw0znf-rider-2023.3.3/rider/plugins/dotTrace.dotMemory/DotFiles/libX11.so.6.so: cannot open shared object file: No such file or directory
  /nix/store/r03qw1qyhrkpj2sgyr6m7s94rd6kdm6n-dotnet-sdk-7.0.405/shared/Microsoft.NETCore.App/7.0.15/liblibX11.so.6.so: cannot open shared object file: No such file or directory
  /nix/store/wcgc4bv0abhbrmiy0zzrp5ql9rfw0znf-rider-2023.3.3/rider/plugins/dotTrace.dotMemory/DotFiles/liblibX11.so.6.so: cannot open shared object file: No such file or directory
  /nix/store/r03qw1qyhrkpj2sgyr6m7s94rd6kdm6n-dotnet-sdk-7.0.405/shared/Microsoft.NETCore.App/7.0.15/libX11.so.6: cannot open shared object file: No such file or directory
  /nix/store/wcgc4bv0abhbrmiy0zzrp5ql9rfw0znf-rider-2023.3.3/rider/plugins/dotTrace.dotMemory/DotFiles/libX11.so.6: cannot open shared object file: No such file or directory
  /nix/store/r03qw1qyhrkpj2sgyr6m7s94rd6kdm6n-dotnet-sdk-7.0.405/shared/Microsoft.NETCore.App/7.0.15/liblibX11.so.6: cannot open shared object file: No such file or directory
  /nix/store/wcgc4bv0abhbrmiy0zzrp5ql9rfw0znf-rider-2023.3.3/rider/plugins/dotTrace.dotMemory/DotFiles/liblibX11.so.6: cannot open shared object file: No such file or directory
”
ExceptionPath = Root.InnerException
ClassName = System.DllNotFoundException
Data.ThreadLocalDebugInfo = Environment::Create
HResult = COR_E_DLLNOTFOUND=80131524
Source = Avalonia.X11
TypeLoadResourceID = 0
StackTraceString = “
  at Avalonia.X11.XLib.XInitThreads()
     at Avalonia.X11.AvaloniaX11Platform.Initialize(X11PlatformOptions options) in Z:\BuildAgent\work\f8311b78ac51eb63\Avalonia\src\Avalonia.X11\X11Platform.cs:line 52
     at Avalonia.AvaloniaX11PlatformExtensions.<>c.<UseX11>b__0_0() in Z:\BuildAgent\work\f8311b78ac51eb63\Avalonia\src\Avalonia.X11\X11Platform.cs:line 347
     at Avalonia.AppBuilder.SetupUnsafe() in Z:\BuildAgent\work\f8311b78ac51eb63\Avalonia\src\Avalonia.Controls\AppBuilder.cs:line 315
     at Avalonia.AppBuilder.Setup() in Z:\BuildAgent\work\f8311b78ac51eb63\Avalonia\src\Avalonia.Controls\AppBuilder.cs:line 303
     at Avalonia.AppBuilder.SetupWithoutStarting() in Z:\BuildAgent\work\f8311b78ac51eb63\Avalonia\src\Avalonia.Controls\AppBuilder.cs:line 175
     at JetBrains.UI.Avalonia.Ide.Application.Rider.RiderAvaloniaInitAppFxHostMixin`1.InitHost(Lifetime lifetime) in InitHost.il:line IL_0139 mvid 31C3
     at JetBrains.Application.Environment.HostParameters.JetHostParametersCaller.InitHost(Lifetime lifetime) in InitHost.il:line IL_0057 mvid 5434
”

Notify maintainers

@raphaelr

Metadata

└[~]> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.7.6, NixOS, 24.05 (Uakari), 24.05.20240301.141db4d`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(a): `"nixpkgs"`
 - channels(root): `"nixos"`
 - nixpkgs: `/home/a/.nix-defexpr/channels/nixpkgs`

Add a 👍 reaction to issues you find important.

@anpin anpin changed the title Jetbrains Rider profiler fails start Jetbrains Rider profiler fails to start Apr 18, 2024
@anpin
Copy link
Contributor Author

anpin commented May 5, 2024

here is what I have tried. it doesn't fail to load libraries any more, but fail to start nonetheless. perhaps it tries to create a folder under /nix/store/... where binaries are. see log in attach.

jetbrains =
                 
                  let extraLdPath = with final; with xorg; [ 
                                icu 
                                udev 
                                libX11
                                libICE
                                libSM
                                mesa
                                fontconfig
                                gtk3
                                final.stdenv.cc.cc 
                                ]; in 
                 
                  prev.jetbrains // {
                            rider = prev.jetbrains.rider.overrideAttrs (oldAttrs: rec {
                              inherit extraLdPath;
                              postInstall =  
                                oldAttrs.postInstall + 
                                ''
                                  extra="${final.lib.makeLibraryPath extraLdPath}"
                                  echo "extra: $extra"
                                  IFS=':' 
                                  for libpath in $extra; do 
                                    ln -sf "$libpath"/* $out/rider/plugins/dotTrace.dotMemory/DotFiles/ 
                                  done
                                  
                                  interp="$(cat $NIX_CC/nix-support/dynamic-linker)"
                                  patchelf --set-rpath ${final.lib.makeLibraryPath extraLdPath} $out/rider/plugins/dotTrace.dotMemory/DotFiles/linux-x64/libSkiaSharp.so
                                  patchelf --set-interpreter $interp $out/rider/plugins/dotTrace.dotMemory/DotFiles/linux-x64/JetBrains.Profilers.Rider
        
                                  ls -al $out/rider/plugins/dotTrace.dotMemory/DotFiles/
                                  unset IFS 
                                '';

                          });
                      };

2024_05_05_08_07_33_2393.log

@anpin
Copy link
Contributor Author

anpin commented May 5, 2024

@anpin
Copy link
Contributor Author

anpin commented May 6, 2024

Had to patch another binary inside of a jar. Here is my working overlay:

 jetbrains =
                 
                  let extraLdPath = with final; with xorg; [ 
                                icu 
                                udev 
                                libX11
                                libICE
                                libSM
                                mesa
                                fontconfig
                                gtk3
                                libGL
                                libglvnd
                                libGLU
                                final.stdenv.cc.cc 
                                ]; in
                  prev.jetbrains // {
                            rider = prev.jetbrains.rider.overrideAttrs (oldAttrs: rec {
                              inherit extraLdPath;
                              # look at nixpkgs derivation for explanations
                              postInstall =  
                                oldAttrs.postInstall + 
                                ''
                                  extra="${final.lib.makeLibraryPath extraLdPath}"
                                  echo "extra: $extra"
                                  IFS=':' 
                                  for libpath in $extra; do 
                                    ln -sf "$libpath"/* $out/rider/plugins/dotTrace.dotMemory/DotFiles/ 
                                  done
                                  unset IFS 
                                  
                                  interp="$(cat $NIX_CC/nix-support/dynamic-linker)"
                                  patchelf --set-rpath ${final.lib.makeLibraryPath extraLdPath} $out/rider/plugins/dotTrace.dotMemory/DotFiles/linux-x64/libSkiaSharp.so
                                  patchelf --set-interpreter $interp $out/rider/plugins/dotTrace.dotMemory/DotFiles/linux-x64/JetBrains.Profilers.Rider
                                  
                                  jar=$(find $out -name "skiko-awt-runtime-linux-x64*.jar")
                                  ${final.jdk}/bin/jar xvf $jar libskiko-linux-x64.so
                                  patchelf --set-rpath ${final.lib.makeLibraryPath extraLdPath} libskiko-linux-x64.so
                                  ${final.jdk}/bin/jar uvf $jar libskiko-linux-x64.so
                                  rm -f libskiko-linux-x64.so
                                  
                                '';

@zlepper
Copy link
Contributor

zlepper commented May 30, 2024

@anpin Did you ever get around the issue with Size should be >= (1,1) when you try to activate the profiler on a project?

It is reported as this issue on Youtrack: https://youtrack.jetbrains.com/issue/DMRY-10986/Size-should-be-11-Parameter-name-size-EXCEPTION-1-2-ArgumentException-Message-Size-should-be-11-ExceptionPath however I'm not sure if it's caused by Nix or by Rider doing something strange

@anpin
Copy link
Contributor Author

anpin commented May 30, 2024

Haven't seen that error, profiler works just fine for me after applying above overlay.

@zlepper
Copy link
Contributor

zlepper commented May 30, 2024

Haven't seen that error, profiler works just fine for me after applying above overlay.

Just out of curiosity, or you using Rider from stable or unstable nix? Because I believe stable is still on the 2023.x series?

@anpin
Copy link
Contributor Author

anpin commented Jun 3, 2024

I'm using this fork which I rebase to master/nixos-unstable when needed. Currently it has Rider 2024.1.1

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

No branches or pull requests

2 participants