libtool bug

Charles Wilson cygwin@cwilson.fastmail.fm
Sun Oct 10 03:05:00 GMT 2004


Charles Wilson wrote:

> Whether to set the $PATH and produce wrapper scripts is clearly a 
> distinct issue from "should stuff be relinked on install" -- although on 
> platforms which encode -rpaths into sharedlibs and executables one issue 
> will affect the other.
> 
> Not true on cygwin.
> 
> These two questions (need wrappers to set PATH/LD_LIBRARY_PATH/etc, vs. 
> need to relink on install) should be disentangled.  On cygwin, we need 
> wrappers, but not relink.  On most OTHER platforms, you probably need 
> relink (but no wrappers?) IF using rpath; you need wrappers (and 
> relink?) if you are NOT using rpath.  Confusing, no?

The culprit is this little stanza in ltmain.m4sh:

***********************************
       if test "$need_relink" = no || test "$build_libtool_libs" != yes; 
then
         # Replace the output file specification.
         compile_command=`$ECHO "X$compile_command" | $Xsed -e 
's%@OUTPUT@%'"$output"'%g'`
         link_command="$compile_command$compile_rpath"

         # We have no uninstalled library dependencies, so finalize 
right now.
         $show "$link_command"
         $run eval "$link_command"
         status=$?

         # Delete the generated files.
         if test -f "$output_objdir/${outputname}S.${objext}"; then
           $show "$RM $output_objdir/${outputname}S.${objext}"
           $run $RM "$output_objdir/${outputname}S.${objext}"
         fi

         exit $status
       fi
***********************************

We finalize and bail out before creating the wrappers (and put the 
result into $output) simply because need_relink is no.  But on cygwin, 
at least, we still need the wrappers!  By manually removing this stanza 
from a prebuilt libtool (but leaving need_relink=no) the -make and -exec 
checks will pass.

e.g. something like the following will "fix it":  wrap the whole stanza 
inside a case statement:

   case $host in
   *cygwin* | *mingw* )
     ;; # don't bail out early on cygwin or mingw
   *)
     <put offending stanza here>
     ;;
   esac

but that just seems wrong somehow.  It's like we need another variable, 
whose meaning is something like "yeah, we don't need to relink, but we 
still need wrappers" -- but we may already have that variable, and just 
need to add it to the 'if' statement in the offending stanza.

Worse, the above change breaks the -inst.test, because with the change 
above we are now creating a wrapper script and wrapper executable for 
hell_static, which we certainly don't need to do.  And the wrapper 
script thus created -- for a STATIC executable -- has an empty 
$notinst_deplibs, which is as it should be, because it's static and 
doesn't care where the deplib came from; the exe "has it" built in.

But libtool checks to make sure that after sourcing the wrapper script, 
$notinst_deplib is non-empty, because the only reason to HAVE a wrapper 
script is if $notinst_deplib would have something in it.

Sheesh.

The attached patch (against libtool cvs branch 2.0) ain't pretty, but it 
works on cygwin and shouldn't break other platforms.

--
Chuck

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 6-csw-cygwin-do-not-relink.changelog
URL: <http://cygwin.com/pipermail/cygwin/attachments/20041010/974e705b/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 6-csw-cygwin-do-not-relink.patch
URL: <http://cygwin.com/pipermail/cygwin/attachments/20041010/974e705b/attachment-0001.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list