Skip to content

Commit

Permalink
ue4: add autoPatchelfHook
Browse files Browse the repository at this point in the history
  • Loading branch information
yvt committed May 1, 2021
1 parent cf734a3 commit 49be2c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkgs/games/ue4/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib, stdenv, writeScript, fetchurl, requireFile, unzip, clang_10, lld_10, mono, which,
xorg, xdg-user-dirs, vulkan-loader, libpulseaudio, udev, libGL }:
xorg, xdg-user-dirs, vulkan-loader, libpulseaudio, udev, libGL, autoPatchelfHook }:

let
deps = import ./cdn-deps.nix { inherit fetchurl; };
Expand Down Expand Up @@ -97,6 +97,8 @@ stdenv.mkDerivation rec {
'';
buildInputs = [ clang_10 lld_10 mono which xdg-user-dirs ];

nativeBuildInputs = [ autoPatchelfHook ];

# Disable FORTIFY_SOURCE or `SharedPCH.UnrealEd.NonOptimized.ShadowErrors.h` fails to compile
hardeningDisable = [ "fortify" ];

Expand Down

1 comment on commit 49be2c8

@cf4f67
Copy link

@cf4f67 cf4f67 commented on 49be2c8 Apr 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following results when trying to build your commit with a recent nixpkgs,

...
Command '[
  'patchelf',
  '--set-interpreter',
  '/nix/store/q29bwjibv9gi9n86203s38n0577w09sx-glibc-2.33-117/lib/ld-linux-x86-64.so.2',
  '/nix/store/3jp4f6qk47zphayankydb1b12w231sz2-ue4-4.26.2/share/UnrealEngine/Engine/Binaries/Linux/UnrealVersionSelector-Linux-Shipping.debug'
]' died with <Signals.SIGABRT: 6>.

Commands such as file and readelf -l shows no/empty interpreter, e.g.

$ file UnrealVersionSelector-Linux-Shipping.debug 
UnrealVersionSelector-Linux-Shipping.debug: ELF 64-bit LSB executable, x86-64, version 1
(SYSV), dynamically linked, interpreter *empty*, for GNU/Linux 3.4.1, BuildID[xxHash]=
3e490811485d5203, with debug_info, not stripped

E.g. patchelf on a copy of the binary,

$ patchelf --set-interpreter /path-to/ld-linux-x86-64.so.2 UnrealVersionSelector-Linux-Shipping.debug
patchelf: patchelf.cc:912: void ElfFile<Elf_Ehdr, Elf_Phdr, Elf_Shdr, Elf_Addr, Elf_Off, Elf_Dyn, Elf_Sym, Elf_Verneed, Elf_Versym>::rewriteSectionsExecutable() [with Elf_Ehdr = Elf64_Ehdr; Elf_Phdr = Elf64_Phdr; Elf_Shdr = Elf64_Shdr; Elf_Addr = long unsigned int; Elf_Off = long unsigned int; Elf_Dyn = Elf64_Dyn; Elf_Sym = Elf64_Sym; Elf_Verneed = Elf64_Verneed; Elf_Versym = short unsigned int]: Assertion `startAddr % getPageSize() == startOffset % getPageSize()' failed.
Aborted (core dumped)

Please sign in to comment.