[Scons-users] Suffix for Fortran 90 source files

Bill Deegan bill at baddogconsulting.com
Sat Mar 17 13:05:35 EDT 2018


Here's the code which generates the default tools to load per platform.

It will walk each type of tool and try to initialize each until it finds
one of each type.
In the process of doing so, it will configure various Environment()
variables
(you can see the list in the manpage:
http://scons.org/doc/production/HTML/scons-man.html )

I think the problem is that ifort doesn't set .f90 as a suffix by default.

Can you add the following to your ifort.py in SCons/Tool

Change:

from .FortranCommon import add_all_to_env

to

from .FortranCommon import add_all_to_env, add_f90_to_env


After:

SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan)

Add:

add_f90_to_env(env)


Then remove the FORTRANFILESUFFIXES from your Environment() and see if
that works.

-Bill





On Fri, Mar 16, 2018 at 11:31 PM, Norio Takemoto <norio.takemoto at gmail.com>
wrote:

> Dear Bill,
>
> thank you, but I got the following error.
>
> scons: Building targets ...
> ilink /O:main main.o
> sh: 1: ilink: not found
> scons: *** [main] Error 127
> scons: building terminated because of errors.
>
> Just to get the build done, I found that the following works:
>
> env = Environment(
>         FORTRANFILESUFFIXES=['.F', '.f', '.F90', '.f90'])
>
> However, I don't understand how `.i90` or `.I90` shows up by default.
>
> I found that SCons v.3.0.0 on another machine does not have this issue.
>
> I started to see that SCons looks into some information in each
> machine and sets up the construction variable. I would like to know
> the process better.
>
> Sincerely,
> Norio
>
> On Fri, Mar 16, 2018 at 9:52 PM, Bill Deegan <bill at baddogconsulting.com>
> wrote:
> > try:
> >
> > env = Environment(tools=['f90','ifort','ilink'])
> > print('-----------------------')
> > print(env.Dump())
> > print('-----------------------')
> > env.Program('main.f90')
> >
> > -Bill
> >
> > On Fri, Mar 16, 2018 at 10:19 PM, Norio Takemoto <
> norio.takemoto at gmail.com>
> > wrote:
> >>
> >> Dear Bill,
> >>
> >> thank you for your reply. I'm using Intel ifort 17.0.3.
> >>
> >> Sincerely,
> >> Norio
> >>
> >> On Fri, Mar 16, 2018 at 5:39 PM, Bill Deegan <bill at baddogconsulting.com
> >
> >> wrote:
> >> > Norio,
> >> >
> >> > What fortran compiler are you using?
> >> >
> >> > -Bill
> >> >
> >> > On Fri, Mar 16, 2018 at 5:40 PM, Norio Takemoto
> >> > <norio.takemoto at gmail.com>
> >> > wrote:
> >> >>
> >> >> Dear Scons User Mailing List,
> >> >>
> >> >> I am having a problem with building a program from a Fortran 90
> source
> >> >> file with Scons v3.0.0 on Ubuntu 14.04, and I realized that scons
> >> >> expects suffix `.i90`, `.I90`, `.i`, or `.I` for Fortran90 or some
> >> >> other Fortran standards, while I am familiar with suffix `.f90`,
> >> >> `.F90`, `.f`, and `.F`. More precisely, I saw that the relevant Scons
> >> >> construction variables are set as following:
> >> >>
> >> >>     'F90FILESUFFIXES': ['.i90'],
> >> >>     'FORTRANFILESUFFIXES': ['.i'],
> >> >>     'FORTRANSUFFIXES': [ '.i',
> >> >>                          '.fpp',
> >> >>                          '.FPP',
> >> >>                          '.I',
> >> >>                          '.f77',
> >> >>                          '.F77',
> >> >>                          '.i90',
> >> >>                          '.I90',
> >> >>                          '.f95',
> >> >>                          '.F95',
> >> >>                          '.f03',
> >> >>                          '.F03',
> >> >>                          '.f08',
> >> >>                          '.F08'],
> >> >>
> >> >> What is the reason to replace f and F with i and I in some places? Is
> >> >> it done intentionally? Are these variables hard-coded somewhere in
> the
> >> >> source code of scons, or are they set while scons starts up in my
> >> >> environment?
> >> >>
> >> >> Below is some reference information about my environment.
> >> >>
> >> >> I installed this Scons v3.0.0 by downloading the tar.gz file from
> >> >> http://scons.org/pages/download.html
> >> >> and doing
> >> >> `$ python setup.py install --prefix=$HOME/opt/scons`
> >> >>
> >> >> It looks Scons v3.0.1 also sets the suffixes in a similar way as far
> >> >> as I tried the 'scons-local' package.
> >> >>
> >> >> Scons v.2.4.1 that I installed on another machine via the apt package
> >> >> of Ubuntu 16.04 recognizes `.f90`, `.F90`, `.f`, and `.F`.
> >> >>
> >> >> My Fortran source file `main.f90` is as simple as following:
> >> >>
> >> >>     program s000
> >> >>       implicit none
> >> >>       write(*,*) 'hello'
> >> >>     end program s000
> >> >>
> >> >> My `Sconstruct` is
> >> >>
> >> >>     env = Environment()
> >> >>     print('-----------------------')
> >> >>     print(env.Dump())
> >> >>     print('-----------------------')
> >> >>     env.Program('main.f90')
> >> >>
> >> >> The standard output of `scons` is the following:
> >> >>
> >> >> ```
> >> >> norio$ scons
> >> >> scons: Reading SConscript files ...
> >> >> -----------------------
> ...
>


> >> >>   'FORTRANSUFFIXES': [ '.i',
> >> >>                        '.fpp',
> >> >>                        '.FPP',
> >> >>                        '.I',
> >> >>                        '.f77',
> >> >>                        '.F77',
> >> >>                        '.i90',
> >> >>                        '.I90',
> >> >>                        '.f95',
> >> >>                        '.F95',
> >> >>                        '.f03',
> >> >>                        '.F03',
> >> >>                        '.f08',
> >> >>                        '.F08'],
> ...
>


> >> >> -----------------------
> >> >> scons: done reading SConscript files.
> >> >> scons: Building targets ...
> >> >> gcc -o main main.f90
> >> >> gcc: error trying to exec 'f951': execvp: No such file or directory
> >> >> scons: *** [main] Error 1
> >> >> scons: building terminated because of errors.
> >> >> norio$
> >> >> ```
> >> >>
> >> >> I would appreciate it if you could kindly explain me how the
> >> >> construction variables are initialized or give me any relevant
> >> >> information.
> >> >>
> >> >> Sincerely,
> >> >> Norio
> >> >> _______________________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180317/c212b125/attachment.html>


More information about the Scons-users mailing list