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.
Related
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
I am trying to install a program on CentOS 6.10 and at the end of the installation, it gave an error saying that Glibc-2.14 is necessary. I upgraded the current Glibc and this time the error below occurred:
* These critical programs are missing or too old: gcc
* Check the INSTALL file for required versions.
I upgraded the gcc and tried to configure again. However, the same error persists. Hence I read the INSTALL file as it suggests, and I see this section:
You may also need to reconfigure GCC to work with the new library. The
easiest way to do that is to figure out the compiler switches to make
it work again (`-Wl,--dynamic-linker=/lib/ld-linux.so.2' should work
on GNU/Linux systems) and use them to recompile gcc.
So should I go to where gcc is built and do:
$ ./configure -Wl,--dynamic-linker=/lib/ld-linux.so.2 ?? Do I understand the instructions correctly? If so, then how will I be able to configure only gcc and not the other executable files as they are all in the same folder? (e.g gcc-5, git, idle, python, python-build.. etc) The directory is something like: home/linuxbrew/.linuxbrew/bin/gcc
I'm asking this because GNU compiler and GCC are fundamental in Linux system, and I'm not sure if those are the correct steps.
You are probably using a really old compiler (the one that comes with CentOS by default).
You need to install Red Hat Developer Toolset which provides up-to-date versions, see https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ for more details:
Developer Toolset is designed for developers working on CentOS or Red Hat Enterprise Linux platform. It provides current versions of the GNU Compiler Collection, GNU Debugger, and other development, debugging, and performance monitoring tools.
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?
I'm having trouble navigating GNU's website and finding the necessary files. And I strongly suspect the installation process isn't going to be straightforward given how their website is designed.
Or should I use Codeblocks instead?
Do I also need to install Cygwin since I'm running Windows 7?
(I have prior, basic experience with C, Matlab and Wolfram Mathematica programming)
I downloaded gfortran-windows-20140523.exe from http://users.humboldt.edu/finneyb/gfortran-windows-20140523.exe as suggested on https://gcc.gnu.org/wiki/GFortranBinaries#Windows and was able to install gfortran from this binary on Windows 8.1 and to compile a Fortran program. Gfortran --version says 4.9.0 20131208 (experimental)
Pretty straight to the point I think. Is this do-able?
Background: I'm doing this because I need to run php-cgi on suse enterprise 9 and can't get LD_PRELOAD or LD_LIBRARY_PATH to use other-than-system version of glibc.
php-cgi: /lib/tls/libc.so.6: version `GLIBC_2.7' not found
I downloaded 2.7 from here
http://rpmfind.net/linux/rpm2html/search.php?query=libc.so.6(GLIBC_2.7)
more precisely
ftp://rpmfind.net/linux/sourceforge/r/ro/roblinux/64-32_pkg/core/i686/glibc-2.7-2rt.i686.rpm
and unpacked it using rpm2cpio.
I need php-cgi because I can't install php and want to try JavaBridge for running php out of tomcat.
How can I compile php-cgi binary using a custom glibc for suse enterprise linux out of cygwin?
Pretty straight to the point I think.
No, a very confused and circuitous question.
First, cygwin has absolutely nothing to do with your question: it's for running UNIX programs on Windows, which is not at all what you are asking about.
Second, your question appears to be: "how do I run pre-build php-cgi binary on a system that has older glibc than the one php-cgi has been built on?", and not about compiling anything.
To that question, the answer is: you can't (easily) -- UNIX systems do not support forward binary compatibility (build on a new system, run on an older one). Only backward compatibility is supported (old dynamically-linked binaries continue to run on newer systems).
Your best approach is to try to build php-cgi on your system (which would eliminate its dependency on GLIBC_2.7. If you can't, you should still be able to run such a binary against unpacked glibc-2.7 build, if that binary doesn't re-exec itself. The way to do that, assuming you unpacked glibc-2.7 into e.g. /tmp/glibc-2.7 is something like:
/tmp/glibc-2.7/lib/ld-linux.so.2 --library-path \
/tmp/glibc-2.7/lib:/lib:/usr/lib \
/path/to/php-cgi <args>
(The library path above may need some adjustments to make the loader find all the required libraries.)
Update:
is it practical to compile stuff for my linux box in cygwin
It is possible, but significantly more pain then simply compiling on the linux box itself (and so isn't really practical). You appear to lack any reason to want to do that, other than mis-guided belief that cygwin solves all problems.