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

Some of the targets are installed into $(prefix) during the build phase #5140

Closed
pszubiak opened this issue Aug 16, 2021 · 3 comments · Fixed by #5145
Closed

Some of the targets are installed into $(prefix) during the build phase #5140

pszubiak opened this issue Aug 16, 2021 · 3 comments · Fixed by #5145

Comments

@pszubiak
Copy link
Contributor

Describe the bug

Some targets are installed into $(prefix) during the build phase

While building Nix from the master branch, some targets like libnixutil.so are installed into $(prefix) during the build phase. If the build user doesn't have permission to write into $(prefix) the build fails.

It doesn't happen on the 2.3-maintenance branch, or if the build is configured with the --disable-doc-gen option on the master branch.

Steps To Reproduce

  1. Checkout Nix master branch
  2. ./bootstrap.sh
  3. ./configure --prefix=/usr
  4. make
  GEN    Makefile.config
  GEN    src/libexpr/parser-tab.cc
  GEN    src/libexpr/lexer-tab.cc
  CXX    src/build-remote/build-remote.o
  CXX    src/nix-build/nix-build.o
  CXX    src/nix-channel/nix-channel.o
  CXX    src/nix-collect-garbage/nix-collect-garbage.o
  CXX    src/nix-copy-closure/nix-copy-closure.o
  ...
  CXX    src/libutil/util.o
  CXX    src/libutil/xml-writer.o
  LD     /usr/lib64/libnixutil.so
/opt/rh/gcc-toolset-9/root/usr/bin/ld: cannot open output file /usr/lib64/libnixutil.so: Permission denied
collect2: error: ld returned 1 exit status
make: *** [mk/lib.mk:117: /usr/lib64/libnixutil.so] Error 1

Expected behavior

Targets aren't installed $(prefix) during the build

@pszubiak pszubiak added the bug label Aug 16, 2021
@fedepell
Copy link
Contributor

fedepell commented Aug 16, 2021

My feeling is that in doc/manual/local.mk many targets depend on $(bindir)/nix, but $(bindir)/nix points to the installed one (ie. /usr/bin/nix) which then triggers also all the installation of libraries (as per your case).

They should instead point to the one in the build directory (so src/nix/nix or a non hardcoded one) I believe. (and if you change all occourences of $(bindir)/nix to src/nix/nix in doc/manual/local.mk it compiles nicely, but maybe "harcoding" src/nix/nix is ugly and there is a better way to express that dependency)

@fedepell
Copy link
Contributor

nix-5140-diff.txt

fedepell added a commit to fedepell/nix that referenced this issue Aug 17, 2021
Previously many of the documentation targets were depending on
$(bindir)/nix which is the installed version. This meant that its
install rules would be triggered (which in chain would also trigger
the install of libraries, as reported in NixOS#5140). Therefore a build
of the documentation without an installation would not be possible
(which apart from doing unwanted operations it may also generate
permission problems for example).
The fix makes the rules depend on $(nix_DIR)/nix instead, which is
the executable in the build tree.
@stale
Copy link

stale bot commented Apr 17, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Apr 17, 2022
Ericson2314 pushed a commit that referenced this issue Nov 30, 2023
Previously many of the documentation targets were depending on
`$(bindir)/nix` which is the installed version. This meant that its
install rules would be triggered (which in chain would also trigger the
install of libraries, as reported in #5140). Therefore a build of the
documentation without an installation would not be possible (which apart
from doing unwanted operations it may also generate permission problems
for example).

The fix makes the rules depend on `$(nix_PATH)` instead, which is the
executable in the build tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants