| 12 Dec 2024 |
6pak | the issue here is on nix build system side | 00:11:25 |
6pak | I guess you could run autoPatchcil inside an msbuild hook? but then how would you do manual depends injection etc | 00:12:49 |
GGG | well, it'd be possible to run it inside of a msbuild target | 00:15:21 |
GGG | that runs before the NativeAOT one | 00:15:27 |
GGG | 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 [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 |
GGG | there is CIL before it compiles it to native | 00:16:43 |
Emma [it/its] | well that, sure | 00:16:50 |
6pak | and nativeaot only uses the system linker if you explicitly mark the imports as DirectPInvoke | 00:17:11 |
GGG | although I wouldn't put effort into it initially since the amount of packages that use NativeAOT in nixpkgs is small from my knowledge | 00:17:14 |
Emma [it/its] | DirectPInvoke? cant say ive heard of that before | 00:18:54 |
6pak | 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 | like add a required native dependency to a cil assembly | 00:20:17 |
6pak | like you would with patchelf --add-needed | 00:20:45 |
6pak | 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 [it/its] | this looks like codegen for dllimport? | 00:23:34 |
6pak | it makes dllimport use standard dynamic/static linking instead dlopen-ing at runtime | 00:25:39 |
6pak | so unless you do that, patchelf wont see the dependencies in naot binaries | 00:26:02 |
Emma [it/its] | i see | 00:28:22 |
GGG | same way you do with autoPatchelfHook, add it to runtimeDeps | 02:16:11 |
GGG | then it'll add it to every single assembly (or ELF in case of autoPatchelfHook) | 02:16:29 |
GGG | if you've chosen NativeAOT then you're in for the headache imo | 02:16:51 |
GGG | Redacted or Malformed Event | 05:04:30 |
GGG | got some progress done on patchcil 6pak: | 05:04:31 |
GGG | * got some progress done on patchcil 6pak | 05:04:35 |
GGG | 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 |
GGG | I'll work on it further tomorrow but that's enough for today | 05:18:39 |
| Whovian9369 joined the room. | 19:23:03 |
GGG | 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 |
GGG | 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 |