5
votes

I'm working on a program which uses autotools for its build system and compiles fine on linux. To build for windows I'm trying to get a mingw cross-compiler working for windows. Now when I compile on linux and move to windows of course I am missing some dll's that are not installed by default on windows. This leads to missing dll errors. I cannot statically link my program due to restrictions in the LGPL.

So my question is what is the correct way to cross compile in this situation? I feel like I need to wrap my exe in a installer which automatically resolves and installs the dll dependencies for windows but I haven't been able to locate something explaining how to do this. Basically I'm thinking of yum/apt-get for windows. How do I manage dll dependencies on windows? I'm a linux guy, not a windows guy, so please bear with me.

1
Put the DLLs in the same folder as the exe. You do have redist rights for the DLLs right?David Heffernan
Hi David, I do have redistribution rights but I am less interested in a way to do it and more interested in the correct way to do it. E.g. I could compile the dll's myself and make a little script wrapper that copies those dll's somewhere but I'd probably be reinventing the wheel at that point. Is there a commonly accepted wrapper/install that does this for me and integrates with an autotools build process? I have been unable to locate something like it...David Mokon Bond
You could use an install tool like InnoSetup to produce an install program.David Heffernan
I use find /usr -name '*libwinpthread*' (for example) then check the path and make sure the result with the right tool chain and threading model is chosen, then copy it to the local directory. I was considering fully automating this somehow, which is why I am looking at this question. If I get it to work reasonably well I'll post an answer.doug65536

1 Answers

-4
votes

Probably the easiest thing would be if you could move your development to a Windows machine. But short of that, you could install Windows-Mingw on your Linux machine using Wine. (IIRC winetricks has even a target for this) That way you get a "feel" for the issues on windows. An alternative could be Windows in a virtual machine, but Wine should be ok for a development environment.

I also strongly suggest that you install Microsoft Visual C++. The express versions will do fine. There are a number of tools coming with MSVC++ that can make your life a lot easier, like dll-dependency checker etc. An additional excellent source of information are the Sysinternals tools from Mark Russinovich and his blog.