(I'm not sure about whether I should write this as an answer to my own question or add this as an edit to the question. Yet, I'm chosing to write this as an answer because I feel it's little bit bigger to be added as an edit to the question.)
I found an easier way to install FGSL using Synaptic Package Manager.
Add the key.
Add the repo deb [arch=amd64] http://lvserver.ugent.be/apt/ubuntu focal stable
.
(I also found an easier way to add new repo: Open Software & Updates application; select 'Other Softwares'; and then add the repo location.)
Open Ubuntu Software. Search for Synaptic Package Manager and install it.
Now, open Synaptic Package Manager and search 'libfgsl'. Mark the libfgsl packages for installation. (If you haven't installed GSL, then search 'libgsl' and mark the relevant gsl packages also for installation.) Then select 'Apply'.
That's it.
For using FGSL and compiling with gfortran, I found helpful instructions in this post. I used the example program (testintegral.f90, but I saved it as fgsl_test.f90) provided in that post. In my case, the fgsl.mod
file was in the location: /usr/include/fgsl/
and I used this command to compile my program
gfortran -I/usr/include/fgsl fgsl_test.f90 -lfgsl
I'm not sure whether it is necessary to add -lgsl
and -lgslcblas
but it worked fine without them.