!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

127 Members
24 Servers

Load older messages


SenderMessageTime
12 Dec 2024
@gggkiller:matrix.orgGGG got some progress done on patchcil 6pak: 05:04:31
@gggkiller:matrix.orgGGG * got some progress done on patchcil 6pak 05:04:35
@gggkiller:matrix.orgGGG

a more compact output:

$ dotnet run -- --print-imports result/lib/avalonia-ilspy/Avalonia.X11.dll     
libc
libgdk-3.so.0
libGL.so.1
libglib-2.0.so.0
libgobject-2.0.so.0
libgtk-3.so.0
libICE.so.6
libSM.so.6
libX11.so.6
libXcursor.so.1
libXi.so.6
libXrandr.so.2
05:06:52
@gggkiller:matrix.orgGGGI'll work on it further tomorrow but that's enough for today05:18:39
@whovian9369:matrix.orgWhovian9369 joined the room.19:23:03
@gggkiller:matrix.orgGGG 6pak: currently considering what the CLI UX should be for setting the search paths, because it'll modify the DllImports and CIL has no concept of RPATH (although the DllImports can stand in for NT_NEEDED) 19:44:35
@gggkiller:matrix.orgGGG was thinking of doing something like patchcil --set-library-path libX11.so:/nix/store/nicg80r560lxr1vzlrjcj401v98fwb7y-libX11-1.8.10/lib/libX11.so.6 19:45:11
@gggkiller:matrix.orgGGG (for the non-autoPatchcilHook interface) 19:45:29
@6pak:matrix.org6pak
In reply to @gggkiller:matrix.org
same way you do with autoPatchelfHook, add it to runtimeDeps
but with autoPatchelfHook you can do --add-needed in postFixup
19:51:40
@6pak:matrix.org6pak
In reply to @gggkiller:matrix.org

a more compact output:

$ dotnet run -- --print-imports result/lib/avalonia-ilspy/Avalonia.X11.dll     
libc
libgdk-3.so.0
libGL.so.1
libglib-2.0.so.0
libgobject-2.0.so.0
libgtk-3.so.0
libICE.so.6
libSM.so.6
libX11.so.6
libXcursor.so.1
libXi.so.6
libXrandr.so.2
I had the same when playing around before
19:52:06
@6pak:matrix.org6pakimage.png
Download image.png
19:52:10
@gggkiller:matrix.orgGGG don't you mean preFixup or fixupPhase? because autoPatchelfHook runs in postFixup 19:52:55
@6pak:matrix.org6pakI think both work but you should do it in postFixup for some ugly reason, don't remember exactly19:53:37
@6pak:matrix.org6pak
In reply to @gggkiller:matrix.org
6pak: currently considering what the CLI UX should be for setting the search paths, because it'll modify the DllImports and CIL has no concept of RPATH (although the DllImports can stand in for NT_NEEDED)
we could emulate RPATH with a custom DllImportResolver
19:56:21
@6pak:matrix.org6pakand I think keeping the interface as close as possible to patchelf is the way to go19:56:57
@gggkiller:matrix.orgGGG I feel like it'd be better to just modify the DllImport themselves since we already have them on hand 19:57:00
@6pak:matrix.org6pakI was thinking of doing both19:57:16
@gggkiller:matrix.orgGGG ELFs and CIL assemblies aren't the same though, trying to emulate it could shoot ourselves in the foot 19:59:49
@gggkiller:matrix.orgGGG also, I can't figure out if the DllImportResolver also handles NativeLibrary.Load 20:03:11
@gggkiller:matrix.orgGGGif it doesn't then there's no point in using it20:03:18
@6pak:matrix.org6pakit does20:03:24
@gggkiller:matrix.orgGGG * if it doesn't then there's no point in using it as we already statically know all the libraries that are loaded through DllImport 20:03:35
@6pak:matrix.org6pakactually maybe only for the libraryName overload that also takes in the assembly20:04:57
@gggkiller:matrix.orgGGG

seems like neither do:

Given a library name, this method searches specific paths based on the runtime configuration, input parameters, and attributes of the calling assembly. If the searchPath parameter is non-null, the flags in this enumeration are used. Otherwise, the flags specified by the DefaultDllImportSearchPathsAttribute on the calling assembly, if any are present, are used. This method does not invoke the resolver registered using SetDllImportResolver(Assembly, DllImportResolver) method. Starting with .NET 5, this method does invoke the AssemblyLoadContext.LoadUnmanagedDll method and the AssemblyLoadContext.ResolvingUnmanagedDll event.

20:06:00
@gggkiller:matrix.orgGGG so I honestly don't think there's a point in using SetDllImportResolver as they're all static known strings we can modify directly 20:06:36
@gggkiller:matrix.orgGGGnot to mention if, for some reason, some app decides to use their own DllImportResolver then that'd make our tool not work20:08:44
@6pak:matrix.org6pak
In reply to @gggkiller:matrix.org

seems like neither do:

Given a library name, this method searches specific paths based on the runtime configuration, input parameters, and attributes of the calling assembly. If the searchPath parameter is non-null, the flags in this enumeration are used. Otherwise, the flags specified by the DefaultDllImportSearchPathsAttribute on the calling assembly, if any are present, are used. This method does not invoke the resolver registered using SetDllImportResolver(Assembly, DllImportResolver) method. Starting with .NET 5, this method does invoke the AssemblyLoadContext.LoadUnmanagedDll method and the AssemblyLoadContext.ResolvingUnmanagedDll event.

oh, I was thinking of AssemblyLoadContext.ResolvingUnmanagedDll then
20:11:57
@6pak:matrix.org6pakwhich I think is also called for dllimports20:12:08
@gggkiller:matrix.orgGGG ok, got it working by overriding the DllImports, I think I'll make a minimal version with it and then if you want to convert it to the ResolvingUnmanagedDll event, I'll leave it up to you since you know more about this library than me 6pak 23:40:32
@gggkiller:matrix.orgGGGif you're okay with it23:40:34

Show newer messages


Back to Room ListRoom Version: 9