[Nix-dev] PatchELF in Bundix's postBuild step
Maarten Hoogendoorn
maarten at moretea.nl
Thu Dec 1 21:51:26 CET 2016
OK, I found a solution after taking a longer look at the bundlerEnv
implementation.
Each gem is packaged as a separate derivation (which makes complete sense).
BundlerEnv offers the `gemConfig', in which one can set another postInstall
step.
In my case, the following snippet works:
with pkgs; (bundlerEnv {
name ="ruby-protoc-v3";
inherit ruby;
gemfile= ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
gemConfig = {
grpc-tools = attr: {
postInstall= ''
for file in $(find
$out/lib/ruby/gems/2.3.0/gems/grpc-tools-1.0.1/bin/x86_64-linux -type f
-executable ); do
patchelf --set-interpreter
${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $file
done
'';
};
};
})
I think that I got confused by the fact that I did not see any symlinks
during my investigation. I must have missed that somewhere.
- Maarten
2016-12-01 21:24 GMT+01:00 Maarten Hoogendoorn <maarten at moretea.nl>:
> Hi,
>
> I'm trying to build a gem that has vendored a statically compiled program
> (that still depends on /lib64/ld-linux-x86-64.so.2).
>
> I've tried to use patchelf in the postBuild in a bundlerEnv, but it's
> complaining about not having write permissions to $out
>
> I wrote a one-liner to check for .nix files that contained both the words
> bundlerEnv and patchelf, but only the top-level/all-packages.nix matched
> both.
>
> I tried to create another derivation, that pulls all file in from the
> bundlerEnv, and then patches the elf file, but it's resulting in the same
> error message.
>
> A nix-expression that reproduces this error is attached.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20161201/2bd0f30b/attachment.html>
More information about the nix-dev
mailing list