Installation¶
The UNILIB library is available in the form of Fortran 90 sources. It is expected to compile using most FORTRAN compilers.
For reference, older versions of the library have been successfully compiled and linked using the following setups.
Linux (PC)¶
Unpackage the UNILIB distribution and change directory to the created directory. The library can be built using the standard
make
utility.
Make Libraries¶
% ls
00README.txt doc examples LICENCE.txt Makefile misc src test
% make
Making libunilib.a
gfortran -ffixed-line-length-132 -ffixed-form -std=legacy -c -o tsyg.o ./src/ext5xx/tsyg_null.f90
gfortran -fno-automatic -ffree-line-length-0 -ffixed-line-length-132 -O2 -std=legacy -I ./src -I ./misc/UNILIB_IRBEM_API -c ./src/ext530.f ./src/ext630.f ./src/ext635.f ./src/ua610.f ./src/ua630.f ./src/ud310.f ./src/ud320.f ./src/ud330.f ./src/uf410.f ./src/uf420.f ./src/ul220.f ./src/ul230.f ./src/ul240.f ./src/um510.f ./src/um520.f ./src/um530.f ./src/ut540.f ./src/ut550.f ./src/ut980.f ./src/ut990.f ./src/set_params.f ./src/version.f90 ./misc/UNILIB_IRBEM_API/IRBEMAPI.f
ar -rcs libunilib.a ext530.o ext630.o ext635.o ua610.o ua630.o ud310.o ud320.o ud330.o uf410.o uf420.o ul220.o ul230.o ul240.o um510.o um520.o um530.o ut540.o ut550.o ut980.o ut990.o set_params.o version.o IRBEMAPI.o tsyg.o
---------------
Making libunilib_fPIC.a
gfortran -ffixed-line-length-132 -ffixed-form -std=legacy -c -fPIC -o tsyg.o ./src/ext5xx/tsyg_null.f90
gfortran -fno-automatic -ffree-line-length-0 -ffixed-line-length-132 -O2 -std=legacy -I ./src -I ./misc/UNILIB_IRBEM_API -c -fPIC ./src/ext530.f ./src/ext630.f ./src/ext635.f ./src/ua610.f ./src/ua630.f ./src/ud310.f ./src/ud320.f ./src/ud330.f ./src/uf410.f ./src/uf420.f ./src/ul220.f ./src/ul230.f ./src/ul240.f ./src/um510.f ./src/um520.f ./src/um530.f ./src/ut540.f ./src/ut550.f ./src/ut980.f ./src/ut990.f ./src/set_params.f ./src/version.f90 ./misc/UNILIB_IRBEM_API/IRBEMAPI.f
ar -rcs libunilib_fPIC.a ext530.o ext630.o ext635.o ua610.o ua630.o ud310.o ud320.o ud330.o uf410.o uf420.o ul220.o ul230.o ul240.o um510.o um520.o um530.o ut540.o ut550.o ut980.o ut990.o set_params.o version.o IRBEMAPI.o tsyg.o
---------------
Making libunilib.so
gfortran -ffixed-line-length-132 -ffixed-form -std=legacy -c -fPIC -o tsyg.o ./src/ext5xx/tsyg_null.f90
gfortran -fno-automatic -ffree-line-length-0 -ffixed-line-length-132 -O2 -std=legacy -I ./src -I ./misc/UNILIB_IRBEM_API -L . -shared -o libunilib.so -fPIC ./src/ext530.f ./src/ext630.f ./src/ext635.f ./src/ua610.f ./src/ua630.f ./src/ud310.f ./src/ud320.f ./src/ud330.f ./src/uf410.f ./src/uf420.f ./src/ul220.f ./src/ul230.f ./src/ul240.f ./src/um510.f ./src/um520.f ./src/um530.f ./src/ut540.f ./src/ut550.f ./src/ut980.f ./src/ut990.f ./src/set_params.f ./src/version.f90 ./misc/UNILIB_IRBEM_API/IRBEMAPI.f ./src/uxidl_.f tsyg.o
---------------
bash-4.2$
bash-4.2$ ls
00README.txt doc examples libunilib.a libunilib_fPIC.a libunilib.so LICENCE.txt Makefile misc src test tsyg.mod
Make Examples¶
The following demonstrates making the example executables.
%
% make examples
gfortran -L . examples/example1.o -lunilib -o examples/example1.exe
gfortran -L . examples/example2.o -lunilib -o examples/example2.exe
gfortran -L . examples/example3.o -lunilib -o examples/example3.exe
gfortran -L . examples/example4.o -lunilib -o examples/example4.exe
gfortran -L . examples/example5.o -lunilib -o examples/example5.exe
gfortran -L . examples/example8.o -lunilib -o examples/example8.exe
rm examples/example3.o examples/example5.o examples/example1.o examples/example8.o examples/example2.o examples/example4.o
%
%
% ls examples
ex5.nml example1.pro example2.pro example3.pro example4.pro example6.pro example8.f try08.txt
example1.exe example2.exe example3.exe example4.exe example5.exe example7.pro example8.pro unilib.pro
example1.f example2.f example3.f example4.f example5.f example8.exe fort.65535
%
%
% # include directory with the libunilib.so files in the LD_LIBRARY_PATH environment variable.
% export LD_LIBRARY_PATH=".":${LD_LIBRARY_PATH}
%
% examples/example1.exe
SPENVIS
UNILIB Library
Version v3.00
Generated by SPENVIS team
--- Main control parameters ---
UC160 (general constants):
Geoid major axis = 6378.16 km
Geoid minor axis = 6356.77 km
Mean Earth radius (Re) = 6371.20 km
....
RESULT: magnetic field
norm = 2.567571783908246E-01 Gauss
radial component = 2.283426241361413E-01 Gauss
along colatitude = -1.097868129720019E-01 Gauss
along longitude = -4.160228786123785E-02 Gauss
%
User Executables¶
The object library (v3.00) has been built with the gfortran compiler. Assuming that the files
libunilib.a
andunilib.h
are in the same directory, the user executable code can be produced by the command:
gfortran myprog.f -L. -lunilib -o myprog.out
MS-DOS / MS-Windows¶
The object library (v3.00) has been built with the GNU Octave bash script (v8.2.0 - https://www.octave.org/) on a Microsoft Windows v10 machine. Using the GNU Octave bash shell, the user executable can be produced, as for the Linux (PC) above.
gfortran myprog.f -L. -lunilib -o myprog.exe
UNILIB/tags/v3.02