Re: Using fortran subroutine in NCL

From: Lei Meng <dream916_at_nyahnyahspammersnyahnyah>
Date: Tue Dec 29 2009 - 14:01:19 MST

Hi Mary,
    After setting the LD_LIBRARY_PATH environmental variable, it works.
Thank you and Happy New Year!
   Lei

On Tue, Dec 29, 2009 at 11:03 AM, Mary Haley <haley@ucar.edu> wrote:

> Lei,
>
> I think this is coming out of "foo.so" and not ncl. What does it report if
> you type:
>
> ldd foo.so
>
> I'm guessing you need to set the LD_LIBRARY_PATH environment variable to
> point to the location of your libgfortran.so.3 library.
>
> For example, if the file is in /usr/local/gfortran/lib, and you're running
> tcsh or csh:
>
> setenv LD_LIBRARY_PATH /usr/local/gfortran/lib
>
> or, if you already have a LD_LIBRARY_PATH:
>
> setenv LD_LIBRARY_PATH /usr/local/gfortran/lib:$LD_LIBRARY_PATH
>
>
> For bash/ksh/sh:
>
> export LD_LIBRARY_PATH=/usr/local/gfortran/lib
>
> or:
>
> export LD_LIBRARY_PATH=/usr/local/gfortran/lib:$LD_LIBRARY_PATH
>
>
> or:
>
> LD_LIBRARY_PATH=/usr/local/gfortran/lib:$LD_LIBRARY_PATH
> export LD_LIBRARY_PATH
>
> The LD_LIBRARY_PATH environment variable can be set in one of your ".*"
> files (.bashrc, .cshrc, etc) so that it takes effect every time you log in.
> Check to see where other environment variables---like NCARG_ROOT---are being
> set and you can add LD_LIBRARY_PATH to this file.
>
> --Mary
>
>
> On Dec 26, 2009, at 5:27 PM, Lei Meng wrote:
>
> Hi Dennis,
> I was able to compile the attached foo.f file. When using ncl to execute
> it, libgfortran.so.3 can not open shared object file. :
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> warning:An error occurred loading the external file ./foo.so, file not
> loaded
> libgfortran.so.3: cannot open shared object file: No such file or directory
> warning:error at line 1 in file ex1.ncl
>
> fatal:syntax error: line 10 in file ex1.ncl before or near :
> FOO:
> ------^
>
> fatal:error in statement
> fatal:Syntax Error in block, block not executed
> fatal:error at line 14 in file ex1.ncl
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Do you have any suggestions on what I should diagnose?
> Thanks,
> Lei
>
>
> On Sat, Dec 26, 2009 at 5:15 PM, Lei Meng <dream916@gmail.com> wrote:
>
>> Hi Dennis,
>> Which editor did you use to create the two files? I used UltraEdit to
>> delete the lines after the last character and it did not work. However, when
>> I manually typed the codes via vi and saved them, it worked. It seems that
>> the error might be associated with the editor I used. Thanks,
>> Lei
>>
>>
>> On Sat, Dec 26, 2009 at 3:01 PM, Dennis Shea <shea@ucar.edu> wrote:
>>
>>> I just copied the codes. I used the gfortran, intel and portland_group
>>> fompilers. Every thing worked fine. For example:
>>>
>>>
>>> %> WRAPIT -gf -fPIC quad90.stub quad.f90
>>>
>>> WRAPIT Version: 091416
>>>
>>> COMPILING quad.f90
>>> LINKING
>>> END WRAPIT
>>>
>>> ====
>>>
>>> Sometime there are unseen characters [eg: ^M] so I suggest
>>> manually deleteing everything after the last character.
>>>
>>> Good luck
>>>
>>>
>>> Lei Meng wrote:
>>>
>>>> Hi,
>>>> I am testing a fortran subroutine in NCL using the following two files
>>>> (see below). I used "WRAPIT quad90.stub quad.f90" to compile it. An error
>>>> messange"
>>>> - - - - - - - - -
>>>> WRAPIT Version: 091416
>>>> A syntax error occurred while parsing:
>>>> COMPILING quad.f90
>>>> LINKING
>>>> END WRAPIT
>>>> - - - - - - -- - - -
>>>> It did not provide any hints on what is the syntax error. Is there
>>>> anything wrong with my WRAPIT version? Thanks,
>>>>
>>>> ----------------quad90.stub---------------
>>>> C NCLFORTSTART
>>>> subroutine cquad(a,b,c,nq,x,quad)
>>>> real a,b,c
>>>> integer nq
>>>> dimension x(nq),quad(nq)
>>>> C NCLEND
>>>> --------------------------------------
>>>> ---------------------quad.f90------------
>>>> subroutine cquad(a,b,c,nq,x,quad)
>>>> implicit none
>>>> integer, intent(in) ::nq
>>>> real, intent(in) ::a,b,c,x(nq)
>>>> real, intent(out) ::quad(nq)
>>>> integer ::i
>>>>
>>>> quad = a*x**2+b*x+c
>>>> return
>>>> end subroutine cquad
>>>> ------------------------------------------
>>>> Thanks,
>>>> Lei
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>
>>
> <ex1.ncl><foo.f>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Dec 29 14:01:43 2009

This archive was generated by hypermail 2.1.8 : Tue Jan 05 2010 - 11:04:11 MST