Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autogen fail to build outside /nix/store #106165

Closed
siscia opened this issue Dec 7, 2020 · 9 comments
Closed

autogen fail to build outside /nix/store #106165

siscia opened this issue Dec 7, 2020 · 9 comments

Comments

@siscia
Copy link
Contributor

siscia commented Dec 7, 2020

Describe the bug

Autogen fail to build outside nix path

$ nix-env -i autogen
...
Patching '/cvmfs/packages.redbeardlab.com/nix/store/psvm50hlmb7gprgy3ipadz1hi59nhvxc-autogen-5.18.16-dev/lib/pkgconfig/autoopts.pc' includedir to output /cvmfs/packages.redbeardlab.com/nix/store/psvm50hlm
b7gprgy3ipadz1hi59nhvxc-autogen-5.18.16-dev                                                                                                                                                                 
shrinking RPATHs of ELF executables and libraries in /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin                                                         
shrinking /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/getdefs                                                                                        
shrinking /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/autogen                                                                                        
shrinking /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/columns                                                                                        
shrinking /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/xml2ag                                                                                         
strip is /cvmfs/packages.redbeardlab.com/nix/store/xvpr5zwjghs68zyysd9b3maz0bqpxm0r-binutils-2.31.1/bin/strip                                                                                               
stripping (with command strip and flags -S) in /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin                                                           
patching script interpreter paths in /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin                                                                         
checking for references to /tmp/nix-build-autogen-5.18.16.drv-0/ in /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin...                                       
RPATH of binary /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/getdefs contains a forbidden reference to /tmp/nix-build-autogen-5.18.16.drv-0/          
builder for '/cvmfs/packages.redbeardlab.com/nix/store/z9gn53dfd5xl6ixh2x8iafj46gjzmsr4-autogen-5.18.16.drv' failed with exit code 1                                                                        
@herostrat
Copy link

Could this be a similar problem?

Patching '/nix/store/17jb64wlx1cswhabby658fbr67y0mpkl-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-dev/lib/pkgconfig/autoopts.pc' includedir to output /nix/store/17jb64wlx1cswhabby658fbr67y0mpkl-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-dev
shrinking RPATHs of ELF executables and libraries in /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin
shrinking /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin/bin/columns
shrinking /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin/bin/getdefs
shrinking /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin/bin/xml2ag
shrinking /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin/bin/autogen
armv7l-unknown-linux-gnueabihf-strip is /nix/store/77lzki7dadfgprrzx9f8rc2v9bbsa5hy-armv7l-unknown-linux-gnueabihf-binutils-2.31.1/bin/armv7l-unknown-linux-gnueabihf-strip
stripping (with command armv7l-unknown-linux-gnueabihf-strip and flags -S) in /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin/bin 
patching script interpreter paths in /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin
checking for references to /tmp/nix-build-autogen-5.18.16-armv7l-unknown-linux-gnueabihf.drv-0/ in /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin...
RPATH of binary /nix/store/m5czba271bq53qq6imi9x5rfly6wp0gi-autogen-5.18.16-armv7l-unknown-linux-gnueabihf-bin/bin/columns contains a forbidden reference to /tmp/nix-build-autogen-5.18.16-armv7l-unknown-linux-gnueabihf.drv-0/
builder for '/nix/store/zlpcx5bj9ph7jhv863kahsx4zafq8p15-autogen-5.18.16-armv7l-unknown-linux-gnueabihf.drv' failed with exit code 1

@siscia
Copy link
Contributor Author

siscia commented Dec 8, 2020

it seems exactly the same problem.

It was a problem about the RPATH contaings a path to /tmp/build.../.libs if I recal correctly. In my investigation it was libopts.so fault.

Can you confirm as well?

@herostrat
Copy link

This is my first contact Nix, so I have honestly no idea.
How could I confirm or fix it?

In the logs at least I cannot find a reference to libopts.so

@siscia
Copy link
Contributor Author

siscia commented Dec 12, 2020

Ok, I got around the issue with a simple overlay.

Either I am missing something or the recipe is somehow shallow.

In order to fix the issue I have created a file in ~/.config/nixpkgs/overlays/redbeardlab.nix with this content:

self: super: {
        autogen = super.autogen.overrideAttrs ( old: {
                postInstall = old.postInstall + ''
                        for f in "$bin"/bin/*; do
                                local nrp="$(patchelf --print-rpath "$f" | sed -E 's@(:|^)'$TEMP'[^:]*:@\1@g')"
                                patchelf --set-rpath "$nrp" "$f"
                        done
                '';
        });
}

For me we can close, I will make a PR to the channel.

@FRidh
Copy link
Member

FRidh commented Dec 12, 2020

Describe the bug

Autogen fail to build outside nix path

$ nix-env -i autogen
...
Patching '/cvmfs/packages.redbeardlab.com/nix/store/psvm50hlmb7gprgy3ipadz1hi59nhvxc-autogen-5.18.16-dev/lib/pkgconfig/autoopts.pc' includedir to output /cvmfs/packages.redbeardlab.com/nix/store/psvm50hlm
b7gprgy3ipadz1hi59nhvxc-autogen-5.18.16-dev                                                                                                                                                                 
shrinking RPATHs of ELF executables and libraries in /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin                                                         
shrinking /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/getdefs                                                                                        
shrinking /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/autogen                                                                                        
shrinking /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/columns                                                                                        
shrinking /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/xml2ag                                                                                         
strip is /cvmfs/packages.redbeardlab.com/nix/store/xvpr5zwjghs68zyysd9b3maz0bqpxm0r-binutils-2.31.1/bin/strip                                                                                               
stripping (with command strip and flags -S) in /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin                                                           
patching script interpreter paths in /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin                                                                         
checking for references to /tmp/nix-build-autogen-5.18.16.drv-0/ in /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin...                                       
RPATH of binary /cvmfs/packages.redbeardlab.com/nix/store/mqv6dqyacvmvp9jkfx4aynzas139ckiz-autogen-5.18.16-bin/bin/getdefs contains a forbidden reference to /tmp/nix-build-autogen-5.18.16.drv-0/          
builder for '/cvmfs/packages.redbeardlab.com/nix/store/z9gn53dfd5xl6ixh2x8iafj46gjzmsr4-autogen-5.18.16.drv' failed with exit code 1                                                                        

Avoid using nix-env -i, use nix-env -iA autogen instead.

autogen builds fine as far as I can tell. If you open an issue, use the template to describe which nixpkgs you're using.

Closing this as invalid.

@FRidh FRidh closed this as completed Dec 12, 2020
@siscia
Copy link
Contributor Author

siscia commented Dec 12, 2020

No, unfortunately two different people report a problem.

Either there is a problem in the documentation or there is a problem in the recipe.

The PR above seems to fix the problem, is that invalid as well?

@ztzg
Copy link
Contributor

ztzg commented Dec 22, 2020

@FRidh: I can confirm that I see the problem when building outside of the sandbox on RHEL. @siscia's PR #106758 works for me and looks correct.

@r-burns
Copy link
Contributor

r-burns commented Jun 9, 2021

I can reproduce this error on an unprivileged (i.e. no daemon) Nix installation by disabling the sandbox.

nix-build '<nixpkgs>' -A autogen --option sandbox false
checking for references to /tmp/nix-build-autogen-5.18.16.drv-0/ in /nix/store/0b0g70bdlkv86nsz49wa73ikyjf00c7m-autogen-5.18.16-bin...
RPATH of binary /nix/store/0b0g70bdlkv86nsz49wa73ikyjf00c7m-autogen-5.18.16-bin/bin/autogen contains a forbidden reference to /tmp/nix-build-autogen-5.18.16.drv-0/
builder for '/nix/store/59l8kb8mxrzjqff4x0r5z4sxscj7psj4-autogen-5.18.16.drv' failed with exit code 1
error: build of '/nix/store/59l8kb8mxrzjqff4x0r5z4sxscj7psj4-autogen-5.18.16.drv' failed

It seems to me that this is because the sandboxed build uses /build as the build directory, which is hardcoded in the package's rpath removal sed command. However, unsandboxed builds happen in /tmp/nix-build-* which is not matched by the sed command.

@Artturin
Copy link
Member

fixed in #126557

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

No branches or pull requests

7 participants