https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94931

--- Comment #6 from Ryo Furue <ryofurue at gmail dot com> ---
Thanks again for your comments!

> For a software developer, I
> would put the libraries in ${INSTALLDIR}/lib and modules
> in ${INSTALLDIR?/modules.  INSTALLDIR could be /usr/local,
> and, of course, you would describe this in the user and
> installation manuals.

I see.  So, the directory gfortran searches by default is not intended for
non-gfortran libraries.

I'm definitely drifting off-topic, but my question/request stemmed from the
fact that I initially didn't know why 

    gfortran mysourcefile.f -lnetcdff -netcdff

didn't find /usr/include/netcdf.inc . I thought somethig was wrong.  In
hindsight, it's because gfortran doesn't search /usr/include/ .  So, eventually
I learned that

    gfortran -I/usr/include mysourcefile.f -lnetcdff -lnetcdf

is the answer.

But, then the question is, why don't you need the -L option? as in

    gfortran -I/usr/include mysourcefile.f -L/usr/lib -lnetcdff -netcdf


Why is this asymmetry?  It seems that there are "standard" places to place
libraries but not include files . . . 

I'm not blaming gfortran at all. I'm just wondering what I should say to the
packager of the netCDF library (or what I should do, if I were to package this
library).


Returning to the original issue: Although I led you in the wrong direction
(--print-search-dir, and I'm sorry about that), my original request may not be
invalid: I think it would be nice if the answer(*) is available somewhere,
either in the form of an output from a command line option or in the official
document or somewhere.


(*) the answer to the question: where does gfortran search for include files by
default?  (Answer: the current directory and an internal directory where
gfortran's internal modules are stored.)

Reply via email to