!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

127 Members
24 Servers

Load older messages


SenderMessageTime
13 Dec 2024
@gggkiller:matrix.orgGGG ok, managed to write the code for an auto patchcil command, haven't tested yet, will leave that for tomorrow https://github.com/GGG-KILLER/patchcil/blob/main/src/Commands/AutoCommand.cs 06:33:41
@gggkiller:matrix.orgGGG

seems to output the expected errors, although I'll have to see about finding the libraries:

$ patchcil auto -r linux-x64 --paths /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
searching for dependencies of /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
    libICE.so.6 -> not found!
    libSM.so.6 -> not found!
    libc -> not found!
    libX11.so.6 -> not found!
    libXrandr.so.2 -> not found!
    libXi.so.6 -> not found!
    libXcursor.so.1 -> not found!
    libglib-2.0.so.0 -> not found!
    libgobject-2.0.so.0 -> not found!
    libgtk-3.so.0 -> not found!
    libgdk-3.so.0 -> not found!
    libGL.so.1 -> not found!
patchcil-auto: 12 dependencies could not be satisfied
error: patchcil-auto could not satisfy dependency libICE.so.6 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libSM.so.6 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libc wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libX11.so.6 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libXrandr.so.2 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libXi.so.6 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libXcursor.so.1 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libglib-2.0.so.0 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libgobject-2.0.so.0 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libgtk-3.so.0 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libgdk-3.so.0 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
error: patchcil-auto could not satisfy dependency libGL.so.1 wanted by /nix/store/zc4zc1rcf3vj4x3zbqnkpjifj31qijbg-avalonia-ilspy-7.2-rc/lib/avalonia-ilspy/Avalonia.X11.dll
patchcil-auto failed to find all the required dependencies.
Add the missing dependencies to --libs or use `--ignore-missing="foo.so.1 bar.so etc.so"`.
06:36:58
@6pak:matrix.org6paklooks pretty good15:52:03
@6pak:matrix.org6pakrid-graph-gen is interesting, but fyi there is a C# reader for the graph here https://github.com/dotnet/dotnet/blob/v9.0.101/src/nuget-client/src/NuGet.Core/NuGet.Packaging/RuntimeModel/JsonRuntimeFormat.cs15:52:34
@6pak:matrix.org6pakwhich the sdk uses15:52:38
@6pak:matrix.org6pak so you could have just done JsonRuntimeFormat.ReadRuntimeGraph(<$(RuntimeIdentifierGraphPath) from msbuild>).ExpandRuntime("linux-x64") 15:53:14
@6pak:matrix.org6pak and looking more into the runtimes/{rid}/native/{libname}.so pattern seems like it's only a build-time nuget thing 16:24:33
@6pak:matrix.org6pakthe runtime only looks at the .deps.json file to discover the library paths, which dotnet sdk populates from nuget info16:25:38
@6pak:matrix.org6pak * and looking more into the runtimes/{rid}/native/{libname}.so pattern, seems like it's only a build-time nuget thing 16:26:54
@6pak:matrix.org6pakand it does pick just the best matching rid, but only inside one dependency16:42:40
@6pak:matrix.org6pakand even though it has the full library path, it registers the directory as a search path16:43:59
@6pak:matrix.org6pak so if lib A has runtimes/linux-x64/native/liba.so and lib B has runtimes/linux-musl-x64/native/libb.so, both runtimes/linux-x64/native and runtimes/linux-musl-x64/native will be registered as native search paths 16:47:02
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
so you could have just done JsonRuntimeFormat.ReadRuntimeGraph(<$(RuntimeIdentifierGraphPath) from msbuild>).ExpandRuntime("linux-x64")
That's an interesting idea, however I wanted to have everything as optimized as possible, although I know most of the overhead will be in AsmResolver, I wanted to have little to no overhead on anything else so this doesn't slow down any builds
My long term objective with this is to use NativeAOT to have a really good cold start performance
22:04:01
@gggkiller:matrix.orgGGGDon't know if I'm overthinking this though 22:04:14
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
and looking more into the runtimes/{rid}/native/{libname}.so pattern, seems like it's only a build-time nuget thing
Yes, however my plan is to use autoPatchcil on the nuget restore step so nuget libraries with native tools and stuff work just fine
Long term I also want to find and transform any self-contained deployments into framework dependent ones so that they use the nixpkgs SDK/runtime instead of their own bundled one, that way we can avoid issues with ICU, openssl and libz
22:06:56
@gggkiller:matrix.orgGGG* Yes, however my plan is to use autoPatchcil on the nuget restore step so nuget libraries with native tools and stuff work just fine as they'll probably run on the build step (like the grpc package and entity framework) Long term I also want to find and transform any self-contained deployments into framework dependent ones so that they use the nixpkgs SDK/runtime instead of their own bundled one, that way we can avoid issues with ICU, openssl and libz22:07:42
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
the runtime only looks at the .deps.json file to discover the library paths, which dotnet sdk populates from nuget info
That's good to know, I'll look into it and try to add that logic into the command
22:08:50
@gggkiller:matrix.orgGGGAlso, while running it in a dry run against avalonia, I ran into something rather unpleasant 22:11:45
@gggkiller:matrix.orgGGGThere's `.dll` and `.dylib` imports in it as well, so it won't be as plug'n'play as `autoPatchelfHook`, I had to add quite a few thing to the ignores list like `*.dll`, `kernel32`, `user32` and more22:13:17
@gggkiller:matrix.orgGGGIt might be worth adding an option to exclude certain files on top of ignoring certain imports22:13:51
14 Dec 2024
@6pak:matrix.org6pak corehost parses the json every launch so it would probably be fine? 01:34:55
@6pak:matrix.org6pak I meant that the runtime doesn't look at the runtimes/{rid}/native path, it's the nuget client that checks it in the packages and converts it into metadata that the .net sdk then puts into the final .deps.json 01:37:31
@6pak:matrix.org6pakbut build time nuget packages requiring native libs themselves is a valid point01:38:40
@6pak:matrix.org6pakwouldn't it make more sense to run (auto)patchcil as part of nuget overrides though?01:38:57
@6pak:matrix.org6pak yeahh thats fair 01:41:31
@6pak:matrix.org6pak it would be nice if people annotated those with SupportedOSPlatformAttribute, but they probably don't 01:41:54
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
corehost parses the json every launch so it would probably be fine?
I mean, it probably wouldn't be much overhead, I'm probably just overthinking it, but since it's already done, I wouldn't just throw it away myself
01:43:21
@gggkiller:matrix.orgGGG
In reply to @6pak:matrix.org
I meant that the runtime doesn't look at the runtimes/{rid}/native path, it's the nuget client that checks it in the packages and converts it into metadata that the .net sdk then puts into the final .deps.json
Oh, I see, that's indeed a big issue, I'll have to remove those lines from the logic since it's nuget only
01:44:19
@6pak:matrix.org6pakit just so happens that it's the same path in the output usually01:44:49
@6pak:matrix.org6pakbut in theory the .deps.json could specify any path01:44:58

Show newer messages


Back to Room ListRoom Version: 9