[ncl-install] gfortran error? installing NCL on Mac OS X Lion

Mary Haley haley at ucar.edu
Fri Apr 20 11:29:59 MDT 2012


Hi Yoichi,

I will try to improve the MacOS install page using your suggestions below.

Most of the stuff on this page are *suggestions* for ways to do things, and
not absolute things you must do.

For example, some people who have older Macs may still be using "fink".
Other people prefer to use "port" to install packages.  Other people may
prefer to install packages from a website.  It just depends on what your personal style is.

I'll address some of your comments below:


On Apr 19, 2012, at 8:45 PM, Yoichi Takayama wrote:

> Please improve this page:
> 
> http://www.ncl.ucar.edu/Download/macosx.shtml
> 
> The instructions are confusing and probably not clear or contradicting.
> 
> My system set up is:
> Mac OS X 1.7
> Xcode 4.3.2
> ncl_ncarg-6.0.0.MacOS_10.6_64bit_gcc421.tar.gz (It is mentioned that this should work with OSx 10.7)

It should, with some minor issues as I will address below where I talk about "cpex08".

> gfortran 4.6.2
> 
> Environment (.bash_profile)
> export NCARG_ROOT=/usr/local
> export PATH=$NCARG_ROOT/bin:$PATH
> export DISPLAY=:0.0
> 
> Created .hluresfile in $HOME
> 
> 
> (1) Which gfortran?
> 
> The page tells me to do first:
> 	sudo port install gcc45 +gfortran
> Then, later it tells me to do this:
> 
> 	fink install gfortran

I will add something saying that "fink" is not necessary if you are using "port".


> 
> Also, within the same section, it tells me that you got it from:
> 
> 	http://gcc.gnu.org/wiki/GFortranBinaries#MacOS
> 
> All installs different versions of gfortran and probably it is not necessary to do all these 3.

Correct. These are just examples of different ways to do things.

> 
> Also, later in the part close to the end, it says that the fortran version that the NCL binary is built against it should be installed.
> 
> I have installed ncl_ncarg-6.0.0.MacOS_10.6_64bit_gcc421.tar.gz, but it is not clear what version of gfortran is used (Is it the same as GCC version, which is 4.2.1?).

Yes. Although, it is *possible* to use different versions of gcc/gfortran. Not highly recommended, though, because if they are too far apart in versions, they might not be compatible.

> 
> Also, when I installed Xcode 4.3.2, gcc and gfortran were installed already.

I will include a note about this.

> 
> Also, fink install gfortran did not work, but this may be the one to use:
> 
> 	fink install gfortran-shlibs [virtual library]

I recommend staying away from fink, if you have a newer Mac.

> 
> This installs gcc47-shlibs-4.7.0-100. Not sure what gfortran version it is, but I presume that gfortran is just a part of GCC and probably has the same version number???
> 
> By any rate, you also mentions that you have used gfortran from http://gcc.gnu.org/wiki/GFortranBinaries#MacOS.
> 
> This provides only gfortran-4.6.2-x86_64-Lion.dmg for download.
> 
> This is the gfortran package installed last on this system.
> 

Again, these are just suggestions. There are many ways to get software installed on your system, and this is sometimes a moving target.

> $ gfortran --version
> GNU Fortran (GCC) 4.6.2 20111019 (prerelease)
> Copyright (C) 2011 Free Software Foundation, Inc.
> 
> 
> 
> (2) Xcode 4.3.2
> 
> After installing Xcode 4.3.2, I have "downloaded" command line tools previously (before installing the gfortran).
> 
> Then ran sudo port install gcc45 +gfortran.
> 
> However, this causes warnings to run: 
> 
> 	sudo xcode-select -switch /Applications/Xcode.app
> 
> Please add this information to the note, since this had better be done before issuing the port install command

> 
> (3) limit command
> 
> I have put limit stacksize unlimited into .bash_profile but:
> 
> 	-bash: limit: command not found

This may be the tcsh way of doing things.

Try:

ulimit -s unlimited


> 

> It does not seem to be installed or not in the PATH. Where could it be?
> 
> 
> (4) How to install the donwloaded NCL binary
> 
> There should be a link (or a correct order to do installation) or consolidated note about how to install NCL from the downloaded binary.
> 
> Typical users will go to this page but will see the link to Mac OS X installation note "Running NCL under MacOSX" and would not find a cohesive installation instruction there or will not think to combine the instructions with this link:
> 
> 	http://www.ncl.ucar.edu/Download/install.shtml
> 
> By the way, this page says it would require csh or tcsh, but Mac requires only bash.

You need csh in order to run some of the tools that come with NCL, like "ncl_filedump" and "ncl_convert2nc".

> 
> Please correct it to include Mac OS X, or include the similar instruction (step-by-step of how to install and test/run) in the "Running NCL under MacOSX".
> 
> 
> (5) Testing
> 
> After installing all these and setting below: (by the way default shell is bash, please correct this in your pages, too)
> 
> 	export DYLD_LIBRARY_PATH=/usr/local/lib

Again, this is an example. I will try to include both bash and c-shell examples, but I'm hoping that once you do it, 
I don't need to keep showing both examples again.

> 
> I had to hunt for information on how to install the NCL binary and set up its environment as (4).
> 
> For how to test and use, there should be a link to: (or the same should be included on the Mac OS Note page)
> 
> 	http://www.ncl.ucar.edu/get_started.shtm
> 
> From install.shml page, these two commands worked:
> 
> 	ng4ex gsun01n
> 	ncl gsun01n.ncl
> 
> However, this did not:
> $ ncargex cpex08 -clean
> 
> NCAR Graphics Fortran  Example <cpex08>
> 
>   Copying cpex08.f
> 
>   Copying cpexcc.f
> 
> Compiling and linking...
> gfortran -fPIC -fno-range-check -m64 -O -o cpex08 cpexcc.f cpex08.f -L/usr/local/lib -L/usr/X11R6/lib -lncarg -lncarg_gks -lncarg_c -lXpm -lX11 -lXext
> Undefined symbols for architecture x86_64:
>   "__gfortran_transfer_character_write", referenced from:
>       _capsap_ in ccUEA5Vc.o
>   "__gfortran_transfer_integer_write", referenced from:
>       _capsap_ in ccUEA5Vc.o
>   "__gfortran_set_options", referenced from:
>       _main in ccryWR2Q.o
>   "__gfortran_os_error", referenced from:
>       _mdlnam_ in libncarg.a(mdlnam.o)
>       _mdlndr_ in libncarg.a(mdlndr.o)
>       _dpgetc_ in libncarg.a(dpgetc.o)
>       _dpgetr_ in libncarg.a(dpgetr.o)
>       _dpsetc_ in libncarg.a(dpsetc.o)
>       _dpsetr_ in libncarg.a(dpsetr.o)
>       _icfell_ in libncarg.a(icfell.o)
>       ...
> ld: symbol(s) not found for architecture x86_64
> collect2: ld returned 1 exit status
> 
> The compile and link failed.
> 
> Is this to do with the gfortran version used, or something else is missing (such as header files)?

This is because we don't have a binary for the Mac "x86_64" system yet. You downloaded a "i686" system,
and I'm only just now starting to see requests for "x86_64". 

Note: it's not important to get "cpex08" to compile. This is only for people using NCAR Graphics and writing C or Fortran programs.
If you plan to use NCL only, then it's not critical to get this program to compile.

However, if you want to try, you can try this:

   ncargex cpex08 -n
   ncargf77 -o cpex08 cpex08.f cpexcc.f -lgfortran
   ./cpex08

--Mary


> 
> 
> Thanks,
> Yoichi
> 
> --------------------------------------------------
> Yoichi Takayama, PhD
> Research Officer
> Climate Change Research Centre
> Level 4 Mathews Building
> University of New South Wales
> Sydney, Australia, 2052
> Phone (CCRC): +61 2 9385 8963 
> Fax (CCRC): +61 2 9385 8969
> --------------------------------------------------
> UNSW  ABN 57 195 873 179, CRICOS Provider 00098G
> IMPORTANT: This email and any attachment(s) transmitted with it are intended solely for the use of the addressee(s) and may contain information that is confidential or subject to legal privilege. If you receive this email in error, please disregard the contents of the email and attachment(s), delete them and notify the sender immediately. Please note that any copying, distribution or use of this email is prohibited. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the view of The University of New South Wales. Before opening any attachments, please check for viruses.
> 
> 
> 
> --------------------------------------------------
> Yoichi Takayama, PhD
> Research Officer
> Climate Change Research Centre
> Level 4 Mathews Building
> University of New South Wales
> Sydney, Australia, 2052
> Phone (CCRC): +61 2 9385 8963 
> Fax (CCRC): +61 2 9385 8969
> --------------------------------------------------
> UNSW  ABN 57 195 873 179, CRICOS Provider 00098G
> IMPORTANT: This email and any attachment(s) transmitted with it are intended solely for the use of the addressee(s) and may contain information that is confidential or subject to legal privilege. If you receive this email in error, please disregard the contents of the email and attachment(s), delete them and notify the sender immediately. Please note that any copying, distribution or use of this email is prohibited. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the view of The University of New South Wales. Before opening any attachments, please check for viruses.
> 
> _______________________________________________
> ncl-install mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-install



More information about the ncl-install mailing list