gcc compiler for windows of less size - c

I am using Cygwin with gcc 4.5 to compile a C program. I am using Windows XP. The size of Cygwin package is too large i.e. about to 900MB, and I want a gcc compiler of less size.
Is there any gcc compiler of size max 10-15MB to compile C program on windows.
Or I can reduce the size of Cygwin package.
Actually there are lot of extra things present in Cygwin package but I don't know which files to remove or keep.
Thanks in advance.

If all you need in cygwin is the gcc package, run the setup.exe and then install select only the "Base" packages and "gcc4" and "gcc4-core" from the "Devel" set. Once you hit the "Next" button it may provide a list of required packages due to dependency. Install all of them and see if it meets your size requirement.

Related

MinGW-W64: Which Install Options (Archtitecture, Threads, ...) must/should I Use for Native Windows Development

I want to install MinGW-W64 for Windows 10 64 Bit (must run on Version 1607!). First problem is which MinGW should I download, there are 3 versions on download page: 1) "MingW-W64-builds", 2) "Msys2", 3) "Win-Builds". I have choosen 1). If this was wrong for my purpose (see below) please tell me.
When I start the installer I have to choose the following options, which I'm not clear what to choose:
Architetcture: i686 or x86_64
Threads: posix or win32
Exception: dwarf or sjlj
Purpose (What I want to do)
I want (later) to install the CLang C++ 64 bit Compiler, which AFAIK requires the libraries from MinGW-64.
I want to write native Windows 64 bit C++ (at least C++ 14) and C applications (compiled with either GCC or CLang). I don't need a bash (or someone tells me a good reason why I should use it instead of the excellent Windows Powershell).
At a later time I want to be able to install an IDE (like Eclipse) which especially integrates the debugger (the one for GCC and if it is a different one for CLang that for CLang).
The sources should be as compatible as possible to sources which can be compiled with Visual Studio and the produced binaries should also be as compatible as possible with code produced with Visual Studio (unfortunately I cannot use VS Community version because of license reasons).
(Maybe this is usefull for answering: Python 2.7.11 and Python 3.7 are installed on my machine)
MSYS2 is an environment that gives you a UNIX-like shell.
You can use this if you need to use UNIX-like build tools (like autoconf).
If that's not what you need, don't install it.
Certainly don't build for MSYS as it's closer to Cygwin POSIX emulation than native Windows.
You will need a GCC compiler build against MinGW-w64.
For example one of the MinGW-w64-builds from: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/
However, there don't seem to be any recent builds posted there, while there were newer releases of both GCC and the MinGW-w64 libraries. So I have built more recent versions and published them at: http://winlibs.com/
On http://winlibs.com/ there are also some instructions on how to compile from the command line and how to set up the compiler in the Code::Blocks IDE.
If you need Clang instead of GCC there are Windows binaries available at: http://releases.llvm.org/
However, you will still need the MinGW-w64 libraries to build for Windows using CLang. So if you're new to this, maybe you should just start with GCC before moving on to CLang.
Keeping your code compatible between compilers or even operating systems is up to the programmer.
The key rule there is to avoid anything compiler or operating specific, and if you really must then enclose them in conditional defined (e.g. put the specific code between #ifdef __MINGW32__ or #ifdef _WIN32 and #endif).

Is not only gcc itself installation enough to build c language in my windows machine?

I'm not sure what the meaning of installing a compiler(say, gcc) is.
I have an windows machine and will install cygwin.
cygwin has many packages and i installed gcc-related-packages.
But wait, gcc is just a compiler and is not including header files such as stdio.h, stdlib.h, etc.
What compiler does is just finding a header file specified in a some source file.
Installing compiler means (implicitly) installing related header files?
The Cygwin installer knows about package dependencies, and installing gcc will pull in the minimum set of packages needed to compile C programs. However, if you need particular libraries beyond the basic C library, you will have to install them separately.

Compiling an MPI program with mingw and MPICH2 in eclipse juno

Ive been trying to setup mpich2 to compile some programs using MPI on windows 7. The problem that I encounter is that it wont create the binary files when I build a project.
I use the stadard mpi program to test (hello world) and I get this message after building it:
13:33:29 ** Rebuild of configuration Debug for project mpitest **
Info: Internal Builder is used for build mpiCC "-IC:\MPICH2\include"
-O0 -g3 -Wall -c -fmessage-length=0 -o "src\mpitest.o" "..\src\mpitest.c"
The Open MPI wrapper compiler was unable to find the specified
compiler cl.exe in your PATH.
Note that this compiler was either specified at configure time or in one of several
possible environment variables.
13:33:29 Build Finished (took 78ms)
I tried to search for cl.exe but it doesn't exist. I have to say that I also installed openMPI but I didn't use it cause the cluster that I am gonna target run the program is using MPICH2. I have already installed 32bit minGW, 32bit MPICH2 and 32bit openMPI.
Is it normal to not create binaries since i run the .c file in the cluster? If its normal how am i going to check if the program is ok even for 1 process?
Thanks in advance! Cheers!
I found the answer by luck... In the project preferences, select C/C++ build-> Tool Chain editor-> choose cygwin and its done. For some reason i had mingw in that option and wouldnt create binaries, i suppose it needs some other tools that can be found only in the cygwin and not mingw... Still trying to set it and run on the cluster... so many options :/

Which version of gcc to install with MinGW?

If compiling and linking with MinGW gcc v3 is painfully slow, and gcc v4 is not the default install option: What, for a beginner are the advantages/disadvantages of installing one version or another?
Say for example with gcc v4, I want to use PDCurses or other GNU libraries will I first have to recompile these from source?
I'm only asking here about C and not C++.
I've been using MinGW with GCC4 for some time and didn't encounter any problems, so I'd say go for it. Also, there's no need for recompilation as the C ABI on Windows has been stable for a long time.
The TDM GCC/MinGW32 builds installer includes gcc 4.4.x and all the core binary packages required for basic Windows development, including gdb. It's widely used without any unusual problems.
One advantage of gcc4 is that you can compile recent QT4.6, as it is compiled with gcc4.
Of course some new additions, like OpenMP need new gcc versions.
However, there are complains about MingW port of gcc4 to be unstable for certain applications.

How to compile a C program?

I haven't done C in a long time. I'd like to compile this program, but I have no idea how to proceed. It seems like the makefile refers to GCC a lot and I've never used GCC.
I just want an executable that will run on windows.
You may need to install either cygwin or mingw, which are UNIX-like environments for Windows.
http://www.mingw.org/
http://www.cygwin.com/
When downloading/installing either cygwin or mingw, you will have the option of downloading and installing some optional features; you will need the following:
gcc (try version 2.x first, not 3.x)
binutils
GNU make (or gmake)
If it requires gcc and you want it to run on Windows, you could download Cygwin.
That's basically an emulator for GNU/Linux type stuff for Windows. It works with an emulation DLL.
http://www.cygwin.com/
In order to compile this program you need a C compiler. It does not have to be gcc, although you are already given a makefile set up to use gcc. The simplest thing for you to do would be the following:
Install cygwin
Open the cygwin command prompt
go into the directory where you have your makefile
type 'make'
That should compile your program
If you are not comfortable with using command line tools then you can download the free version of MS Visual Studio and import the source files into a new Visual Studio project. This way you would not need to install cygwin and use gcc, but you would need to know how to create projects and run programs in Visual Studio.
You almost certainly don't need all of cygwin to compile using gcc. There are plenty of standalone gcc clones for Windows, like gcw.
If it's reasonably portable C code (I haven't looked at it), then you may be able to just ignore the included Makefile and feed the source into whatever compiler you do want to use. What happens when you try that?
Dev-C++ provides a simple but nice IDE which uses the Mingw gcc compiler and provides Makefile support. Here are the steps I used to build the above code using Dev-C++ (i.e. this is a "how-to")
After downloading the source zip from NIST, I
downloaded and installed the Dev-C++ 5 beta 9 release
created a new empty project
added all the .c files from sts-2.0\src
Then under Project Options
added -lm in the Linker column under Parameters
added sts-2.0\include to the Include Directories in Directories
set the Executable and Object directories to the obj directory under the Build Options
and then hit OK to close the dialog. Go to Execute > Compile and let it whirl. A minute later, you can find the executable in the sts-2.0\obj directory.
First, there is little chance that a program with only makefiles will build with visual studio, if only because visual studio is not a good C compiler from a standard POV (the math functions in particular are very poorly supported on MS compilers). It may be possible, but it won't be easy, specially if you are not familiar with C. You should really stick to the makefiles instead of trying to import the code in your own IDE - this kind of scienfitic code is clearly meant to be compiled from the command line. It is a test suite, so trying things randomly is NOT a good idea.
You should use mingw + msys to install it: mingw will give you the compilers (gcc, etc...) and msys the shell for the make file to run correctly. Contrary to one other poster, I would advise you against using gcc 2 - I don't see any point in that. I routinely use gcc 3 (and even 4) on windows to build scientific code, it works well when the code is unix-like (which is the standard platform for this kind of code).

Resources