View Full Version : Running Unix software under Windows

Doctor Q
Jul 25, 2006, 02:04 PM
I have a large C program that runs under Unix and uses many Unix facilities, including forks, pipes, shared memory, memory mapping, semaphores, and signals.

I want to port it to run natively under Windows without redesigning all the code.

Ideally, I'd have a free, royalty-free, freely supported, and perfectly reliable Unix-emulation package or library that provides these Unix facilities seamlessly under Windows.

In the real world, what are my practical choices?

Jul 25, 2006, 02:16 PM
In the real world, what are my practical choices?

I think you want http://www.cygwin.com/

It come with everything you need, GCC compiler, libraries, X11 and so on. It's huge. but once installed your Windows PC will be very UNIX-like and can even run Gnome or KDE in an X11 window

Notice the "install" link on the page. It works well. It's free and hhas been around for ages. Redhat owns it now and will offer to sell you support. This will help and GNU autotools will work in the cygwin environment.

Doctor Q
Jul 25, 2006, 02:33 PM
Thanks for the quick answer, ChrisA. I had previously looked into Cygwin, but I didn't want to be required to distribute my source code (so I can get rich selling products I make out of it). Linking to Cygwin's library would make my code subject to the GNU General Public License, which requires that source code be made available.

However, I see that Red Hat sells some kind of license called The Cygwin Contract (http://www.redhat.com/software/cygwin/) that bypasses the GPL requirement. I wonder what it costs?

Jul 25, 2006, 03:54 PM
MS's Services for Unix and especially the Interix SDK

Doctor Q
Jul 27, 2006, 08:06 PM
However, I see that Red Hat sells some kind of license called The Cygwin Contract (http://www.redhat.com/software/cygwin/) that bypasses the GPL requirement. I wonder what it costs?I found the answer: $25,000 per year! That's a little steep for my plans. I was hoping for "free or cheap".

Now I'm looking into Interix. Thanks!

Jul 29, 2006, 12:41 PM
http://www.research.att.com/sw/tools/uwin/ - commercially permissive open source license
http://webstore.mkssoftware.com/webstore/product.asp?dept_id=1040&pf_id=1000 - $500

Doctor Q
Jul 29, 2006, 01:06 PM
http://www.research.att.com/sw/tools/uwin/ - commercially permissive open source license/This looks quite promising. The license seems to allow use in a non-open-source commercial product as long as the proper liability statements are included to protect other UWIN contributors.

http://webstore.mkssoftware.com/webstore/product.asp?dept_id=1040&pf_id=1000 - $500The one-time pice is reasonable, but they also charge me something like $700 per copy per year for products delivered to (my) customers. I'd have to pay them every year! So that's well out of my price range.

Jul 29, 2006, 02:27 PM
IIRC, the GNU does not prevent you from selling your software for profit.


I think also you only have to provide a written offer to provide source code, if you distribute a binary-only release

Jul 29, 2006, 03:41 PM
It seems that you may have aready ruled out Cygwin for license reasons, but I thought I'd chip in and mention that while it's pretty good, it's definitely not seamless. A few gotchas I remember:

If you rely on privileged IP port numbers for security, come up with something else. Windows has no direct equivalent.

In the same way, there is no direct equivalent to suid, or magical properties for UID 0. Careful about any built-in assumptions that rely on these.

File clobbering doesn't work, you need to implement your own switcheroo and make sure that interdependent processes won't be surprised by this.

Socketpair is dicey but these can typically be replaced by pipes.

mmaps get passed to children due to the way forking is emulated, which can interfere with the parent process.

I'm sure there were more bit of weirdness, but that's what I remember.