[Scons-users] How do I compile F90?

罗飞 geoluo1217 at gmail.com
Fri Apr 10 05:42:46 EDT 2015


It is a SConscript.It is a module.In my SConstruct,I use
SConscript(dir/say.f90).
Perhaps, it is complex! So I write a simple one by your method.
===========================================
SConstruct:
  1 import os
  2 env=Environment(TOOLS=['ifort'], ENV={'PATH': os.environ['PATH'] +
os.pathsep + '/home/apps/intel/composer_xe_2013_sp1.0.080/bin/intel64'})
  3 env.Program('helloscons.f90')
============================
scons:
scons: Reading SConscript files ...
AttributeError: 'SConsEnvironment' object has no attribute 'Program':
  File "/home/luofei/Test/Fscons/test/SConstruct", line 7:
    env.Program('helloscons.f90')
===================================
helloscons.f90:

  program test
  print*,'helloscons'
  End program test
======================================================



2015-04-10 17:30 GMT+08:00 Ian Ross <ian at skybluetrades.net>:

> What is dir/say.o?  Is it an already compiled object file?  Or are you
> expecting to generate it from F90 source or something else?
>
> On 10 April 2015 at 11:21, 罗飞 <geoluo1217 at gmail.com> wrote:
>
>> I thank you very much for your help!
>>  I modify my SConstruct:
>>   1 import os
>>   2
>> #env=Environment(F90='/home/apps/intel/composer_xe_2013_sp1.0.080/bin/intel64/ifort')
>>  * 3 env=Environment(TOOLS=['ifort'], ENV={'PATH': os.environ['PATH'] +
>> os.pathsep + '/home/apps/intel/composer_xe_2013_sp1.0.080/bin/intel64'})*
>>   4 Export('env')
>>   5 SConscript('dir/SConscript')
>>   6 env.Object('helloscons.f90')
>>   7 env.Program('234',['dir/say.o','helloscons.o'])
>> ================================================
>> But it still wrong!
>> scons
>> scons: Reading SConscript files ...
>> scons: *** While building `['say.o']' from `['say.f90']': Don't know how
>> to build from a source file with suffix `.f90'.  Expected a suffix in this
>> list: ['.i', '.fpp', '.FPP', '.I', '.f77', '.F77', '.i90', '.I90', '.f95',
>> '.F95'].
>> File "/home/luofei/Test/Fscons/dir/SConscript", line 3, in <module>
>> =========================================================
>> I can tell you '/home/apps/intel/composer_xe_2013_sp1.0.080/bin/intel64/ifort'
>> is absolute path
>>
>> 2015-04-10 16:55 GMT+08:00 Ian Ross <ian at skybluetrades.net>:
>>
>>> Assuming that ifort is in your path, you can say
>>>
>>> env=Environment(TOOLS=['ifort'])
>>>
>>> to create your environment.  This will make sure that ifort is used for
>>> compiling and linking and will also set the relevant compiler flags
>>> correctly.
>>>
>>> I'm not completely sure, but I think you can specify and explict path to
>>> look for ifort and its supporting tools by doing something like this:
>>>
>>> env=Environment(TOOLS=['ifort'], ENV={'PATH': os.environ['PATH'] +
>>> os.pathsep + '/home/apps/intel/composer_xe_2013_sp1.0.080/bin/intel64'})
>>>
>>> (That might not be the best way to do things.  Perhaps someone else can
>>> comment?)
>>>
>>>
>>> On 10 April 2015 at 10:36, 罗飞 <geoluo1217 at gmail.com> wrote:
>>>
>>>> Dear developer,
>>>>>
>>>>>       I am learning scons. But,I happened a problem.Please see the
>>>>> screenshot:
>>>>
>>>>          This is my SConstruct:
>>>> ====================================================================
>>>>   1 import os
>>>>   2
>>>> env=Environment(F90='/home/apps/intel/composer_xe_2013_sp1.0.080/bin/intel64/ifort')
>>>>   3 Export('env')
>>>>   4 SConscript('dir/SConscript')
>>>>   5 env.Object('helloscons.f90')
>>>>   6 env.Program('234',['dir/say.o','helloscons.o'])
>>>> ====================================================================
>>>>         scons
>>>> scons: Reading SConscript files ...
>>>> scons: done reading SConscript files.
>>>> scons: Building targets ...
>>>> /home/apps/intel/composer_xe_2013_sp1.0.080/bin/intel64/ifort -o
>>>> dir/say.o -c dir/say.f90
>>>> /home/apps/intel/composer_xe_2013_sp1.0.080/bin/intel64/ifort -o
>>>> helloscons.o -c helloscons.f90
>>>> gfortran -o 234 dir/say.o helloscons.o
>>>> dir/say.o: In function `hello_mp_say_':
>>>> dir/say.f90:(.text+0x4e): undefined reference to `for_write_seq_lis'
>>>> helloscons.o: In function `MAIN__':
>>>> helloscons.f90:(.text+0x1f): undefined reference to
>>>> `__intel_new_feature_proc_init'
>>>> helloscons.f90:(.text+0x38): undefined reference to `for_set_reentrancy'
>>>> collect2: ld returned 1 exit status
>>>> scons: *** [234] Error 1
>>>> scons: building terminated because of errors.
>>>> =====================================================================
>>>>       You can see it used ifort to compile *.f90,but it used gfortran
>>>> to link *.o.
>>>>       Why?
>>>>       Can you tell me how I make scons link *.o by ifort?
>>>>
>>>>
>>>> Thanks!
>>>> Fei Luo
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>
>>>
>>> --
>>> Ian Ross   Tel: +43(0)6804451378   ian at skybluetrades.net
>>> www.skybluetrades.net
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
>
> --
> Ian Ross   Tel: +43(0)6804451378   ian at skybluetrades.net
> www.skybluetrades.net
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150410/e2aa629e/attachment-0001.html>


More information about the Scons-users mailing list