ARPA-SIMC / fortrangis

A collection of Fortran interfaces to the most common Open Source GIS libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues compiling gdal_test.f90

sonjank opened this issue · comments

we've setup fortranGIS on Centos6.x. However, in order not to get segmentation fault errors during compilation we need to disable doxydoc and also shapelib.
Our main aim is to read and write geotiffs in Fortran.
We've installed all the necessary libraries, I go to the unpacked fortrangis-2.5 directory. Then we run

  1. ./configure --disable-shapelib --disable-doxydoc
  2. make
    Here it always creates the gdal.mod and proj.mod files, but only sometimes the gdal_test executable. My aim is to modify gdal_test.f90 to read in one of our geotiffs and eventually couple it to our fortran code to replace the read and write binary file functions. So, I really need to get this gdal_test executable. What are I'm missing so that it only randomly creates the gdal_test exectuable? I've looked into the makefile, but being not an expert of makefiles, I'm lost in this 1000 line long makefile.

I've also tried to run make install and go to the libfortrangis directory and make. It just tells me nothing to be done for 'all'. However, I still don't have my gdal_test exectuable ...

The Makefile is autogenerated, so almost unintelligible, you can look at Makefile.am in order to have an idea of what's going on... Anyway, gdal_test is built when you type make check since it is at the same time an example program and a test for correct functioning, so please try this way.

On the other hand, if you want to link your own program using this library, analobgous to gdal_test, you should first make install then compile using at least the flag -I<includedir> and link with -lfortranc -lfortrangis -lgdal and maybe also -L<libdir> if you did not install fortrangis in a default system path. This is common to any library you compile and install autonomously.

Please tell me whether this solves the issue.

Notice that for Centos 7 and some Fedora distros I have set up an rpm repository on copr, so that you can directly install binary packages without need to compile:

https://copr.fedorainfracloud.org/coprs/dcesari69/interfortran/packages/

See the "Quick Enable" box for understanding how to install. Unfortunately, however, this build system does not support Centos 6 anymore.

That's why I only got gdal_test compiled a couple of times, each time I did make check before! That makes sense. With that and the linking info I should be fine. Many thanks and sorry for the late reply!

Fine, good luck.