Mixing Cygwin, XPCOM, ldns

In my continuing adventures working on a .tel extension for Thunderbird, I’ve switched to using ldns for the DNS lookups. After a bit of futzing around to give ldns the ability to get the DNS server addresses from the Windows registry rather than resolv.conf. I haven’t tested the result very heavily, but building ldns under Cygwin seems to be working fine. The ‘drill’ utility won’t build – seems to be something to do with Cygwin’s lack of support for IPv6, but the core library works.

So I moved on to trying to get my XPCOM code to build under Cygwin. I don’t have much there right now – mainly the first bits of skeleton code, much of it generated from xpidl. But it should build – it did under VC++ anyway. I ripped out the VC and Windows DNS specific stuff and replaced with Cygwin and ldns equivalents, or just deleted code. The goal here is just to successfully build.

Since most of my experience is with Java, C#, Ant, NAnt, etc. I’m not extremely well-versed in the black art of make and the GNU toolchain. But I managed to work through most of the problems, mainly path issues. One problem was with the ldns headers. Since XPCOM is C++, those semantics are being applied with the ldns headers are pulled in. Minor problem, but in a few places ‘class’ was being used as a formal parameter name. C++ no likey. So I had to change those names in the header. I then had some problems picking up the ldns lib, but that turned out to be more path and gcc command line syntax silliness on my part.

But my big problem now is how to link to the XPCOM libraries. Those are part of the xulrunner-sdk package and appear to have been built with MS VC. The SDK includes the .dll and .lib files for these libraries, but I can’t figure out how to get gcc to link to them. I’ve searched and found suggestions, and from what I’ve found it seems like I should be able to link against the .lib files as if they were .a files. But it isn’t working – I just get a stream of undefined symbol messages. Cygwin has a ‘dlltool’ that can build a .a import library from the dll and a .def file, but I can’t find a way to generate the .def. The method I did find extracts the exported symbols from the dll, but the XPCOM dlls have been stripped. Seems like I should be able to get the same info from the .lib file though, and in fact if I simply dump the .lib all the names are in there. So maybe if I use the extract method I found on the .lib rather than the .dll that might work.

I suppose my other option would be to use the Cygwin-built ldns, convert it to a Windows dll (I think this is possible) and use that from VC. I was hoping to keep everything in Cygwin though to make it as easy as possible to built on Linux as well.

Any experts in this stuff listening out there with suggestions?

This entry was posted in .tel, Cygwin, General, LDNS, XPCOM. Bookmark the permalink.

Leave a Reply