archiecobbs / s3backer

FUSE/NBD single file backing store via Amazon S3
Other
538 stars 77 forks source link

Building with NBD results in configured build prefix being ignored for nbdkit plugin #194

Closed kescherCode closed 2 years ago

kescherCode commented 2 years ago

I am currently attempting to build s3backer in NBD mode, for packaging purposes. I am running:

cd /tmp/s3backer-build/src/s3backer
mkdir -p m4
autoreconf -iv
./configure --prefix="/tmp/s3backer-build/pkg/s3backer/usr"
make
make install

Everything up to the make install command works just as expected. However, when make install is being run, the following happens:

make[1]: Entering directory '/tmp/s3backer-build/src/s3backer'
 /usr/bin/mkdir -p '/tmp/s3backer-build/pkg/s3backer/usr/bin'
 /usr/bin/mkdir -p '/tmp/s3backer-build/pkg/s3backer/usr/share/doc/packages/s3backer'
 /usr/bin/mkdir -p '/tmp/s3backer-build/pkg/s3backer/usr/share/man/man1'
 /usr/bin/mkdir -p '/usr/lib/nbdkit/plugins'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   nbdkit-s3backer-plugin.la '/usr/lib/nbdkit/plugins'
 /usr/bin/install -c -m 644 CHANGES COPYING README INSTALL TODO '/tmp/s3backer-build/pkg/s3backer/usr/share/doc/packages/s3backer'
  /bin/sh ./libtool   --mode=install /usr/bin/install -c s3backer '/tmp/s3backer-build/pkg/s3backer/usr/bin'
 /usr/bin/install -c -m 644 s3backer.1 '/tmp/s3backer-build/pkg/s3backer/usr/share/man/man1'
libtool: install: /usr/bin/install -c .libs/nbdkit-s3backer-plugin.so /usr/lib/nbdkit/plugins/nbdkit-s3backer-plugin.so
/usr/bin/install: cannot create regular file '/usr/lib/nbdkit/plugins/nbdkit-s3backer-plugin.so': Permission denied
make[1]: *** [Makefile:693: install-nbdpluginLTLIBRARIES] Error 1
make[1]: *** Waiting for unfinished jobs....
libtool: install: /usr/bin/install -c s3backer /tmp/s3backer-build/pkg/s3backer/usr/bin/s3backer
make[1]: Leaving directory '/tmp/s3backer-build/src/s3backer-git'
make: *** [Makefile:1600: install-am] Error 2

Expected

nbdkit-s3backer-plugin.so being installed into /tmp/s3backer-build/pkg/s3backer/usr/lib/nbdkit/plugins

Actual

nbdkit-s3backer-plugin.so being (attempted to be) installed directly into /usr/lib/nbdkit/plugins

archiecobbs commented 2 years ago

The intent here is that the NBDKit plugin should be installed into nbdkit's ${plugindir}, which is a variable defined by the nbdkit installation itself and made available to us via pkg-config:

$ pkg-config --variable=plugindir nbdkit
/usr/lib64/nbdkit/plugins

For most people, it doesn't make sense to install an nbdkit plugin somewhere else, so even a change to ${prefix} should not affect where the NBD plugin goes. (Note, if what you want is to install everything under some directory, use DESTDIR for that).

In any case, there's a way for you to override this, by overriding NBDKIT_PLUGINDIR on the command line:

$ ./configure NBDKIT_PLUGINDIR=/tmp/foobar
$ make -n install
...
list='nbdkit-s3backer-plugin.la'; test -n "/tmp/foobar" || list=; \
list2=; for p in $list; do \
  if test -f $p; then \
    list2="$list2 $p"; \
  else :; fi; \
done; \
test -z "$list2" || { \
  echo " /usr/bin/mkdir -p '/tmp/foobar'"; \
  /usr/bin/mkdir -p "/tmp/foobar" || exit 1; \
  echo " /bin/sh ./libtool   --mode=install /usr/bin/install -c  $list2 '/tmp/foobar'"; \
  /bin/sh ./libtool   --mode=install /usr/bin/install -c  $list2 "/tmp/foobar"; \
}
:

Let me know if the above makes sense. If not feel free to re-open this issue.

kescherCode commented 2 years ago

This does make sense, yes.