automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

install-pkglibLTLIBRARIES target is missing dep on install-libLTLIBRARIE


From: Jan Engelhardt
Subject: install-pkglibLTLIBRARIES target is missing dep on install-libLTLIBRARIES
Date: Sun, 29 Aug 2021 02:59:07 +0200 (CEST)
User-agent: Alpine 2.24 (LSU 510 2020-10-10)

Greetings.

Consider a Makefile.am like so:

        bin_PROGRAMS = aprogram
        sbin_PROGRAMS = otherprogram
        lib_LTLIBRARIES = library1.la
        pkglib_LTLIBRARIES = library2.la
        library2_la_LIBADD = library1.la

this will produce, under automake 1.15/1.16, a Makefile.in which has a
particular line:

        install-binPROGRAMS: install-libLTLIBRARIES

However, there is a _lack_ of any other relationships.
In particular,

        install-sbinPROGRAMS: install-libLTLIBRARIES
        install-pkglibLTLIBRARIES: install-libLTLIBRARIES

is absent. As a result, `make install -j` can end up in a situation
where it tried to install something before library1.la has been
installed.

Executing install-pkglibLTLIBRARIES (though somewhat an "internal"
target) directly is sufficient to showcase the issue.

$ make install-pkglibLTLIBRARIES DESTDIR=$PWD/rt 
 /usr/bin/mkdir -p '/home/linux/rt/usr/local/lib/test'
 /bin/sh ./libtool   --mode=install /usr/bin/install -c   library2.la 
'/home/linux/rt/usr/local/lib/test'
libtool: warning: relinking 'library2.la'
libtool: install: (cd /home/linux; /bin/sh "/home/linux/libtool"  --silent 
--tag CC --mode=relink gcc -g -O2 -o library2.la -rpath /usr/local/lib/test 
library2.lo library1.la -inst-prefix-dir /home/linux/rt)
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot 
find -lrary1
collect2: error: ld returned 1 exit status
libtool:   error: error: relink 'library2.la' with the above command before 
installing it
make: *** [Makefile:453: install-pkglibLTLIBRARIES] Error 1

(The testcase is temporarily uploaded to https://github.com/jengelh/am-test )

The install-binPROGRAMS line comes from bin/automake.in here:

  # FIXME: Gross!                                                               
                                                         
  if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS'))                          
                                                         
    {                                                                           
                                                         
      $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";       
                                                         
    }                                                                           
                                                         
  if (var ('nobase_lib_LTLIBRARIES') && var ('bin_PROGRAMS'))                   
                                                         
    {                                                                           
                                                         
      $output_rules .= "install-binPROGRAMS: 
install-nobase_libLTLIBRARIES\n\n";                                             
            
    }                                                                           
                                                         

Barring the use of complete deps on ${DESTDIR} objects, I think that 
this gross hack needs extending of all install-* targets to gain a dep 
on install-libLTLIBRARIES.

[ Ideally, Makefile could contain

install-pkglibLTLIBRARIES: ${DESTDIR}${libdir}/library1.la
${DESTDIR}${libdir}/library1.la:
        libtool relink .....

but I figure this may be much more work than extending install-*; and 
it may turn out not be portable. ]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]