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

doc/manual/local.mk: use local src/nix/nix instead of /usr/bin/nix #5185

Closed
wants to merge 1 commit into from
Closed

doc/manual/local.mk: use local src/nix/nix instead of /usr/bin/nix #5185

wants to merge 1 commit into from

Conversation

trofi
Copy link
Contributor

@trofi trofi commented Aug 28, 2021

Build failure happens when one tries to build nix on a linux
system as user with later plan to install as root (typical package
building separation):

$ cd /tmp
$ git clone https://github.com/NixOS/nix.git
$ cd nix
$ ./bootstrap.sh
$ ./configure --prefix=/usr ac_cv_header_aws_s3_S3Client_h=no
$ make
...
$ LANG=C make
  LD     /usr/lib/libnixutil.so
/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot open output file /usr/lib/libnixutil.so: Permission denied
collect2: error: ld returned 1 exit status
make: *** [mk/lib.mk:117: /usr/lib/libnixutil.so] Error 1

Build failure happens because doc/manual/nix.json depends
on installed $(bindir) path instead of local inplace path:

$ make -r -d doc/manual/nix.json
...
Considering target file 'doc/manual/nix.json'.
 File 'doc/manual/nix.json' does not exist.
  Considering target file '/usr/bin/nix'.
    Considering target file 'src/build-remote/build-remote.o'.
     Looking for an implicit rule for 'src/build-remote/build-remote.o'.
...
doc/manual/local.mk:$(d)/nix.json: $(bindir)/nix

The fix is to always use inplace built src/nix/nix binary.

Closes: #5184

Build failure happens when one tries to build `nix` on a linux
system as user with later plan to install as root (typical package
building separation):

```
$ cd /tmp
$ git clone https://github.com/NixOS/nix.git
$ cd nix
$ ./bootstrap.sh
$ ./configure --prefix=/usr ac_cv_header_aws_s3_S3Client_h=no
$ make
...
$ LANG=C make
  LD     /usr/lib/libnixutil.so
/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot open output file /usr/lib/libnixutil.so: Permission denied
collect2: error: ld returned 1 exit status
make: *** [mk/lib.mk:117: /usr/lib/libnixutil.so] Error 1
```

Build failure happens because `doc/manual/nix.json` depends
on installed `$(bindir)` path instead of local inplace path:

```
$ make -r -d doc/manual/nix.json
...
Considering target file 'doc/manual/nix.json'.
 File 'doc/manual/nix.json' does not exist.
  Considering target file '/usr/bin/nix'.
    Considering target file 'src/build-remote/build-remote.o'.
     Looking for an implicit rule for 'src/build-remote/build-remote.o'.
...
doc/manual/local.mk:$(d)/nix.json: $(bindir)/nix
```

The fix is to always use inplace built `src/nix/nix` binary.

Closes: #5184
@edolstra
Copy link
Member

Maybe we should get rid of the default make target, since make install is really the only properly supported way to build.

@edolstra
Copy link
Member

Closing this one in favor of #5145.

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