!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

127 Members
24 Servers

Load older messages


SenderMessageTime
12 Dec 2024
@gggkiller:matrix.orgGGG * And we add the required libraries in LD_LIBRARY_PATH in makeWrapper (after the project has been built) instead of at build time, so even if there was a tool to block the build if the native library isn't found, it'd have to be very nix specific as we'd have to have an env-var or MSBuild property to indicate where it should search for said libraries on. 00:04:21
@gggkiller:matrix.orgGGG

no, because we'd need to have something to:

  1. List the native libraries being referenced (which .NET doesn't have by default)
  2. Tell the build where it should search for native libraries in (which .NET doesn't have by default)
  3. 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)
00:05:50
@gggkiller:matrix.orgGGGit'd be as much work as making something like a tool to patch those after the fact00:06:08
@gggkiller:matrix.orgGGGso it's just easier to make a tool to patch it since it'll work with both source builds and prebuilt binaries00:06:28
@gggkiller:matrix.orgGGG *

not easily, because we'd need to have something to:

  1. List the native libraries being referenced (which .NET doesn't have by default)
  2. Tell the build where it should search for native libraries in (which .NET doesn't have by default)
  3. 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)
00:06:37
@6pak:matrix.org6pak actually this made me think, GGG how would patchcil handle nativeaot builds? 00:08:31
@gggkiller:matrix.orgGGGit can't, out of scope00:08:41
@gggkiller:matrix.orgGGG we'd just have to use LD_LIBRARY_PATH instead 00:08:51
@6pak:matrix.org6pak
In reply to @gggkiller:matrix.org

not easily, because we'd need to have something to:

  1. List the native libraries being referenced (which .NET doesn't have by default)
  2. Tell the build where it should search for native libraries in (which .NET doesn't have by default)
  3. 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
@gggkiller:matrix.orgGGG * we'd just have to use LD_LIBRARY_PATH instead like we do currently 00:08:56
@6pak:matrix.org6pak
In reply to @gggkiller:matrix.org

not easily, because we'd need to have something to:

  1. List the native libraries being referenced (which .NET doesn't have by default)
  2. Tell the build where it should search for native libraries in (which .NET doesn't have by default)
  3. 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
@gggkiller:matrix.orgGGG it'd actually solve the whole process when running in autoPatchcilHook mode 00:09:15
@gggkiller:matrix.orgGGGwhich is the more "useful" mode I think00:09:31
@6pak:matrix.org6pak
In reply to @gggkiller:matrix.org
it can't, out of scope
it can for source builds
00:09:51
@6pak:matrix.org6pakjust run patchcil before naot00:09:58
@6pak:matrix.org6pakwith a msbuild target00:10:03
@6pak:matrix.org6pakthe issue is how you pass in what libraries you want from nix00:10:15
@gggkiller:matrix.orgGGGit'd be quite a bit of work though, I wouldn't put it in as a requirement for the MVP00:10:29
@gggkiller:matrix.orgGGGmaybe a 1.1 release or something00:10:38
@6pak:matrix.org6pakno work would be needed in patchcil itself00:10:57
@6pak:matrix.org6pakit doesn't care about what you do with the dlls after the fact00:11:06
@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

Show newer messages


Back to Room ListRoom Version: 9