Cygwin MinGW package vs. standalone MinGW - cygwin

I would like to have a POSIX environment in Windows (to be used as a system shell) and at the same time produce native Windows executables. One option in the past was to install Cygwin and MinGW and possibly call MinGW compiler binaries from Cygwin.
Now an x64 MinGW is available straight as a Cygwin package and there are some blogs documenting how to get them play nicely together.
Before adopting this solution, I would like to know how and if the Cygwin package is different from a standalone MinGW-w64. Specifically which one is more efficient in producing native Win64 exe's? Is Cygwin package itself based on native executables, or is an extension to its gcc compilers?
Update
Some of you miscomprehended this question:
I am not interested in the difference between Cygwin and MinGW at all.
(and by the way, on the very home page of MinGW their main concern is to show how they differentiate from Cygwin)
My question instead is very specific: I am interested in the difference between a specific Cygwin package and its standalone version.
This package happens to be "mingw64-x86_64", which is split in several dependencies files, of which the most relevant is perhaps "mingw64-x86_64-gcc-core".
Sorry, but references found in some comments are utterly wrong with respect to what is asked here: first they address to Cygwin as a whole and not the mentioned package; secondly they refer to a rather old MinGW version, significantly different from that mentioned here (see here for the differences).
Someone also mentions MSYS2, which is a modern Cygwin fork, but again I am not interested to Cygwin (as whole), but to the said package.
Some of you might not be aware of this package, and in fact, if you google for "mingw64-x86_64", you don't find anything relevant for the Cygwin package, and most likely land on the general version, and this is why I am posting here.

TL;DR: Install Cygwin and the package mingw64-x86_64-gcc-core.
if the Cygwin package is different from a standalone MinGW-w64
They are the same.
MinGW - this is the project that can be found at mingw.org and
sourceforge.net/projects/mingw. This project has been superceded by the MSYS2
and MinGW-w64 projects.
Cygwin environment - Unix-like environment, namely Bash.
Cygwin compilers - these are the packages gcc-core and cygwin32-gcc-core
which include the files x86_64-pc-cygwin-gcc.exe and
i686-pc-cygwin-gcc.exe. These compilers create programs that rely on
cygwin1.dll.
MSYS2 environment - Unix-like environment, namely Bash. This is an
update to the MSYS environment provided by the old MinGW project.
MinGW-w64 compilers - these are the packages mingw64-x86_64-gcc-core and
mingw64-i686-gcc-core which include the files x86_64-w64-mingw32-gcc.exe
and
i686-w64-mingw32-gcc.exe. These compilers create Windows native
programs that do not rely on cygwin1.dll.
What do the C compilers on Cygwin generate?

Related

Cross Compiler for Cygwin Target

I have been wondering about building Windows executables targeting Cygwin on
a Linux host.
I have not been able to find anything related to a prebuilt crosscompiler and I am lost about how to build one myself with a Cygwin target.
How would I proceed?
Thanks in advance.
A cross-tool is available at:
https://sourceforge.net/projects/fedora-cygwin/
A repository for Fedora is at:
https://copr.fedorainfracloud.org/coprs/yselkowitz/cygwin/
as mentioned on the Cygwin mailing list not so long ago
https://cygwin.com/pipermail/cygwin/2020-July/245695.html
Is there an actual reason you want to target Cygwin instead of native Windows?
Cygwin introduces a POSIX compatibility layer, while MinGW-w64 targets native Windows.
MinGW-w64 can be installed under most Linux distributions using their respective package managers.

Cross-compilation targeting Cygwin with Linux host

Is it possible to cross-compile a program targeting a Cygwin environment from a Linux/Unix host? I'm mostly trying to avoid using a Windows WM for building a collection of programs.
From the website:
Cygwin is not:
a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
mingw-w64 is not enough, I need a full POSIX platform. I'm also wondering if it's possible to target MSYS2.
Perhaps I'm not understanding correctly, and one doesn't need to compile in Cygwin but only mingw-w64 is necessary.
Thanks!
It is possible to compile for Cygwin from Linux.
The cygwin1.dll itself is built in such way.
Packages/libraries are available at:
https://copr.fedorainfracloud.org/coprs/yselkowitz/cygwin/
Of course only a minimal set of tools/libraries is available

Basic set of libraries in chroot (fedora linux)

I'm running an old version of my linux distro (fedora, but this is not very relevant) and for reasons which are completely irrelevant I'm not in a position to update it. However I do need a newer version of gcc and some other libraries than those supplied by my old distro.
I could compile a newer gcc and all the other libraries of course but I thought the simplest way would be to install a minimal set of packages from the latest distro version to a directory and then just chroot there. This way I'd take advantage of the binary packages present in the newest distro and all the infrastructure around it (like dependency installation, etc.) and I wouldn't need to compile everything from source.
My question is this: if I only would like to be able to compile with the most recent gcc and run those programs, what is the minimal set of packages I need? Since we are talking about fedora, what is the minimal set of rpms (beyond glibc and gcc)? Note that I don't need any X environment, networking, or anything like that, only the most basic terminal tools.
The minimal set varies depending on your user needs and what you're linking with. What I do when making a chroot environment is have a look at the distro I want to chroot and see if they have a base rpm/deb package that kickstarts everything. Then I install that in the chroot. From there I add libraries and applications as needed.
For an example where I create a chroot for RHEL on Arch see http://www.zenskg.net/wordpress/?p=267

Cygwin and MinGW

I'm trying to make a decision about whether to install Cygwin. I'm currently using the TDM-GCC 64Bit compiler on Windows 7.
Due to a few ridiculous build issues whenever I build something on Windows (libraries etc) I wanted to confirm that some of my assumptions are correct. I have looked at their website and a number of forum posts but still aren't sure I have a complete grasp of what it does. Could anyone confirm or deny the below.
1 - Cygwin provides a set of tools GNU tools etc which can be utilized to compile programs, create makefiles, much more, etc.
2 - Cygwin also provides a command line interface for building programs (unix like)?
3 - Cygwin provides a compatibility layer which emulates a unix like or posix framework?
4 - If I have Cygwin I don't need to use my TDM-GCC 64bit compiler as Cygwin provides it's own compiler. (What is this compiler called, I'm not sure)?
5 - If I compile a program in c++ using Cygwin on Windows, can I run that binary on a PC with windows installed even if Cygwin is not installed on that pc?
Thanks, I realize these are menial questions but the Cygwin mailing lists take weeks to respond to questions so I thought I would ask the programming community instead..
1: Yes
2: Yes, default bash but other are also available
3: yes
4: GCC . It is also possible to install a gcc cross compiler from cygwin to mingw64.
5: In theory yes but you need to pack all needed libraries. So it is not recommended. For that you can use the cross compiler.

Building GSL (GNU Scientific Library) in Windows for use with VS2005

I'm trying to get GSL working in a windows environment for my team and I'm running into many problems.
My team develops in C++ in VS2005, and we'd like to use GSL. I've downloaded the GSL-1.15 tar.gz, and unzipped it, but i'm not really sure what to do from here - I believe only two compilers will build it properly.
On the GNU website, it says that a compiled version of GSL is available as part of Cygwin on windows, so I installed Cygwin, but again, I'm not really sure what to do from there.
Ideally, what I'm trying to get is a folder on my C:\ with a bunch of dll / libs that I can link to in VS2005 to use the GSL functions. I'm aware of GSL ports to VS (http://gladman.plushost.co.uk/oldsite/computing/gnu_scientific_library.php), but we can't rely on them as I would be dependent on the publisher releasing a port every time a new version of GSL is released.
Has anyone successfully gone through this process of building GSL and getting it to work with C++ in VS2005? I've done some google searches and haven't found anything that I understand.
Thank you.
With Cygwin
Install one or more of the GSL packages
gsl
gsl-apps
gsl-devel
gsl-doc
With MinGW
I have personally built GSL with MinGW using this incantation
wget ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz
tar xf gsl*
cd gsl*
./configure
# Warning, make takes about 7 min.
make
make install
ref

Resources