Re: WRAPIT error: wrong architecture

From: Mingxuan Chen <chen_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 16 2010 - 10:35:49 MST

Hi Mary,
   For simplify the problem, I download NCL example ce_1.ncl and data uv300.nc.
   The results show that "Segmentation fault" happened at
        plot = gsn_csm_contour_map_ce(wks,u,False)
    what is wrong?
    I already set filesize,datasize,and memoryuse as unlimited
                      stacksize 65532 kbytes.
   Thanks
Mingxuan
      
---------result--------
talus 10:19 /temp/chen> ncl ce_1.ncl
 Copyright (C) 1995-2010 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.2.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: u
Type: float
Total Size: 32768 bytes
            8192 values
Number of Dimensions: 2
Dimensions and sizes: [lat | 64] x [lon | 128]
Coordinates:
            lat: [-87.8638..87.8638]
            lon: [-180..177.1875]
Number Of Attributes: 5
  time : 7
  _FillValue : -999
  long_name : Zonal Wind
  short_name : U
  units : m/s

Variable: temp
Type: string
Total Size: 8 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
(0) test
Segmentation fault
-----------------script------
;*************************************************
; ce_1.ncl
;
; Concepts illustrated:
; - Drawing black-and-white contours over a cylindrical equidistant map
;
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
  a = addfile("uv300.nc","r")
;************************************************
; read in zonal winds
;************************************************
  u = a->U(1,:,:) ; read July zonal winds
printVarSummary(u)
;************************************************
; create default plot
;************************************************
 temp="test"
  wks = gsn_open_wks("ps","ce") ; open a ps file
 print(temp)
  plot = gsn_csm_contour_map_ce(wks,u,False) ; create a default plot
 print(temp)
end
--------------

       
On Feb 9, 2010, at 9:10 AM, Mary Haley wrote:

>
>
> On Feb 8, 2010, at 12:45 PM, Mingxuan Chen wrote:
>
>> Hi Mary,
>> There have 2 problems with this version:
>> ----------------------------------
>> 1) cam2_fig.ncl is fine with old version NCL(4.3.1)
>> For the new version,
>> --------------------
>> talus 12:27 /temp/chen> ncl cam2_fig.ncl
>> Copyright (C) 1995-2010 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 5.2.0
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>>
>> Segmentation fault
>> ---------------------------
>> I found that it will be fine if I delete drawing graphics part.
>>
>
> Mingxuan,
>
> You have a beta version of 5.2.0, and it's possible that something else is wrong with it.
>
> I don't have a MacOS 10.6 system at the moment, but I hope to get one in a week or so.
> Please email me offline then to see if I have the system, and we can test your script on it.
>
> Maybe you can try to determine where in the graphics it is failing. Can you put in some print statements to try to figure this out?
>
> Also, it would help if I could see your full script.
>
>
>>
>> 2)
>> talus DING! /temp/chen/ccsm_3h> WRAPIT.test -m64 utc_lt90.stub utc_lt.f90
>>
>> WRAPIT Version: 100111
>> COMPILING utc_lt.f90
>> LINKING
>> END WRAPIT
>> -------------------
>> WRAPIT.test is fine. when I use utc_lt90.so, there is a mismatch error.
>> -------------
>> talus 12:02 /temp/chen/ccsm_3h> ncl rd2_cam.ncl
>> Copyright (C) 1995-2010 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 5.2.0
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>>
>>
>> Variable: utch
>> Type: double
>> Total Size: 64 bytes
>> 8 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [8]
>> Coordinates:
>> Number Of Attributes: 1
>> _FillValue : -9999
>>
>>
>> fatal:Argument type mismatch on argument (0) of (utc_lt) can not coerce
>> fatal:Execute: Error occurred at or near line 44 in file rd2_cam.ncl
>> -------------------------
>>
>> subroutine utc_lt(utc,lt,lon,nt,nx)
>> implicit NONE
>> integer :: i,j,k
>> integer, intent(in) ::nt,nx
>> double precision,dimension(:) :: clon(24),dt(24)
>> double precision, dimension(:),intent (in) :: lon(nx),utc(nt)
>> double precision, dimension(:,:),intent(out) ::lt(nt,nx)
>> -------
>> argument(0) is utc (double precision)
>> in rd2_cam.ncl line 44 is
>> UTC_LT90::utc_lt(utch,loct,lon,8,128)
>> utch type is double.
>> I don't know why have error "Argument type mismatch" . Is the problem in the utc_lt90.stub?
>>
>> ------utc_lt90.stub---------
>> C NCLFORTSTART
>> subroutine utc_lt(utc,lt,lon,nt,nx)
>> integer nt,nx
>> dimension utc(nt),lt(nt,nx),lon(nx)
>> C NCLEND
>> -------------------------
>
> In your wrapper stub, you didn't declare utc, lon, and lt as double:
>
> Instead of this:
>
> dimension utc(nt),lt(nt,nx),lon(nx)
>
> try this:
>
> double precision utc(nt),lt(nt,nx),lon(nx)
>
> WRAPIT doesn't look at your *.f90 code to get the types of your variables. This is what the stub is for.
> You must declare variables in your stub file if they differ from the type of what defaut Fortran 77 assumes.
>
> --Mary
>
>
>
>>
>> Thank you very much for your help!
>>
>> Mingxuan
>>
>>
>> On Feb 6, 2010, at 10:19 AM, Mary Haley wrote:
>>
>>> Mingxuan,
>>>
>>> I didn't realize this was an OPeNDAP-enabled version of NCL.
>>>
>>> I've got another one for you to try, but I don't know what state it's in because my Mac OS 10.6 system is still out.
>>>
>>> Go to the same ftp location, and download ncl.nodap.
>>>
>>> Then:
>>>
>>> chmod gou+x ncl.nodap
>>> mv ncl.nodap $NCARG_ROOT/bin
>>>
>>> Now try using "ncl.nodap" instead of "ncl".
>>>
>>> I should warn you that this executable has other shared library dependencies:
>>>
>>> /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
>>> /usr/X11/lib/libpng12.0.dylib (compatibility version 36.0.0, current version 36.0.0)
>>> /usr/X11/lib/libcairo.2.dylib (compatibility version 10803.0.0, current version 10803.6.0)
>>> /usr/X11/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.20.0)
>>> /usr/X11/lib/libXpm.4.dylib (compatibility version 16.0.0, current version 16.0.0)
>>> /usr/X11/lib/libX11.6.dylib (compatibility version 9.0.0, current version 9.0.0)
>>> /usr/X11/lib/libXext.6.dylib (compatibility version 11.0.0, current version 11.0.0)
>>> /usr/local/gfortran/lib/x86_64/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
>>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0)
>>> /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
>>>
>>> The X11 stuff should be there if you installed the X11 developer's tools off your MacOS CD (maybe it's the default for Mac OS 10.6).
>>> You may need to install gfortran, if you haven't already, in order to get the "/usr/local/gfortran/lib/x86_64/libgfortran.3.dylib" file.
>>>
>>> --Mary
>>>
>>> On Feb 5, 2010, at 4:03 PM, Mingxuan Chen wrote:
>>>
>>>> Hi Mary,
>>>> As previous email, WRAPIT.test is successful.
>>>> But ncl didn't work anymore.
>>>> Would you please look at it?
>>>> Thank you very much!
>>>> Mingxuan
>>>> -----------------------
>>>> talus DING! /Users/chen/Diurnal> ncl rd_cam.ncl
>>>> dyld: Library not loaded: /opt/local/lib/libnc-dap.3.dylib
>>>> Referenced from: /usr/local/bin/ncl
>>>> Reason: image not found
>>>> Trace/BPT trap
>>>> ---------------------
>>>>
>>>> On Feb 4, 2010, at 9:01 AM, Mary Haley wrote:
>>>>
>>>>> Mingxuan (and others),
>>>>>
>>>>> We have a test MacOS 10.6 binary if anybody wants to try it. Many thanks go to Guangshan Chen for being very patient and building this on his machine after much trial and error.
>>>>>
>>>>> To get the gzipped tar file:
>>>>>
>>>>> ftp ftp.ucar.edu
>>>>> <log in as "anonymous">
>>>>> <Use email address as password>
>>>>> cd /pub/scd/haley
>>>>> get ncl_ncarg-5.1.1.MacOS10.6_i386.tar.gz
>>>>> quit
>>>>>
>>>>> Once you have the file, you need to uncompress and untar it wherever
>>>>> you want the software to reside. For example, if you want the software
>>>>> in /usr/local, then move the file to /usr/local and type the
>>>>> following:
>>>>>
>>>>> gunzip ncl_ncarg-5.1.1.MacOS10.6_i386.tar.gz
>>>>> tar -xvf ncl_ncarg-5.1.1.MacOS10.6_i386.tar
>>>>>
>>>>> You can then remove the file ncl_ncarg-5.1.1.MacOS10.6_i386.tar or save it
>>>>> somewhere.
>>>>>
>>>>> You also need to setenv NCARG_ROOT to the parent directory (/usr/local
>>>>> in this case), and make sure $NCARG_ROOT/bin (/usr/local/bin in this
>>>>> case) is on your search path.
>>>>>
>>>>> Mingxuan: once you have this file, try WRAPIT.test again, with the "-m64" option.
>>>>>
>>>>> --Mary
>>>>>
>>>>>
>>>>> On Feb 3, 2010, at 10:09 AM, Mingxuan Chen wrote:
>>>>>
>>>>>> Hi Mary,
>>>>>>
>>>>>> The following is the results of WRAPIT.test
>>>>>>
>>>>>> --------
>>>>>> talus 9:37 /temp/chen> WRAPIT.test -m32 utc_lt90.stub utc_lt.f90
>>>>>>
>>>>>> WRAPIT Version: 100111
>>>>>> COMPILING utc_lt.f90
>>>>>> LINKING
>>>>>> ld: warning: in /usr/local/lib/libgfortran.dylib, file is not of required architecture
>>>>>> END WRAPIT
>>>>>> --------------------------
>>>>>> Is it indicate gfortran is in 64 bit.
>>>>>> Do you have NCL -m64 version?
>>>>>> Thank you very much for your help!
>>>>>> Mingxuan
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Feb 2, 2010, at 10:22 PM, Mary Haley wrote:
>>>>>>
>>>>>>> Mingxuan,
>>>>>>>
>>>>>>> I have a feeling that since you are running MacOS 10.6, it may be trying to compile your *.f code in 64-bit (-m64) mode. The version of NCL that you have may be a 32-bit (-m32) version. You can't mix 32-bit and 64-bit compilations in this case.
>>>>>>>
>>>>>>> Do you know if you are running a version of NCL that was compiled for MacOS *10.5*? If so, then this is definitely a 32-bit version.
>>>>>>>
>>>>>>> If you think you have a 32-bit version of NCL, then try running this attached version of WRAPIT with the "-m32" option:
>>>>>>>
>>>>>>> WRAPIT.test -m32 utc_lt90.stub utc_lt.f90
>>>>>>>
>>>>>>> You may need to make it executable first:
>>>>>>>
>>>>>>> chmod gou+x WRAPIT.test
>>>>>>> <WRAPIT.test>
>>>>>>>
>>>>>>> --Mary
>>>>>>>
>>>>>>>
>>>>>>> On Feb 2, 2010, at 11:00 AM, Mingxuan Chen wrote:
>>>>>>>
>>>>>>>> Hello,
>>>>>>>> I run "WRAPIT utc_lt90.stub utc_lt.f90", and obtained "utc_lt90.so".
>>>>>>>> When I use
>>>>>>>> "external utc_lt90 "./utc_lt90.so"
>>>>>>>> There is error message:
>>>>>>>> warning:An error occurred loading the external file ./utc_lt90.so, file not loaded
>>>>>>>> dlopen(./utc_lt90.so, 2): no suitable image found. Did find:
>>>>>>>> ./utc_lt90.so: mach-o, but wrong architecture
>>>>>>>> warning:error at line 5
>>>>>>>>
>>>>>>>> What is wrong?
>>>>>>>> WRAPIT is version : 091416
>>>>>>>> NCL version 5.1.1
>>>>>>>> it run at Max Os X 10.6.2
>>>>>>>>
>>>>>>>> Thank you for your help
>>>>>>>>
>>>>>>>> Mingxuan
>>>>>>>>
>>>>>>>> -------
>>>>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>>>>>> external UTC_LT90 "./utc_lt90.so"
>>>>>>>> begin
>>>>>>>> .................
>>>>>>>> ---------
>>>>>>>> _______________________________________________
>>>>>>>> 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
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 16 10:36:15 2010

This archive was generated by hypermail 2.1.8 : Thu Feb 18 2010 - 10:33:29 MST