Hello, I've recently noticed that libtool (2.4, as included in Cygwin 1.7) could decide to create a static library instead of a shared one it was asked to create if it couldn't do the latter. Here is an example of a message where libtool explains why it does it itself:
... during libxml2 make ... /bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -lws2_32 -o libxml2.la -no-undefined -version-info 8:26:6 SAX.lo entities.lo encoding.lo error.lo parserInternals.lo parser.lo tree.lo hash.lo list.lo xmlIO.lo xmlmemory.lo uri.lo valid.lo xlink.lo HTMLparser.lo HTMLtree.lo debugXML.lo xpath.lo xpointer.lo xinclude.l o nanohttp.lo nanoftp.lo DOCBparser.lo catalog.lo globals.lo threads.lo c14n.lo xmlstring.lo xmlregexp.lo xmlschemas.lo xmlschemasty pes.lo xmlunicode.lo xmlreader.lo relaxng.lo dict.lo SAX2.lo xmlwriter.lo legacy.lo chvalid.lo pattern.lo xmlsave.lo xmlmodule.lo sc hematron.lo -lws2_32 *** Warning: linker path does not have real file for library -lws2_32. *** I have the capability to make that library automatically link in when *** you link to this library. But I can only do this if you have a *** shared version of the library, which you do not appear to have *** because I did check the linker path looking for a file starting *** with libws2_32 but no candidates were found. (...for file magic test) *** The inter-library dependencies that have been dropped here will be *** automatically added whenever a program is linked with this library *** or is declared to -dlopen it. *** Since this library must not contain undefined symbols, *** because either the platform does not support them or *** it was explicitly requested with -no-undefined, *** libtool will only create a static version of it. The real problem here was the missing -L option for libtool to find Winsock library but the trouble is that it was really difficult to notice. You might think that a big bold warning like above would stand out well enough but the fact is that my full build log is ~10000 lines and so I completely missed it initially. What I saw instead was an error much further down as nothing using libxml2 could be linked because under Windows the static libraries can't be used to replace the shared ones because they define different functions (_foo vs _imp__foo). So IMO creating a static library when libtool was requested to build a DLL is never the right thing to do under Windows. And while I hesitate to call this behaviour a bug because it is clearly intentional, I'd like to see it changed because it would have saved me (and presumably others) a lot of time if libtool simply stopped with an error after giving the above message instead of valiantly but ultimately counterproductively trying to continue. So what do you think about changing this? Should I look into making a patch with the proposed change? Thanks, VZ
pgp931gyo0zry.pgp
Description: PGP signature
_______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool