Skip to content

Alacritty does not include glibc in rpath #219213

@blucoat

Description

@blucoat

Describe the bug

Alacritty has the wrong RPATH. It does not include glibc or libgcc, which causes it to use the system's libraries on non-nixos systems.

This is likely because the derivation for Alacritty sets RPATH manually, and does not include these libraries (probably just an oversight, since these are normally taken care of by stdenv.mkDerivation).

Steps To Reproduce

$ ldd $(which alacritty)
/home/james/.nix-profile/bin/alacritty: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /home/james/.nix-profile/bin/alacritty)
/home/james/.nix-profile/bin/alacritty: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/james/.nix-profile/bin/alacritty)
/home/james/.nix-profile/bin/alacritty: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/james/.nix-profile/bin/alacritty)
/home/james/.nix-profile/bin/alacritty: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /nix/store/970v1z9hdxby0s2dcj06ri1mxiyajj12-freetype-2.12.1/lib/libfreetype.so.6)
/home/james/.nix-profile/bin/alacritty: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /nix/store/s6slp93zplkd70zsahrvsp615vlcy2i8-fontconfig-2.14.0-lib/lib/libfontconfig.so.1)
/home/james/.nix-profile/bin/alacritty: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /nix/store/y68a044xy6mrysszvpf50hadls4ijj61-libXau-1.0.9/lib/libXau.so.6)
	linux-vdso.so.1 (0x00007ffd4663a000)
	libxcb.so.1 => /nix/store/g9wiz0czjlhippnyd3p6v10wvj9if4yy-libxcb-1.14/lib/libxcb.so.1 (0x00007f06cdf46000)
	libfreetype.so.6 => /nix/store/970v1z9hdxby0s2dcj06ri1mxiyajj12-freetype-2.12.1/lib/libfreetype.so.6 (0x00007f06cde7a000)
	libfontconfig.so.1 => /nix/store/s6slp93zplkd70zsahrvsp615vlcy2i8-fontconfig-2.14.0-lib/lib/libfontconfig.so.1 (0x00007f06cde2e000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f06cddd6000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f06cdc92000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f06cdabd000)
	libXau.so.6 => /nix/store/y68a044xy6mrysszvpf50hadls4ijj61-libXau-1.0.9/lib/libXau.so.6 (0x00007f06cdab8000)
	libXdmcp.so.6 => /nix/store/2sbvvb4a86953sxn05gnrfkmali7wvp0-libXdmcp-1.1.3/lib/libXdmcp.so.6 (0x00007f06cdab0000)
	libz.so.1 => /nix/store/9dz5lmff9ywas225g6cpn34s0wbldnxa-zlib-1.2.13/lib/libz.so.1 (0x00007f06cda90000)
	libbz2.so.1 => /nix/store/2a6yagz3pa8kiawg5mk2js70f8kwqzqd-bzip2-1.0.8/lib/libbz2.so.1 (0x00007f06cda7d000)
	libpng16.so.16 => /nix/store/d1b4yv4wgydcazgz4d76z1srpnf29n5v-libpng-apng-1.6.39/lib/libpng16.so.16 (0x00007f06cda44000)
	libbrotlidec.so.1 => /nix/store/9pdbnv128m77c9g3sr840vk0gfg94zy0-brotli-1.0.9-lib/lib/libbrotlidec.so.1 (0x00007f06cda36000)
	libpthread.so.0 => /nix/store/lqz6hmd86viw83f9qll2ip87jhb7p1ah-glibc-2.35-224/lib/libpthread.so.0 (0x00007f06cda31000)
	libexpat.so.1 => /nix/store/22wig7q4bj2clxz1ysl7gmh4667i00m4-expat-2.5.0/lib/libexpat.so.1 (0x00007f06cda04000)
	/nix/store/lqz6hmd86viw83f9qll2ip87jhb7p1ah-glibc-2.35-224/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f06ce65d000)
	libbrotlicommon.so.1 => /nix/store/9pdbnv128m77c9g3sr840vk0gfg94zy0-brotli-1.0.9-lib/lib/libbrotlicommon.so.1 (0x00007f06cd9e1000)

Notice that libgcc_s, libm and libc all end up using system libraries. This is because the runpath is wrong:

$ readelf -d $(which alacritty)

Dynamic section at offset 0x5e8670 contains 34 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libxcb.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libfreetype.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libfontconfig.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001d (RUNPATH)            Library runpath: [/nix/store/22wig7q4bj2clxz1ysl7gmh4667i00m4-expat-2.5.0/lib:/nix/store/s6slp93zplkd70zsahrvsp615vlcy2i8-fontconfig-2.14.0-lib/lib:/nix/store/970v1z9hdxby0s2dcj06ri1mxiyajj12-freetype-2.12.1/lib:/nix/store/m2w17l2v8lil49dskfkgzn3b1m1fszr9-libGL-1.6.0/lib:/nix/store/b6dyy0mxd4xhkkimlm0v8g0pbq0qpay5-libX11-1.8.3/lib:/nix/store/j5qck88fjfc32aghfxhsz41drkxswfi1-libXcursor-1.2.0/lib:/nix/store/vlry6bc6b8hiyg12cc4nr0726cz9gv3y-libXi-1.8/lib:/nix/store/25s737gk43a986fg8wq0j2n3z8751nbi-libXrandr-1.5.2/lib:/nix/store/3i6qbdsyyp0cc3fsf4v0xmlxjg06dss1-libXxf86vm-1.1.4/lib:/nix/store/g9wiz0czjlhippnyd3p6v10wvj9if4yy-libxcb-1.14/lib:/nix/store/yfvj8b1gq8wgqkhn7ag0nlcqd929akfk-libxkbcommon-1.5.0/lib:/nix/store/k0r8kbd579gmg4bq7mxhj3kiwz6i5vc0-wayland-1.21.0/lib]
 0x000000000000000c (INIT)               0x5f000
 0x000000000000000d (FINI)               0x49be94
 0x0000000000000019 (INIT_ARRAY)         0x5aad90
 0x000000000000001b (INIT_ARRAYSZ)       16 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x5aada0
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x0000000000000004 (HASH)               0x6e91c8
 0x000000006ffffef5 (GNU_HASH)           0xe10
 0x0000000000000005 (STRTAB)             0x6e8000
 0x0000000000000006 (SYMTAB)             0xe38
 0x000000000000000a (STRSZ)              4550 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x5e98d0
 0x0000000000000002 (PLTRELSZ)           24 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x5e288
 0x0000000000000007 (RELA)               0x3628
 0x0000000000000008 (RELASZ)             371808 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW PIE
 0x000000006ffffffe (VERNEED)            0x3468
 0x000000006fffffff (VERNEEDNUM)         3
 0x000000006ffffff0 (VERSYM)             0x329a
 0x000000006ffffff9 (RELACOUNT)          15266
 0x0000000000000000 (NULL)               0x0

Expected behavior

Alacritty should link to the libc in the nix store at runtime.

Notify maintainers

@Br1ght0ne @Mic92 @Ma27

Metadata

 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.0-19-amd64, Debian GNU/Linux, 11 (bullseye), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - channels(jade): `""`
 - channels(root): `"home-manager, nixpkgs, oldpkgs-18.09"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions