Skip to content

maximum file size exceeded on a library #222

Closed

Description

@nagisa

Describe the bug

Running patchelf --set-rpath on a certain nvidia binary library will make patchelf output maximum file size exceeded.

Steps To Reproduce

patchelf --set-rpath '$ORIGIN' libcudnn_etc.so.8.0.0
maximum file size exceeded

The attached library has been xz-compressed, and its filename changed to fit github's filename requirements.
libcudnn_etc.so.8.0.0.gz

Decompress with

mv libcudnn_etc.so.8.0.0.gz libcudnn_etc.so.8.0.0.xz
xz -d libcudnn_etc.so.8.0.0.xz

Expected behavior

I expected patchelf to just work.

patchelf --version output

patchelf 0.9 and patchelf 0.10 (both as packaged in NixOS)

Additional context

The library is aarch64 one.

Activity

  1. domenkozar commented on Jul 2, 2020

    @domenkozar
    Member

    Could you try with master branch?

  2. nagisa commented on Aug 5, 2020

    @nagisa
    Author

    Reproducible with master:

    $ nix shell --experimental-features 'nix-command flakes' github:NixOS/patchelf -c patchelf --set-rpath '$ORIGIN' libcudnn_etc.so
    patchelf: maximum file size exceeded
    
  3. matthewbauer commented on Aug 18, 2020

    @matthewbauer
    Member

    I'm seeing a similar thing, this time with x86_64 on libcudnn_cnn_infer.so.8.0.2 in NixOS/nixpkgs#95727.

  4. domenkozar commented on Aug 28, 2020

    @domenkozar
    Member

    Duplicates #62 and #88

    For aarch64 this was fixed in 0.12

  5. tobiasBora commented on Oct 19, 2020

    @tobiasBora

    @matthewbauer Did you manage to solve the issue? I have exactly the same problem on libcudnn_cnn_infer.so.8 trying to write a derivation for DaVinci Resolve. For reference, I using this derivation:

    { stdenv, mkDerivation, unzip, autoPatchelfHook, wrapQtAppsHook, libarchive, gtk2, qtbase, gstreamer, libpng12, ocl-icd, openssl, opencl-headers, alsaLib, libXtst, libXdamage, libGLU, gnome3, libXxf86vm,
      cudatoolkit, addOpenGLRunpath }:
    
    mkDerivation rec {
      version = "16.2.7";
      name = "DaVinci_Resolve_${version}";
    
      src = ./DaVinci_Resolve_16.2.7_Linux.zip;
    
      unpackPhase = ''
        unzip $src
        # Folder to extract the .run ISO image to
        mkdir extracted
        # bsdtar comes from libarchive
        bsdtar x -f DaVinci_Resolve_${version}_Linux.run -C extracted
        export sourceRoot=extracted
      '';
    
      
      nativeBuildInputs = [
        unzip
        libarchive # to get bsdtar
        autoPatchelfHook # Will through errors if a lib can't be find, then use nix-locate -1 libasound.so.2 for example to get the name of the lib to include
        wrapQtAppsHook # To wrap Qt apps
        addOpenGLRunpath
      ];
    
      buildInputs = [
        alsaLib
        gtk2
        gstreamer
        libpng12
        ocl-icd
        openssl
        qtbase
        alsaLib
        libXtst
        libXdamage
        libGLU
        cudatoolkit
        gnome3.librsvg
        libXxf86vm
      ];
      
     
      installPhase= ''
        mkdir -p $out
        cp -r * $out
      '';
    
      # Make sure the build does not fail on missing `libcuda.so.1` as it's provided at runtime.
      # Not sure if there is a better option...
      autoPatchelfIgnoreMissingDeps = false;
    
      # Seems to be the method used by blender & co to provide libcuda.so.1 at runtime
      postFixup = ''
        for program in $out/bin/*; do
          isELF "$program" || continue
          addOpenGLRunpath "$program"
        done
      '';
    
      meta = {
        description = "DaVinci Resolve";
        homepage = https://;
        license = stdenv.lib.licenses.unfree;
        maintainers = [ stdenv.lib.maintainers.tobiasBora ];
        platforms = stdenv.lib.platforms.linux;
      };
    }
    

    and build with:

    nix-build -E "let pkgs = import <nixpkgs> {}; in pkgs.libsForQt5.callPackage ./derivation.nix {}"
    
  6. mkolod commented on Oct 21, 2020

    @mkolod

    I'm getting the same issue, also with the same library, with x86_64 on patchelf master as of today (last commit: 47dc18d0e5c1ff24f815177927940c294b1fde76).

  7. mkolod commented on Oct 21, 2020

    @mkolod

    The fix is to change 32 to 64 here and then rebuild patchelf. Tried on 47dc18d0e5c1ff24f815177927940c294b1fde76.

  8. tfmoraes commented on Feb 12, 2021

    @tfmoraes

    @tobiasBora have you managed to fix this problem with Davinci Resolve?

  9. tobiasBora commented on Feb 13, 2021

    @tobiasBora
  10. tfmoraes commented on Feb 14, 2021

    @tfmoraes

    I managed to create a Davinci Resolve derivation. I posted it here @tobiasBora.

  11. tdp2110 commented on Apr 21, 2021

    @tdp2110

    (Also hit this issue on cudnn libs today) I'm a bit confused by the code referenced @mkolod referenced here. There are simpler ways to read files in C++ which don't involve the read, open syscalls, or pre-reserving a buffer. Maybe I'll submit a patch and see what the maintainers think.

  12. jue89 commented on Jun 15, 2021

    @jue89

    I just hit the same error message ... for details see: NixOS/nixpkgs#94032 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions