| 30 Jul 2022 |
@elvishjerricco:matrix.org | FWIW we could check for valid ELF-ness by calling patchelf instead of ldd, which would fix the original problem. But it is mighty nice to have that lib... and allowing deps means we can change the input to JSON instead of this really bad lines format | 18:49:26 |
@elvishjerricco:matrix.org | I dunno, I'm torn | 18:49:38 |
K900 | I am pretty sure (native) patchelf does not work correctly for cross | 18:49:49 |
K900 | So we might need a cross patchelf | 18:49:56 |
K900 | Or rather we might need to drag a cross patchelf into the closure | 18:50:13 |
@elvishjerricco:matrix.org | I thought Linux Hackerman managed to use it to fix their problem before trying your fix | 18:50:13 |
@elvishjerricco:matrix.org | It would surprise me if patchelf even had any cross-dependent behavior | 18:50:42 |
K900 | It might work across different bit width, but I'm pretty sure it doesn't work across endianness | 18:51:02 |
@elvishjerricco:matrix.org | hm | 18:51:20 |
K900 | Because it just does #include <elf.h> which is wrong | 18:51:22 |
@elvishjerricco:matrix.org | gotcha | 18:51:28 |
K900 | Well, wrong if you're dealing with something that's not the same endianness | 18:51:38 |
K900 | https://github.com/NixOS/patchelf/blob/master/src/patchelf.cc#L213 | 18:51:59 |
K900 | And yep it just casts things around | 18:52:02 |
@elvishjerricco:matrix.org | yea. that does mean that we can't use it for cross stuff like this though... Which, wait, doesn't make sense. Because we do use patchelf in fixup phase and whatnot when cross building | 18:52:07 |
K900 | I'm pretty sure it's a cross patchelf | 18:52:18 |
@elvishjerricco:matrix.org | let me check... | 18:52:25 |
K900 | Either that or no one actually cares about BE architectures | 18:52:32 |
K900 | Both are possible | 18:52:36 |
@janne.hess:helsinki-systems.de | In reply to @elvishjerricco:matrix.org It would surprise me if patchelf even had any cross-dependent behavior You can ask @Mic92 about that, he started maintaining that | 18:52:44 |
K900 | Oh actually wait | 18:53:16 |
K900 | It does have some endianness checks | 18:53:22 |
@elvishjerricco:matrix.org | $ nix build --no-link --json nixpkgs#patchelf
[{"drvPath":"/nix/store/kshhm1fpfdv5a1qkd7sf18plxh7ddlg4-patchelf-0.14.5.drv","outputs":{"out":"/nix/store/96q22iw1i2m960x9y3v6fsj55691pzdl-patchelf-0.14.5"}}]
$ nix build --no-link --json nixpkgs#pkgsCross.aarch64-multiplatform.buildPackages.patchelf
[{"drvPath":"/nix/store/kshhm1fpfdv5a1qkd7sf18plxh7ddlg4-patchelf-0.14.5.drv","outputs":{"out":"/nix/store/96q22iw1i2m960x9y3v6fsj55691pzdl-patchelf-0.14.5"}}]
| 18:53:27 |
@elvishjerricco:matrix.org | Looks the same to me | 18:53:33 |
K900 | Yeah OK it's doing very cursed things | 18:53:39 |
K900 | https://github.com/NixOS/patchelf/blob/master/src/patchelf.cc#L239 | 18:53:40 |
@linus:schreibt.jetzt | In reply to @janne.hess:helsinki-systems.de Who updates them? r-ryantm once we've added an update script that runs cargo update | 18:54:05 |
K900 | This is freaking scary | 18:55:14 |
K900 | It's basically just bytemucking all the values in-place at read time | 18:55:32 |
K900 | RIIR patchelf when | 18:55:47 |