Running Unix software under Windows

Discussion in 'Mac Programming' started by Doctor Q, Jul 25, 2006.

  1. Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Location:
    Los Angeles
    #1
    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?
     
  2. macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #2
    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.
     
  3. thread starter Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Location:
    Los Angeles
    #3
    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 that bypasses the GPL requirement. I wonder what it costs?
     
  4. macrumors 6502a

    #4
    MS's Services for Unix and especially the Interix SDK
     
  5. thread starter Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Location:
    Los Angeles
    #5
    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!
     
  6. macrumors member

    Joined:
    Jun 3, 2005
  7. thread starter Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Location:
    Los Angeles
    #7
    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.

    The 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.
     
  8. macrumors 68000

    Joined:
    Feb 23, 2006
    #8
    IIRC, the GNU does not prevent you from selling your software for profit.

    http://www.fsf.org/licensing/essays/selling.html

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

    iMeowbot

    Joined:
    Aug 30, 2003
    #9
    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.
     

Share This Page