Skip to content

Segmentation fault when patching libcudart.so.10.2.89 #313

@OmnipotentEntity

Description

@OmnipotentEntity

Describe the bug

When attempting to build a specific version of CUDA, patchelf segfaults.

patching /nix/store/8zma96haw8rg2nhhkh0dczh0afwnrj96-cudatoolkit-10.2.89/libnvvp/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140603-1326/eclipse_1605.so...
patching /nix/store/8zma96haw8rg2nhhkh0dczh0afwnrj96-cudatoolkit-10.2.89/libnvvp/nvvp...
patching /nix/store/pp08fkvf8l60kvcm77wav88pvnkarv81-cudatoolkit-10.2.89-lib/lib/libcudart.so.10.2.89...
/nix/store/f7g5w1gnybmqqaf2ch2ynba1grlayxxf-stdenv-linux/setup: line 100:   523 Segmentation fault      (core dumped) patchelf --set-rpath "$rpath2" --force-rpath $i
builder for '/nix/store/753pmghiqppd12sdj9ql0r381zlvr2ms-cudatoolkit-10.2.89.drv' failed with exit code 139

Steps To Reproduce

Because CUDA takes forever to rebuild, I haven't had an opportunity able to pare down a minimal reproduction. I've uploaded a copy of the offending .so file. And here is the shell.nix file I used to trigger it:

with import "/home/omnipotententity/work/nixpkgs" {};

stdenv.mkDerivation {
  name = "pip-env";
  buildInputs = [
    # System requirements.
    readline
    SDL2
    SDL2_gfx
    SDL2_image
    SDL2_mixer
    SDL2_net
    SDL2_ttf
    xorg.libX11
    xorg.libXext
    xorg.libXrender
    stdenv.cc.cc.lib
    mtdev
    libGL

    # Python requirements (enough to get a virtualenv going).
    python3Full
    python3Packages.virtualenv
    python3Packages.pip

    katagoWithCuda
  ];

  propagatedBuildInputs = [
    python3Packages.setuptools
    xclip
  ];

  src = null;
  shellHook = ''
    # Allow the use of wheels.
    SOURCE_DATE_EPOCH=$(date +%s)

    # Augment the dynamic linker path
    export LD_LIBRARY_PATH=''${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${readline}/lib:/run/opengl-driver/lib:/run/opengl-driver-32/lib:${SDL2}/lib:${SDL2_gfx}/lib:${SDL2_image}/lib:${SDL2_mixer}/lib:${SDL2_net}/lib:${SDL2_ttf}/lib:${xorg.libX11}/lib:${xorg.libXext}/lib:${stdenv.cc.cc.lib}/lib:${mtdev}/lib:${libGL}/lib:${xorg.libXrender}/lib
  '';
}

It should be noted that the import is specifically referring my local copy of the current HEAD of nixpkgs staging. e32bf6f

Expected behavior

Should never segfault.

patchelf --version output

patchelf 0.13.20210805.a949ff2

Additional context

I do not know enough about nixos internals to know exactly what command arguments are being used, though I did make an attempt to figure it out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions