http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52223

             Bug #: 52223
           Summary: [4.5,4.6,4.7 regression] libffi's man page install
                    breaks with multilibs and overridden mandir
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libffi
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: mi...@it.uu.se


libffi installs three man pages during 'make install'.  If
a) the target has multilibs enabled, and
b) the configure-time --mandir= is overridden by make install with mandir=,
then libffi's man page install step in its multilib subdirs will ignore the
overridden mandir and use the configure-time mandir instead, which may clobber
an unexpected destination, or may cause the entire install to fail if that
destination isn't currently writable by the user.

The problem reproduces easily on x86_64-linux:
/path/to/gcc-4.7/configure --prefix=/usr --mandir=/usr/share/man
--enable-languages=c,c++,java --enable-multilib
make
# the following must be done as a regular user with no write access to
# /usr/share/man
make prefix=/tmp/buildroot/usr mandir=/tmp/buildroot/usr/share/man install
...
Making install in man
make[5]: Entering directory
`/tmp/objdir/x86_64-unknown-linux-gnu/32/libffi/man'
make[6]: Entering directory
`/tmp/objdir/x86_64-unknown-linux-gnu/32/libffi/man'
make[6]: Nothing to be done for `install-exec-am'.
test -z "/usr/share/man/man3" || /bin/mkdir -p "/usr/share/man/man3"
 /usr/bin/install -c -m 644 /tmp/gcc-4.7-20120211/libffi/man/ffi.3
/tmp/gcc-4.7-20120211/libffi/man/ffi_call.3
/tmp/gcc-4.7-20120211/libffi/man/ffi_prep_cif.3 '/usr/share/man/man3'
/usr/bin/install: cannot create regular file `/usr/share/man/man3/ffi.3':
Permission denied
/usr/bin/install: cannot create regular file `/usr/share/man/man3/ffi_call.3':
Permission denied
/usr/bin/install: cannot create regular file
`/usr/share/man/man3/ffi_prep_cif.3': Permission denied
make[6]: *** [install-man3] Error 1
make[6]: Leaving directory `/tmp/objdir/x86_64-unknown-linux-gnu/32/libffi/man'
make[5]: *** [install-am] Error 2
make[5]: Leaving directory `/tmp/objdir/x86_64-unknown-linux-gnu/32/libffi/man'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/tmp/objdir/x86_64-unknown-linux-gnu/32/libffi'
make[3]: *** [multi-do] Error 1
make[3]: Leaving directory `/tmp/objdir/x86_64-unknown-linux-gnu/libffi'
make[2]: *** [install-multi] Error 2
make[2]: Leaving directory `/tmp/objdir/x86_64-unknown-linux-gnu/libffi'
make[1]: *** [install-target-libffi] Error 2
make[1]: Leaving directory `/tmp/objdir'
make: *** [install] Error 2

If multilibs are disabled then the man-page install step does use the
overridden mandir=, but that clearly isn't a solution when multilibs are
essential.  I currently work around it by patching libffi's makefiles to delete
"man" from "SUBDIRS".

The problem is present in 4.5, 4.6, and 4.7, for (at least) x86_64-linux and
m68k-linux.  4.4 did not have those man pages or this problem.

The build procedure (configure with --prefix= and --mandir= pointing to system
directories, but make install with prefix= and mandir= pointing to a local
staging area) is taken verbatim from Fedora's gcc src rpm, so I'm assuming it's
something that should work.

Reply via email to