This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [avail for test] libtool-devel-20030121-1


I've updated libtool-devel to the 20030121 CVS, plus added a major 
change of my own (inspired by Earnie Boyd and others on the libtool 
mailing list) that "fixes" the 'relink exe's over and over and over' 
problem on both mingw and cygwin.

[Skip to the last two paragraphs for the real important part]

A (not-so-short) description of the problem and the solution approach 
taken: if you have a package that builds a shared library (.dll) AND an 
exe which relies on that library, then libtool puts the actual 
executable into a .lib/ subdirectory under your current build directory, 
and NOT in the build directory itself.

This is also done on "real" unix platforms.  The reason is that 
uninstalled shared libraries cannot easily be found by the runtime 
loader on most platforms, unix and cygwin/windows included.

So, in order to run the uninstalled executable, you must first set the 
environment appropriately so that the shared library (.dll) will be 
found.  This means setting LD_LIBRARY_PATH on some unices, or setting 
PATH on cygwin so that the Windows Runtime Loader will find the .dll.

libtool does this by creating a shell script in the actual build 
directory.  The shell script sets the variables and then exec's 
./lib/my-real-executable.

If your application is "foo", this works fine on unix.  The makefile 
wants to see 'foo' -- and it does; only the 'foo' that make sees is 
actually a shell script:

   <builddir>/foo       : a shell script
   <builddir>/.lib/foo  : the real executable

And it only gets built once.  However, on cygwin/windows, you have
   <builddir>/foo           : a shell script
   <builddir>/.lib/foo.exe  : the real executable
and the makefile *wants* 'foo.exe' -- but only sees 'foo'.  Therefore, 
make assumes that the executable hasn't been created, and builds it 
again.  EVERY time you run 'make <anything>'.  Sometimes *multiple* 
times if there are cross-dependencies.

There were several solutions:
   1) Teach 'make' to only want 'foo' instead of 'foo.exe'.  There are 
problems here -- this requires mucking with automake, which has the 
potential to break non-libtool builds if not done carefully.

Do you have seen thatg ltmain.sh defines for cygwin the .exe extension ? Automake creates rules like 

<application>$(EXEEXT): ... 

so setting this exeext to an empty string catch this. 

	case $host in
	  *cygwin*)
	    exeext=.exe
	    outputname=`echo $outputname|${SED} 's,.exe$,,'` ;;
	  *) exeext= ;;
	esac

Ralf 





--
Singles aufgepasst!
Spielend in Kontakt kommen und neue Freunde finden in der freenet.de Community!
Jetzt durchstarten unter: http://www.freenet.de/tipp/community/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]