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 :/
Related
I am building a simple command line game in C using the ncurses library on a Linux machine but I want to be able to run the compiled code on a Windows computer. To do this, I am using the MinGW-w64 cross compiler tool in Linux and compiling it to run in a 64 bit Windows environment. However, when I try to compile using this command:
x86_64-w64-mingw32-gcc -o game.exe barebones.c -lncurses
I get this error:
barebones.c:2:10: fatal error: ncurses.h: No such file or directory
2 | #include <ncurses.h>
| ^~~~~~~~~~~
compilation terminated.
I installed ncurses on my Ubuntu machine and can create and run the same simple program to run on Linux. I have been able to cross-compile and run simple programs that only use the default libraries. I think I must be listing the ncurses library incorrectly in the compliation command or that I am failing to understand other posts that show that this doesn't work.
I am using Windows 10 and Ubuntu 21.04.
Debian provides no cross-compiling packages for ncurses. (Ubuntu provides no additions or improvements to ncurses in any way, simply reusing packages from Debian). If you want to cross-compile ncurses, you'll have to build ncurses in cross-compiling form.
For development purposes, ncurses packages can be built using the scripts under the (sources) packages directory, e.g., after downloading the current source:
tar xf ncurses-whatever.tgz
cd ncurses-whatever
cp -var packages/debian-mingw64 ./debian
dpkg-buildpackage
That's a starting point. You'd have to do something about the email in the debian/control file to appease dpkg-buildpackage (tutorials are off-topic).
I am using Codeblocks and have to run an OpenMP C program. So, I added the flag -fopenmp in Codeblocks (compiler settings) and am now getting the error of 'mingw32-g++.exe: error: libgomp.spec: No such file or directory'
So after a bit of searching on the internet about the error, I downloaded TDM-GCC ( installed in C:\TDM-GCC-64). But still the same error is being shown on Codeblocks.
What am I doing wrong?
Here is the build log:
mingw32-gcc.exe -c "D:\Language Files\MatrixMultiplication.c" -o "D:\Language Files\MatrixMultiplication.o"
mingw32-g++.exe -o "D:\Language Files\MatrixMultiplication.exe" "D:\Language Files\MatrixMultiplication.o" -fopenmp
mingw32-g++.exe: error: libgomp.spec: No such file or directory
There are multiple possible causes for this: Either you did not install OpenMP with the compiler or you made a mistake in the Code::Blocks configuration. Anyways go through the following steps and you should be able to fix it. You seem to be working on Windows but I also added remarks on how to do it on Linux.
1) You will need a compiler that comes with OpenMP. For Windows download TDM-GCC preferably the 64-bit executable (second file) and install it. Make sure you select OpenMP in the component tab: Components > gcc (TDM current: ....) > OpenMP (the last entry). Linux already comes with GCC so just open the command line and get yourself OpenMP by typing sudo apt-get install libomp-dev in the terminal.
2) You will have to configure the Compiler in Code::Blocks now: Go to Settings > Compiler under Selected Compiler select GNU GCC Compiler and click Copy and type in a convenient name for your new compiler such as TDM-GCC Compiler. Go to Toolchain executables and browse the directory for all the Program files (C compiler, C++ compiler, Linkers, Debugger, Resource compiler, Make) you should be able to find them in C:\TDM-GCC-64\ ...\bin on a Windows machine if you chose the default installation. I can't tell you the precise sub-directory as I working on a Linux machine but you should be able to find it pretty easily. Depending on your installation there might be two folders for 32- and 64-bit. For Linux this step is not necessary.
4) Then you need to set the Linker settings. This can be done for all projects (which I would not recommend) by doing the following steps in the aforementioned menu or for your current project by clicking Project > Build options. Go to Linker settings of the corresponding configuration (Debug or Release) and click Add under Link libraries. On a Windows machine you will need to browse a file called libgomp-1.dll (32-bit) or libgomp_64-1.dll (64-bit) which should be located in the same folder as the aforementioned Program files. Under Linux instead choose -lgomp under Other linker options.
3) Set the compiler flag -fopenmp (for all the projects or only the current one) by going to Compiler settings > Other compiler options and typing in there -fopenmp.
4) Test it with a program like the OpenMP "Hello World".
I installed Eclipse in fedora and then installed the CDT plugin for developping C/C++ applications . All the installation are done !
So now i can create a C/C++ project but when it comes to running it i got this message
launch failed , Binary not found
and
unable to find full path to gcc.
gcc -O2 -g -Wall -c -fmessage-length=0 -o Rad1.o ../Rad1.c
Internal Builder: Cannot run program "gcc": Unknown reason
Error: Program "gcc" is not found in PATH
Is there any more configuration i must do so C/C++ runs?
Thanks.
Executing c/c++ program with eclipse+unix base plate-forme, it requied object file of the program to execute/run it. So first of all you need to build your program by just pressing Ctr+b to buid it. This will create an object file that was required. Now you enabled to run/execute your programe. Good luck :)
I am trying to run a MPI program with C language.
I have installed GCC compiler and the openmpi libraries. I am running ubuntu Linux and Netbeans IDE. My challenge is that after including ‘mpi.h’ in my header file and compiling the application, I still get ‘fatal error : cannot find file mpi.c’. I have the files in home/user/lib/openmpi/include, but I cant get it too work.
Can anyone help?
You could try to change the compiler to /path/mpicc and the debugger to mpirun. This should work, although I did not test it, but probably the best way to compile MPI code is via terminal.
If you really depend on the IDE you cound try writing your code with it (to take advantage of auto-completion and such) and compile it in terminal using mpicc -o main.exe main.cpp [other .cpp files] and run it with mpirun -np number_of_processes_to_use ./main.exe [args]. You could write a small script or a Makefile to do it all in one command.
Good luck!
to save yourself some sanity, I'd recommend opening up a terminal and going from there (at least until you figure out what's what).
Also, using the mpi compiler to do things would simplify your life. (and likely automatically solve the missing source issue, as it should know where they are by default).
If you still can't locate them during compile then I'd look at adding the location where mpi.c & mpi.h are located to your C Include Path: How to add a default include path for gcc in linux?
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).