!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

126 Members
24 Servers

Load older messages


SenderMessageTime
12 Dec 2024
@6pak:matrix.org6pakthe issue here is on nix build system side00:11:25
@6pak:matrix.org6pakI guess you could run autoPatchcil inside an msbuild hook? but then how would you do manual depends injection etc00:12:49
@gggkiller:matrix.orgGGGwell, it'd be possible to run it inside of a msbuild target00:15:21
@gggkiller:matrix.orgGGGthat runs before the NativeAOT one00:15:27
@gggkiller:matrix.orgGGG we could even make it part of buildDotnetModule itself and it'd inject the msbuild target whenever possible (i.e. when people haven't specified a solution instead of a csproj or not specified one at all) 00:16:25
@emma:rory.gayEmma [it/its]
In reply to @6pak:matrix.org
actually this made me think, GGG how would patchcil handle nativeaot builds?
there is no cil then, you'd probably just patchelf if needed
00:16:26
@gggkiller:matrix.orgGGG there is CIL before it compiles it to native 00:16:43
@emma:rory.gayEmma [it/its]well that, sure00:16:50
@6pak:matrix.org6pakand nativeaot only uses the system linker if you explicitly mark the imports as DirectPInvoke00:17:11
@gggkiller:matrix.orgGGGalthough I wouldn't put effort into it initially since the amount of packages that use NativeAOT in nixpkgs is small from my knowledge00:17:14
@emma:rory.gayEmma [it/its]DirectPInvoke? cant say ive heard of that before00:18:54
@6pak:matrix.org6pak
In reply to @gggkiller:matrix.org
that runs before the NativeAOT one
that's what I mean yes but then how would you do anything custom with patchcil from nix
00:20:03
@6pak:matrix.org6paklike add a required native dependency to a cil assembly00:20:17
@6pak:matrix.org6paklike you would with patchelf --add-needed00:20:45
@6pak:matrix.org6pak
In reply to @emma:rory.gay
DirectPInvoke? cant say ive heard of that before
https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/interop#direct-pinvoke-calls
00:21:24
@emma:rory.gayEmma [it/its]this looks like codegen for dllimport?00:23:34
@6pak:matrix.org6pakit makes dllimport use standard dynamic/static linking instead dlopen-ing at runtime00:25:39
@6pak:matrix.org6pakso unless you do that, patchelf wont see the dependencies in naot binaries00:26:02
@emma:rory.gayEmma [it/its]i see00:28:22
@gggkiller:matrix.orgGGG same way you do with autoPatchelfHook, add it to runtimeDeps 02:16:11
@gggkiller:matrix.orgGGG then it'll add it to every single assembly (or ELF in case of autoPatchelfHook) 02:16:29
@gggkiller:matrix.orgGGGif you've chosen NativeAOT then you're in for the headache imo02:16:51
@gggkiller:matrix.orgGGGRedacted or Malformed Event05:04:30
@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

Show newer messages


Back to Room ListRoom Version: 9