| 12 Dec 2024 |
GGG | it can't, out of scope | 00:08:41 |
GGG | we'd just have to use LD_LIBRARY_PATH instead | 00:08:51 |
6pak | In reply to @gggkiller:matrix.org
not easily, because we'd need to have something to:
- List the native libraries being referenced (which .NET doesn't have by default)
- Tell the build where it should search for native libraries in (which .NET doesn't have by default)
- Try to find said libraries in the search path and fail the build if it doesn't find it (which .NET doesn't have by default)
patchcil would solve 1. here, but for 2. and 3. would be in the nix script | 00:08:55 |
GGG | * we'd just have to use LD_LIBRARY_PATH instead like we do currently | 00:08:56 |
6pak | In reply to @gggkiller:matrix.org
not easily, because we'd need to have something to:
- List the native libraries being referenced (which .NET doesn't have by default)
- Tell the build where it should search for native libraries in (which .NET doesn't have by default)
- Try to find said libraries in the search path and fail the build if it doesn't find it (which .NET doesn't have by default)
* for what I was thinking, patchcil would solve 1. here, but for 2. and 3. would be in the nix script | 00:09:09 |
GGG | it'd actually solve the whole process when running in autoPatchcilHook mode | 00:09:15 |
GGG | which is the more "useful" mode I think | 00:09:31 |
6pak | In reply to @gggkiller:matrix.org it can't, out of scope it can for source builds | 00:09:51 |
6pak | just run patchcil before naot | 00:09:58 |
6pak | with a msbuild target | 00:10:03 |
6pak | the issue is how you pass in what libraries you want from nix | 00:10:15 |
GGG | it'd be quite a bit of work though, I wouldn't put it in as a requirement for the MVP | 00:10:29 |
GGG | maybe a 1.1 release or something | 00:10:38 |
6pak | no work would be needed in patchcil itself | 00:10:57 |
6pak | it doesn't care about what you do with the dlls after the fact | 00:11:06 |
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 |