Old g95 (for the make use of)

I needed to compile a Windows g95 binary for someone. I have Win 7 in a VM on VirtualBox. I had the g95 install tree from a (quite old) back-up of a previous computer, but not a proper install.

The install tree looks like this:

C:\util>dir /s g95
 Volume in drive C has no label.
 Volume Serial Number is 8440-3CD9

 Directory of C:\util\g95

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
23/08/2012  09:42 AM              bin
23/08/2012  09:42 AM              doc
23/08/2012  09:42 AM              lib
23/08/2012  09:42 AM            55,782 uninstall-g95.exe
               1 File(s)         55,782 bytes

 Directory of C:\util\g95\bin

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
26/03/2008  11:49 AM           553,984 ar.exe
26/03/2008  11:49 AM           827,904 as.exe
17/06/2009  09:44 PM           123,046 g95.exe
26/03/2008  11:49 AM           782,848 ld.exe
28/12/2007  12:23 AM            15,964 mingwm10.dll
26/03/2008  11:49 AM           554,496 ranlib.exe
26/03/2008  11:49 AM           685,568 strip.exe
               7 File(s)      3,543,810 bytes

 Directory of C:\util\g95\doc

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
16/10/2004  09:36 PM            17,015 bg.gif
27/11/2004  03:51 AM            18,007 COPYING.txt
08/12/2005  06:19 AM            22,431 docs.html
23/11/2004  12:00 PM           107,122 g95.bmp
02/01/2007  01:59 AM           170,619 G95Manual.pdf
31/05/2008  06:59 AM            11,858 Readme.html
31/05/2008  07:00 AM             6,687 README.txt
               7 File(s)        353,739 bytes

 Directory of C:\util\g95\lib

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
28/12/2007  12:23 AM             2,192 crt1.o
28/12/2007  12:23 AM             2,288 crt2.o
28/12/2007  12:23 AM             1,239 dllcrt2.o
23/08/2012  09:42 AM              gcc-lib
22/10/2006  01:27 AM           408,608 libadvapi32.a
30/10/2005  11:13 AM           253,890 libgdi32.a
22/10/2006  01:27 AM           594,018 libkernel32.a
28/12/2007  12:23 AM               458 libm.a
28/12/2007  12:23 AM             7,514 libmingw32.a
28/12/2007  12:23 AM           267,880 libmingwex.a
28/12/2007  12:23 AM            82,558 libmoldname.a
28/12/2007  12:23 AM           503,692 libmsvcrt.a
22/10/2006  01:27 AM           128,262 libshell32.a
22/10/2006  01:27 AM           435,754 libuser32.a
30/10/2005  11:13 AM            82,086 libws2_32.a
              14 File(s)      2,770,439 bytes

 Directory of C:\util\g95\lib\gcc-lib

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
23/08/2012  09:42 AM              i686-pc-mingw32
               0 File(s)              0 bytes

 Directory of C:\util\g95\lib\gcc-lib\i686-pc-mingw32

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
23/08/2012  09:42 AM              4.0.4
               0 File(s)              0 bytes

 Directory of C:\util\g95\lib\gcc-lib\i686-pc-mingw32\4.0.4

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
23/08/2012  09:42 AM             1,022 cc1.lnk
17/06/2009  09:44 PM         5,242,021 f951.exe
17/06/2009  09:44 PM           859,168 libf95.a
17/06/2009  09:44 PM            61,284 libgcc.a
               4 File(s)      6,163,495 bytes

     Total Files Listed:
              33 File(s)     12,887,265 bytes
              20 Dir(s)  42,207,707,136 bytes free

Now, all that is required to make this work is to set some environment variables. (Start → Control Panel → System → Advanced System Settings → Environment Variables).

First, I had to put some directories in the path, so I edit the PATH variable. It works if I have the path to the g95.exe binary and also to the f951.exe file. That is:

PATH=C:\util\g95\bin;c:\util\winvi;c:\util\g95\lib\gcc-lib\i686-pc-mingw32\4.0.4;[[INSERT REST OF PATH HERE]]

I’ve put [[INSERT REST OF PATH HERE]] at the back, but I’ve actually got the g95-related paths at the back (you want the most commonly used bits of the path at the front, not that it matters with modern fast coomputers). Then, I want to create a new variable called LIBRARY_PATH:

LIBRARY_PATH=c:\util\g95\bin;c:\util\g95\lib\gcc-lib\i686-pc-mingw32\4.0.4;c:\util\g95\lib

Now, I don’t know if I need all three directories in the LIBRARY_PATH, but it works so I am not complaining.

So to compile my tiny little program I can now type:

X:\Downloads\Brill_dir>g95 -o Brill.exe brillouin.f90

And it works. Is it statically linked? Well, on Linux, dynamically linked, compiled with GFortran, it’s about 68 kB. This binary is about 360 kB, so I sure hope it is statically linked!

Caveats: I have not tried anything fancier than this absolutely basic compile. It works. Compiling with the -static flag makes no difference to the size of the binary.

FWIW

Advertisements

Tags: , , , , , ,

About Darren

I'm a scientist by training, based in Australia.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: