Does anyone use cygwin?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Magnate
    Angband Devteam member
    • May 2007
    • 5110

    Does anyone use cygwin?

    I'm trying to get my head around developing on Windows. I've installed cygwin, which allows me (if I patch src/Makefile to pick up /usr/include/ncurses properly) to build ... the unix versions (gcu, x11, potentially SDL and GTK). It seems perverse to install cygwin and then cross-compile the Windows version ... does anyone actually do this? If so, why?
    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles
  • Timo Pietilä
    Prophet
    • Apr 2007
    • 4096

    #2
    Originally posted by Magnate
    I'm trying to get my head around developing on Windows. I've installed cygwin, which allows me (if I patch src/Makefile to pick up /usr/include/ncurses properly) to build ... the unix versions (gcu, x11, potentially SDL and GTK). It seems perverse to install cygwin and then cross-compile the Windows version ... does anyone actually do this? If so, why?
    I use cygwin. Reason is that it just is so simple with it. Just command make -f makefile.thisandthat (can't remember which one) to make perfectly working windows compile. All those windows-development programs are either pain in the butt to set up properly (its like no-one making these systems actually knows how Windows works), or they are not freeware.

    Comment

    • nppangband
      NPPAngband Maintainer
      • Dec 2008
      • 926

      #3
      I use cygwin to compile the windows build for NPP and Angband (but the current Angband won't compile with cygwin).

      As for the why, I have heard that mingw is better but I couldn't get it installed properly, and I thought the instructions and documentation was garbage. I installed cygwin and had it working with eclipse as my editor in about 5 minutes, so I just stuck with it. (Note: I have no experience programming outside of the Angband source code, and I only know enough c programming to make the changes I want to.)

      Before that, I used LCC-WIN to compile. Also, I have to use the windows interface for github because I can't figure out how to get it to work from a prompt. (and I can hear you all laughing at me, stop it! )
      NPPAngband current home page: http://nppangband.bitshepherd.net/
      Source code repository:
      https://github.com/nppangband/NPPAngband_QT
      Downloads:
      https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57

      Comment

      • Magnate
        Angband Devteam member
        • May 2007
        • 5110

        #4
        Thanks both for the replies. I think it's worth adding a cygwin section to the compiling.txt doc that d_m has added to the repo. Especially if building the Windows binary is as easy as Timo says (I haven't got that far yet - I can play in gcu mode).

        @Jeff: I would point you at the git user manual, but it's hosted at kernel.org which is down at the moment (massive hacking scandal). tbh the only commands I ever use are

        git checkout
        git fetch
        git merge
        git rebase
        git push
        git log
        git diff
        git status
        git commit
        git reset

        There are loads of others, but those cover about 99% of usage (plus git clone, git branch and git remote to set things up).
        Last edited by Magnate; September 15, 2011, 15:56.
        "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

        Comment

        • Magnate
          Angband Devteam member
          • May 2007
          • 5110

          #5
          Originally posted by Timo Pietilä
          I use cygwin. Reason is that it just is so simple with it. Just command make -f makefile.thisandthat (can't remember which one) to make perfectly working windows compile. All those windows-development programs are either pain in the butt to set up properly (its like no-one making these systems actually knows how Windows works), or they are not freeware.
          Hmmm. Can you help me get this working? At the moment I can build the gcu and x11 ports but not SDL or Windows (I haven't tried GTK).

          To build Windows, I've tried two things:
          Code:
          $ make -f Makefile.win
          gcc -DWINDOWS -static -Iwin/include -Lwin/lib -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -std=c99 -Wdeclaration-after-statement -O2 -I. -mno-cygwin -c -o attack.o attack.c
          gcc: The -mno-cygwin flag has been removed; use a mingw-targeted cross-compiler.
          
          make: *** [attack.o] Error 1
          So then I tried using the cross-compile:
          Code:
          $ MINGW=yes make -f Makefile.win CROSS=i686-mingw32msvc-
          i686-mingw32msvc-gcc -DWINDOWS -static -Iwin/include -Lwin/lib -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -std=c99 -Wdeclaration-after-statement -O2 -I. -DCROSS_COMPILE -D_stdcall= -c -o attack.o attack.c
          make: i686-mingw32msvc-gcc: Command not found
          make: *** [attack.o] Error 127
          But I've installed ALL the mingw packages for cygwin, so I don't understand how it can't cross-compile. Any ideas?

          EDIT: Solved! cygwin uses slightly different syntax for mingw, it's:

          MINGW=yes make -f Makefile.win CROSS=i686-pc-mingw32-

          ... but it doesn't work. It builds an angband.exe that's only 1.07MB which, when I double-click it, says "The application failed to initialize properly (0xc0000022). Click on OK to terminate the application."

          Ho hum. Back to the drawing board.
          Last edited by Magnate; September 15, 2011, 14:22.
          "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

          Comment

          • nppangband
            NPPAngband Maintainer
            • Dec 2008
            • 926

            #6
            A couple months ago the standard makefile.win workedt worked just fine (the last time I did a patch for Vanilla). It was only when I did the Angel-to-Ainu patch that I couldn't compile. So if there have been any changes to the makefile.win in the last couple months, that is what is probably preventing cygwin from compiling.
            NPPAngband current home page: http://nppangband.bitshepherd.net/
            Source code repository:
            https://github.com/nppangband/NPPAngband_QT
            Downloads:
            https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57

            Comment

            • Magnate
              Angband Devteam member
              • May 2007
              • 5110

              #7
              Originally posted by nppangband
              A couple months ago the standard makefile.win workedt worked just fine (the last time I did a patch for Vanilla). It was only when I did the Angel-to-Ainu patch that I couldn't compile. So if there have been any changes to the makefile.win in the last couple months, that is what is probably preventing cygwin from compiling.
              It compiles fine (a small handful of warnings, but nothing serious) - it just doesn't run. Not sure what's going wrong - I'm a novice on Windows.
              "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

              Comment

              • Timo Pietilä
                Prophet
                • Apr 2007
                • 4096

                #8
                Originally posted by Magnate
                It compiles fine (a small handful of warnings, but nothing serious) - it just doesn't run. Not sure what's going wrong - I'm a novice on Windows.
                Without mingw? To me it looks like this is a problem:

                gcc: The -mno-cygwin flag has been removed;

                If I needed to install mingw in cygwin I would not be using cygwin. I would use mingw directly in windows.

                Comment

                • Magnate
                  Angband Devteam member
                  • May 2007
                  • 5110

                  #9
                  Originally posted by Timo Pietilä
                  Without mingw? To me it looks like this is a problem:

                  gcc: The -mno-cygwin flag has been removed;

                  If I needed to install mingw in cygwin I would not be using cygwin. I would use mingw directly in windows.
                  ?? So are you saying that if I *uninstall* mingw from cygwin it should build a native Windows executable simply from "make -f Makefile.win"?

                  I thought, since cygwin is effectively a unix environment inside Windows, that you'd have to cross-compile using mingw32. It hadn't occurred to me that cygwin could build Windows binaries without it. Doh.
                  "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                  Comment

                  • Timo Pietilä
                    Prophet
                    • Apr 2007
                    • 4096

                    #10
                    Originally posted by Magnate
                    ?? So are you saying that if I *uninstall* mingw from cygwin it should build a native Windows executable simply from "make -f Makefile.win"?

                    I thought, since cygwin is effectively a unix environment inside Windows, that you'd have to cross-compile using mingw32. It hadn't occurred to me that cygwin could build Windows binaries without it. Doh.
                    Yes, it is that easy. Or it at least used to be that easy. It makes native windows executable using Makefile.win.

                    Comment

                    • nppangband
                      NPPAngband Maintainer
                      • Dec 2008
                      • 926

                      #11
                      Yes,just like MinGW, Cygwin creates its own windows binary. They just take a slightly different approach (from wikipedia):

                      MinGW forked from version 1.3.3 of Cygwin.[5] Although both Cygwin and MinGW can be used to port Unix software to Windows, they have different approaches:[15] Cygwin aims to provide a complete POSIX layer that provides emulations of several system calls and libraries that exist on Linux, Unix, and the BSD variants. The POSIX layer runs on top of Windows, sacrificing performance where necessary for compatibility. Accordingly, this approach requires Win32 programs written with Cygwin to run on top of a copylefted compatibility library that must be distributed with the program, along with the program's source code. MinGW aims to provide native functionality and performance via direct Windows API calls. Unlike Cygwin, MinGW does not require a compatibility layer DLL and thus programs do not need to be distributed with source code.

                      Because MinGW is dependent upon Win32 API calls, it cannot provide a full POSIX API; it is unable to compile some Unix applications that can be compiled with Cygwin. Specifically, this applies to applications that require POSIX functionality like fork(), mmap() or ioctl()[15] and those that expect to be run in a POSIX environment. Applications written using a cross-platform library that has itself been ported to MinGW, such as SDL, wxWidgets, Qt, or GTK+ will usually compile as easily in MinGW as they would in Cygwin.

                      The combination of MinGW and MSYS provides a small, self-contained environment that can be loaded onto removable media without leaving entries in the Registry or files on the computer. By providing more functionality, Cygwin becomes more complicated to install and maintain.

                      It is also possible to cross-compile Windows applications with MinGW-GCC under POSIX systems. This means that developers do not need a Windows installation with MSYS to compile software that will run on Windows without Cygwin.

                      If you do get it working, can you please let me know which command you used or of any modifications to the makefile you use?
                      NPPAngband current home page: http://nppangband.bitshepherd.net/
                      Source code repository:
                      https://github.com/nppangband/NPPAngband_QT
                      Downloads:
                      https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57

                      Comment

                      • Magnate
                        Angband Devteam member
                        • May 2007
                        • 5110

                        #12
                        Thanks - very interesting. I must admit that cygwin is extremely slow (4 mins for a full distclean / configure / make, so about 5x longer than linux), so I'm interested in trying MinGW. But I will persist with cygwin to see if I can build the Windows and/or SDL versions.

                        I'm not back at work until Monday though ...
                        "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                        Comment

                        • Timo Pietilä
                          Prophet
                          • Apr 2007
                          • 4096

                          #13
                          Originally posted by nppangband
                          Yes,just like MinGW, Cygwin creates its own windows binary. They just take a slightly different approach (from wikipedia):
                          If I understood that correctly they are talking there about environment what you use to port programs, not the programs build there. You can run for example xemacs under Cygwin in windows, but that doesn't mean that program build under cygwin needs any extra layers.

                          Cygwin-build windows binary of Angband doesn't include anything extra, it is pure native windows code.

                          Compiling in general isn't depended of environment, c is environment independent programming language and it is same in every environment, you could build up windows binary in Commodore64 if you had an compiler there that could do the job.

                          Comment

                          • Magnate
                            Angband Devteam member
                            • May 2007
                            • 5110

                            #14
                            Doh. No wonder it built something that didn't work - I was cross-compiling for Win32 and trying to run it on a Win64 machine. The correct build command for mingw-in-cygwin on Win64 is

                            MINGW=yes make -f Makefile.win CROSS=x86_64-w64-mingw32-

                            Yes, that is a 32 at the end. Don't ask me why.
                            "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                            Comment

                            • david3x3x3
                              Scout
                              • Jun 2009
                              • 28

                              #15
                              If you want to use Cygwin with the configure script instead of the Makefile.win, you can run this command:

                              Code:
                              ./configure --enable-win --with-no-install --host=i686-pc-mingw32
                              This requires that you have the mingw-gcc-core package installed.

                              I prefer Cygwin to Mingw/Msys because it seems a lot faster and there is lots of prepackaged software available through a single installer. Just download setup.exe, click the mingw and git packages and you're ready to go. Also the Android compile tools that I use to build Angband depend on Cygwin.

                              Comment

                              Working...
                              😀
                              😂
                              🥰
                              😘
                              🤢
                              😎
                              😞
                              😡
                              👍
                              👎