Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <4168A48E.8070303@cwilson.fastmail.fm> Date: Sat, 09 Oct 2004 22:55:10 -0400 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616 MultiZilla/1.6.4.0b MIME-Version: 1.0 To: cygwin AT cygwin DOT com Cc: Libtool Patches Subject: Re: libtool bug References: <16741 DOT 49587 DOT 333388 DOT 685699 AT byrd DOT xs4all DOT nl> <1968842951 DOT 20041008015659 AT familiehaase DOT de> <41662639 DOT 3030306 AT cwilson DOT fastmail DOT fm> <87d5zt4r3g DOT fsf AT peder DOT flower> <657467259 DOT 20041008123554 AT familiehaase DOT de> <41671F91 DOT 8020508 AT cwilson DOT fastmail DOT fm> <41687EAA DOT 3080100 AT cwilson DOT fastmail DOT fm> In-Reply-To: <41687EAA.3080100@cwilson.fastmail.fm> Content-Type: multipart/mixed; boundary="------------020004040903070003030403" --------------020004040903070003030403 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 *) ;; 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 --------------020004040903070003030403 Content-Type: text/plain; name="6-csw-cygwin-do-not-relink.changelog" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="6-csw-cygwin-do-not-relink.changelog" 2004-10-09 Charles Wilson * config/ltmain.m4sh (func_mode_link): don't relink on cygwin/mingw; no need. But do ensure that wrappers are created unless doing a purely static build. --------------020004040903070003030403 Content-Type: text/plain; name="6-csw-cygwin-do-not-relink.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="6-csw-cygwin-do-not-relink.patch" Index: ltmain.m4sh =================================================================== RCS file: /cvsroot/libtool/libtool/config/ltmain.m4sh,v retrieving revision 1.1.2.4 diff -u -r1.1.2.4 ltmain.m4sh --- ltmain.m4sh 8 Oct 2004 16:17:40 -0000 1.1.2.4 +++ ltmain.m4sh 10 Oct 2004 02:10:40 -0000 @@ -3539,10 +3539,19 @@ link_static=no # Whether the deplib will be linked statically if test -n "$library_names" && { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi + case $host in + *cygwin* | *mingw*) + # No point in relinking DLLs because paths are not encoded + notinst_deplibs="$notinst_deplibs $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + ;; + esac # This is a shared library # Warn about portability, can't link against -module's on some @@ -5427,7 +5436,21 @@ func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + + wrappers_required=yes + case $host in + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" --------------020004040903070003030403 Content-Type: text/plain; charset=us-ascii -- 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/ --------------020004040903070003030403--