Saturday, December 29, 2007

The Sorry State of Dynamic Libraries on Cygwin

This is a follow up to my previous post on the Cygwin port of Sage 2.9.1.1. What started initially about some linking issue with libpari resolved itself into a very unexpected way: libpari.dll ended up in $PREFIX/bin instead of $PREFIX/lib. After I found the DLL by accident I discovered even more bizar behavior specific to Cygwin:
  • Most packages we ship either don't build dynamic libraries or dutifully ignore the request to build them.
  • Some put them into $PREFIX/bin instead of $PREFIX/lib. pari isn't the only one example, there are more.
  • Some prefix the DLL with cyg instead of lib. I assume that it is to avoid name clashes with "native" Windows Dlls, but if you are stupid enough to put $CYGWIN/lib into your %PATH% my position is that you deserve the pain that is sure to follow.
  • Most do not create proper def files for imports.
  • Naming is woefully inconsistent: .a, .dll, .so, .dll.a and so on.
The problem isn't something that can be fixed overnight. It seems that certain auto-hell macros do various of the things listed above per default and a lot of projects do not test their builds on Cygwin or never hear complaints about those issues. During the 2.10 release cycle we will update a lot of spkgs. While I am at it I will make sure that
  • they build properly on Cygwin
  • they build shared libraries at all
  • they created proper def files
  • they put them into the right place.
There are also some other general issues that we need to take care of, so it seems like a good idea to combine fixing the above issues with those. More about that once we get closer to the 2.10 release cycle. This will be fun :)

Cheers,

Michael

No comments: