Installing G95 under Windows FAQ
Most problems encountered by new users when installing g95 in Windows are solved by setting thePATH and the correct
environment variable for your package, either
LIBRARY_PATH or G95_LIBRARY_PATH.
- How do I use the Control Panel to edit PATH and add environment variables?
- Will g95 conflict with gfortran?
- unrecognized option `'--sysroot='
- cannot exec 'f951':
- cannot exec 'as':
- Is the g95 directory too deep in PATH?
- _spawnvp: Invalid argument
- ld: crt2.o: No such file:
- Why does g95 need environment variables?
- Where is g95?
- Did you run the installer?
Q. 1. How do I use the Control Panel to edit PATH and add environment variables?
A. See the discussion at: http://vlaurie.com/computers2/Articles/environment.htm
Q. 2. Will g95 conflict with gfortran?
A.
Installing the g95-MinGW.exe package may cause problems for gfortran as
both compilers recognize the LIBRARY_PATH environment variable. Use the
g95-MinGW-41.exe
package instead. It uses G95_LIBRARY_PATH to find its library files instead of
LIBRARY_PATH. This does not interfere with either gfortran or gcc.
package instead. It uses G95_LIBRARY_PATH to find its library files instead of
LIBRARY_PATH. This does not interfere with either gfortran or gcc.
Q. 3. I installed g95-MinGW-41.exe but when I compiled my code the process stopped
with the message:
ld: unrecognized option `'--sysroot='
A.
1. Check if g95 is calling the correct version of ld.exe by adding -v
when compiling.
2. Try adding the g95 directory (i.e., c:\g95\bin; c:\g95\lib\gcc-lib\i686-pc-mingw32\4.1.2;) at the beginning of your PATH environment variable. If that fails, delete g95 entirely, and reinstall. Answer "yes" to all the dialogues during the install.
2. Try adding the g95 directory (i.e., c:\g95\bin; c:\g95\lib\gcc-lib\i686-pc-mingw32\4.1.2;) at the beginning of your PATH environment variable. If that fails, delete g95 entirely, and reinstall. Answer "yes" to all the dialogues during the install.
Q. 4. I executed the g95 installer on my XP Home system. Everything installed fine but the compiler complained with the message:
g95: installation problem, cannot exec 'f951': Invalid argument
A.
1. If you downloaded the g95-MinGW.exe installer add LIBRARY_PATH to
your user set of environment variables and set it to point to
\g95\lib;\g95\lib\gcc-lib\i686-mingw32\4.0.4\. If you downloaded the
g95-MinGW-41.exe installer add G95_LIBRARY_PATH to your user set of
environment variables and set
it to point to \g95\lib;\g95\lib\gcc-lib\i686-mingw32\4.1.2\
2. If it still fails, try copying f951.exe from its \g95\lib\gcc-lib\i686-mingw32\4.x.x\ location to \g95\bin
2. If it still fails, try copying f951.exe from its \g95\lib\gcc-lib\i686-mingw32\4.x.x\ location to \g95\bin
Q. 5. I installed g95-MinGW -41.exe on XP Pro. The environment variables are correctly set. I got the error:
g95: installation problem, cannot exec 'as': Invalid argument
A.
Try copying \g95\bin\as.exe and \g95\bin\ld.exe to
\g95\lib\gcc-lib\i686-mingw32\4.2.1\
Q. 6. I can't get g95 to work. My Path= ... lots of stuff and then ...;c:\g95\bin;C:\g95\lib\gcc-lib\i686-pc-mingw32\4.1.2;
A.
1. Add the g95 directory (i.e., c:\g95\bin) at the beginning of
your PATH environment variable instead of at the end.
2. Add G95_LIBRARY_PATH to your user set of environment variables and set it to point to \g95\lib;\g95\lib\gcc-lib\i686-mingw32\4.1.2
2. Add G95_LIBRARY_PATH to your user set of environment variables and set it to point to \g95\lib;\g95\lib\gcc-lib\i686-mingw32\4.1.2
Q. 7. I installed g95-MinGW-41.exe and compiled "g95 test.f".
It produced the error message:
g95: _spawnvp: Invalid argument
A.
It looks like you need to add the g95 directory to the beginning of
your PATH environment variable. This is usually done through the
Control Panel. Vista provides
setx.exe,
which is similar to the Linux SETENV utility. With SETX you can set
environment variables permanently in a CMD window with:
The /m parameter sets these values for all users. Exit and start a new CMD window. Check whether the PATH and G95_LIBRARY_PATH environment variables are set correctly by typing:
Q.
8.
I installed g95 but when I try compiling in a cmd window: 'g95 hello.f90' I see the error message shown below.
Where is my error?
SETX PATH c:\g95\bin;%PATH% /m
SETX G95_LIBRARY_PATH c:\g95\lib;c:\g95\lib\gcc-lib\i686-mingw32\4.1.2 /m
SETX G95_LIBRARY_PATH c:\g95\lib;c:\g95\lib\gcc-lib\i686-mingw32\4.1.2 /m
The /m parameter sets these values for all users. Exit and start a new CMD window. Check whether the PATH and G95_LIBRARY_PATH environment variables are set correctly by typing:
echo %PATH%
echo %G95_LIBRARY_PATH%
The setx.exe
utility is available for Windows XP in
Service Pack 2.
ld: crt2.o: No such file: No such file or directory
A.
1. If you downloaded the g95-MinGW.exe package, add LIBRARY_PATH to
your user set of environment variables and set it to point to:
\g95\lib;\g95\lib\gcc-lib\i686-mingw32\4.0.4
If the problem persists, copy copy the *.o and *.a files in g95\lib\ to:
2. If you downloaded the g95-MinGW-41.exe package, add G95_LIBRARY_PATH to your user set of environment variables and set it to point to: \g95\lib;\g95\lib\gcc-lib\i686-mingw32\4.1.2\
If the problem persists, copy the *.o and *.a files in g95\lib\ to:
Q. 9.
Why does the g95 Windows build require
environment variables to be set?If the problem persists, copy copy the *.o and *.a files in g95\lib\ to:
\g95\lib\gcc-lib\i686-pc-mingw32\4.0.4
2. If you downloaded the g95-MinGW-41.exe package, add G95_LIBRARY_PATH to your user set of environment variables and set it to point to: \g95\lib;\g95\lib\gcc-lib\i686-mingw32\4.1.2\
If the problem persists, copy the *.o and *.a files in g95\lib\ to:
\g95\lib\gcc-lib\i686-pc-mingw32\4.1.2
A.
The g95 library
and several supporting programs are separate files
from the g95 compiler, some of which may be located in different
directories. The environment variable LIBRARY_PATH or
G95_LIBRARY_PATH helps the compiler and linker find those files.
Q. 10. I tried installing g95, and now I can't see it. Where is it?
A. Are you sure you downloaded the correct file? Try downloading from:
http://ftp.g95.org/g95-MinGW-41.exe
You can "save" the file on your computer somewhere, then find it in Windows Explorer, click on it to run the installer. It will give you several options in pop-up windows, including one to select an install directory. Try selecting c:\g95 as the install directory. There are three directories created in c: \g95, bin, doc, and lib. You will find some additional information in the doc directory. Please consult the README.txt file.
If you are looking for an icon on your desktop, there won't be one. After running the installer, you have to open a CMD window to use g95. You can do this by clicking on Start, Run. Or, in Vista you can right-click on any folder while holding down the shift key, and select "Open Command Window Here" in the menu.
You can "save" the file on your computer somewhere, then find it in Windows Explorer, click on it to run the installer. It will give you several options in pop-up windows, including one to select an install directory. Try selecting c:\g95 as the install directory. There are three directories created in c: \g95, bin, doc, and lib. You will find some additional information in the doc directory. Please consult the README.txt file.
If you are looking for an icon on your desktop, there won't be one. After running the installer, you have to open a CMD window to use g95. You can do this by clicking on Start, Run. Or, in Vista you can right-click on any folder while holding down the shift key, and select "Open Command Window Here" in the menu.
Q. 11. I clicked the link http://ftp.g95.org/g95-MinGW.exe, and I saved the program in a folder under C:/. Then I clicked "run" at the start menu. I typed "g95." Then it shows me the message:
'g95' is not recognized as an internal or external command, operable program or batch file'


