!pbdtvoHxUGLhcEvnlu:nixos.org

Exotic Nix Targets

332 Members
102 Servers

Load older messages


SenderMessageTime
17 Aug 2023
@kmicklas:matrix.orgKen Micklas changed their display name from Kenny Micklas to Ken Micklas.20:22:50
18 Aug 2023
@shados:nixos.devShados joined the room.05:41:56
19 Aug 2023
@rhelmot:matrix.orgrhelmotokay, I'm trying to build the freebsd userland in nix - the main problem is that it builds everything linked against / instead of the derivation output, so it can't actually run. I can't find a parameter anywhere in the build settings to change this, so I guess I don't have a better option than to patch all the outputs to link against the right root?03:02:45
@rhelmot:matrix.orgrhelmotwhat does e.g. cat(1) on nixos look like, does it have a rpath set pointing to the libc it was linked against?03:03:06
@misuzu:matrix.orgmisuzu
% ldd $(where cat)  
	linux-vdso.so.1 (0x00007ffd453b3000)
	libcrypto.so.3 => /nix/store/z963s748p2pxlv91q3lsm7hx3m06h0a9-openssl-3.0.9/lib/libcrypto.so.3 (0x00007fbf151c7000)
	libacl.so.1 => /nix/store/wah0xp4ani8b4l7d6hcjlb2lyiy2g83z-acl-2.3.1/lib/libacl.so.1 (0x00007fbf151bc000)
	libattr.so.1 => /nix/store/d0v43l0kfszyiq8ln9mgizg3yyp63p81-attr-2.5.1/lib/libattr.so.1 (0x00007fbf151b4000)
	libgmp.so.10 => /nix/store/kh108jif43dm3yk6yxr9zmyskybcww3w-gmp-with-cxx-6.2.1/lib/libgmp.so.10 (0x00007fbf15114000)
	libc.so.6 => /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib/libc.so.6 (0x00007fbf14f2e000)
	libdl.so.2 => /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib/libdl.so.2 (0x00007fbf14f27000)
	libpthread.so.0 => /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib/libpthread.so.0 (0x00007fbf14f22000)
	/nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib/ld-linux-x86-64.so.2 => /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007fbf15644000)
05:35:29
@rhelmot:matrix.orgrhelmot right but what's readelf -d $(where cat) 05:37:55
@misuzu:matrix.orgmisuzu
% readelf -d $(where cat)

Dynamic section at offset 0x13b080 contains 32 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libcrypto.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libacl.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libattr.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libgmp.so.10]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/nix/store/wah0xp4ani8b4l7d6hcjlb2lyiy2g83z-acl-2.3.1/lib:/nix/store/d0v43l0kfszyiq8ln9mgizg3yyp63p81-attr-2.5.1/lib:/nix/store/kh108jif43dm3yk6yxr9zmyskybcww3w-gmp-with-cxx-6.2.1/lib:/nix/store/z963s748p2pxlv91q3lsm7hx3m06h0a9-openssl-3.0.9/lib:/nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib]
 0x000000000000000c (INIT)               0x408000
 0x000000000000000d (FINI)               0x4dd814
 0x0000000000000019 (INIT_ARRAY)         0x531ff0
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x531ff8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x0000000000000004 (HASH)               0x4003f8
 0x000000006ffffef5 (GNU_HASH)           0x400e98
 0x0000000000000005 (STRTAB)             0x4035e0
 0x0000000000000006 (SYMTAB)             0x400ef8
 0x000000000000000a (STRSZ)              5023 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x53c2d0
 0x0000000000000002 (PLTRELSZ)           9192 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x4050d8
 0x0000000000000007 (RELA)               0x404e80
 0x0000000000000008 (RELASZ)             600 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW
 0x000000006ffffffe (VERNEED)            0x404cc0
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x404980
 0x0000000000000000 (NULL)               0x0
05:40:41
@rhelmot:matrix.orgrhelmotthat is exactly what I needed to see, ty05:40:57
@trofi:matrix.orgtrofi

In Linux ld.so itself has a default directory it loads libc from:

$ ld.so --help
...
Shared library search path:
  (libraries located via /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/etc/ld.so.cache)
  /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib (system search path)
  /nix/store/5cfwfnp4capzbjmkkrl7a6shvaghgj3h-xgcc-12.3.0-libgcc/lib (system search path)
07:25:41
@rhelmot:matrix.orgrhelmotI'll take a look later to see if it's possible to configure the freebsd interpreter to use a custom socache. in the meantime it's patchelf time07:27:03
@trofi:matrix.orgtrofi On NixOS ld.so.cache is not present. It uses /nix/store/ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib (and other RUNPATHs) as a lookup (and it's not super-efficient). 07:28:17
@trofi:matrix.orgtrofi https://man.freebsd.org/cgi/man.cgi?query=ld.so&apropos=0&sektion=8&manpath=CentOS+7.1&arch=default&format=html hints that there are default like /lib:/usr/lib as well (unless -z nodeflib). Maybe you can set those as well. 07:29:45
@rhelmot:matrix.orgrhelmotthat page seems to be for the linux ld despite being hosted on freebsd.org07:30:47
@trofi:matrix.orgtrofiOh, yeah.07:31:10
@trofi:matrix.orgtrofi https://github.com/lattera/freebsd/blob/master/libexec/rtld-elf/rtld.c#L1430 . Maybe it's up to BSD's ld to populate the actual default? 07:34:30
@trofi:matrix.orgtrofi Aha, it uses STANDARD_LIBRARY_PATH there. 07:35:38
@trofi:matrix.orgtrofihttps://github.com/lattera/freebsd/blob/401a161083850a9a4ce916f37520c084cff1543b/libexec/rtld-elf/rtld.h#L5407:36:08
@rhelmot:matrix.orgrhelmotpogchamp07:36:36
@rhelmot:matrix.orgrhelmotanyone have any tips on debugging infinite recursion in the stdenv construction? I'm having trouble building bash. it seems like it's not using the bootstrap shell I provided as the stdenv's shell, it seems to be trying to build itself.09:34:08
@snektron:matrix.orgSnektronNew esmil kernel just dropped10:05:16
@snektron:matrix.orgSnektronAnd it looks like starfive finally added pci support in uboot 10:07:58
@trofi:matrix.orgtrofi stdenv/linux has a few debugging tips: https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/linux/default.nix#L25C37-L25C37 10:09:04
@trofi:matrix.orgtrofi I guess it depends on how exactly you construct the stdenv. But generally one uses overlays to break the recursion and refer to already present dependencies from the previous stages of stdenv. 10:11:16
@trofi:matrix.orgtrofi

For example linux does it via steps like https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/linux/default.nix#L412:

  (prevStage:
    stageFun prevStage {
    name = "bootstrap-stage2";
    # ...
    overrides = self: super: {
      inherit (prevStage)
        ccWrapperStdenv gettext
        gcc-unwrapped coreutils gnugrep
        perl gnum4 bison texinfo which;

Here perl and friends come from a previous instance of stdenv instead of being built normally.

10:13:32
@trofi:matrix.orgtrofi And initial seed is populated from "bootstrap-stage0" like coreutils = bootstrapTools; gnugrep = bootstrapTools;. 10:14:33
@misuzu:matrix.orgmisuzu
In reply to @snektron:matrix.org
And it looks like starfive finally added pci support in uboot
Upstream u-boot is broken though
13:03:47
@misuzu:matrix.orgmisuzuAnd nvme boot doesn't work out of the box13:04:09
@misuzu:matrix.orgmisuzuhttps://github.com/misuzu/u-boot/commits/visionfive2-usb13:04:14
@misuzu:matrix.orgmisuzuThis has https://patchwork.ozlabs.org/project/uboot/cover/20230814160404.9B2E067373@verein.lst.de/ and makes nvme work13:06:35
20 Aug 2023
@rhelmot:matrix.orgrhelmothow does the default set of hooks (?) in the cc-wrapper make sure that the built binaries have the right rpath and interpreter? it seems that the way I have it set right now, it has set the rpath correctly but not the interpreter.07:25:33

Show newer messages


Back to Room ListRoom Version: 6