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?
Does anyone use cygwin?
Collapse
X
-
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 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/1x7k65ghsmc31usmj329pb8415n1ux57Comment
-
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 BeatlesComment
-
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.
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
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
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 BeatlesComment
-
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/1x7k65ghsmc31usmj329pb8415n1ux57Comment
-
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."Been away so long I hardly knew the place, gee it's good to be back home" - The BeatlesComment
-
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
-
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 BeatlesComment
-
?? 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.Comment
-
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/1x7k65ghsmc31usmj329pb8415n1ux57Comment
-
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 BeatlesComment
-
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
-
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 BeatlesComment
-
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
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
Comment