Re: NCARG on Ubuntu 8.04 LTS with PGI

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue May 04 2010 - 08:44:18 MDT

Hi Chris,

Your problems stem from the fact that you are trying to use the
Portland compilers
to link against gcc/gfortran compiled libraries. Usually this is
doable, but as you've
seen, you have to add system libraries to help out.

Adding "-lgfortran" sometimes is all you need, but it looks like you
may have
a different version of gfortran than what your version of NCAR
Graphics was
compiled with.

Do you know which NCL/NCARG binary you downloaded? What does the
following report:

    gfortran --version

I think the undefined references below come from V4.1.x of gfortran, and
newer versions of gfortran (V4.2.x) don't have these symbols.

It might help to look at this FAQ question: http://www.ncl.ucar.edu/FAQ/#basics_006

It tells you how to get the older 4.1.x gfortran library, which you
can then link against.

Otherwise, you'll either need to download a version of NCL/NCARG
that was built with the same gfortran as what you have, or else build
NCL/NCARG
yourself from source code.

I not familiar enough with Ubuntu to help you with the oddities on
library locations.

--Mary

On May 3, 2010, at 3:26 PM, Chris Cornwall wrote:

> Greetings.
>
> I'm trying to install NCAR Graphics on an i686 Ubuntu 8.04 LTS system
> with Portland Group compilers. First post-install test works fine for
> displaying the graphs, but the compile test fails:
>
> pulsar:~> ncargex cpex08 -clean
>
> NCAR Graphics Fortran Example <cpex08>
>
> Copying cpex08.f
>
> Copying cpexcc.f
>
> Compiling and linking...
> gfortran -fPIC -fno-second-underscore -fno-range-check -O -o cpex08
> cpexcc.f cpex08.f -L/usr/local/ncarg/lib -L/usr/X11R6/lib -lncarg
> -lncarg_gks -lncarg_c -lX11 -lXext
> /usr/local/ncarg/lib/libncarg.a(cpcldm.o): In function `cpcldm_':
> cpcldm.f:(.text+0x8ab): undefined reference to `_gfortran_copy_string'
> cpcldm.f:(.text+0xf36): undefined reference to `_gfortran_copy_string'
> cpcldm.f:(.text+0xfc8): undefined reference to `_gfortran_copy_string'
> cpcldm.f:(.text+0x10bd): undefined reference to
> `_gfortran_copy_string'
> cpcldm.f:(.text+0x11c4): undefined reference to
> `_gfortran_copy_string'
> /usr/local/ncarg/lib/libncarg.a(cpcldm.o):cpcldm.f:(.text+0x127f):
> more
> undefined references to `_gfortran_copy_string' follow
> collect2: ld returned 1 exit status
>
> The compile and link failed.
>
> pulsar:~> which gfortran
> /usr/bin/gfortran
>
>
> Reading the archives here, I edited the ncargf77 file, replacing
> gfortran with pgf77, resulting in:
>
> pulsar:~> ncargex cpex08 -clean
>
> NCAR Graphics Fortran Example <cpex08>
>
> Copying cpex08.f
>
> Copying cpexcc.f
>
> Compiling and linking...
> pgf77 -fPIC -fno-second-underscore -fno-range-check -O -o cpex08
> cpexcc.f cpex08.f -L/usr/local/ncarg/lib -L/usr/X11R6/lib -lncarg
> -lncarg_gks -lncarg_c -lX11 -lXext
> pgf77-Error-Unknown switch: -fno-second-underscore
> pgf77-Error-Unknown switch: -fno-range-check
>
> The compile and link failed.
>
>
> Removing those two flags from the loadflags env in ncargf77
> produces a
> huge number of "undefined reference to `_gfortran_*` errors.
>
> So I changed ncargf77 again, adding
>
> set libextra = "-lgfortran"
>
> This gives me:
>
>
> pulsar:~> ncargex cpex08 -clean
>
> NCAR Graphics Fortran Example <cpex08>
>
> Copying cpex08.f
>
> Copying cpexcc.f
>
> Compiling and linking...
> pgf77 -fPIC -O -o cpex08 cpexcc.f cpex08.f -L/usr/local/ncarg/lib
> -L/usr/X11R6/lib -lncarg -lncarg_gks -lncarg_c -lX11 -lXext -lgfortran
> cpexcc.f:
> cpex08.f:
> /usr/local/ncarg/lib/libncarg.a(cpcldm.o): In function `cpcldm_':
> cpcldm.f:(.text+0x8ab): undefined reference to `_gfortran_copy_string'
> cpcldm.f:(.text+0xf36): undefined reference to `_gfortran_copy_string'
> cpcldm.f:(.text+0xfc8): undefined reference to `_gfortran_copy_string'
> cpcldm.f:(.text+0x10bd): undefined reference to
> `_gfortran_copy_string'
> cpcldm.f:(.text+0x11c4): undefined reference to
> `_gfortran_copy_string'
> /usr/local/ncarg/lib/libncarg.a(cpcldm.o):cpcldm.f:(.text+0x127f):
> more
> undefined references to `_gfortran_copy_string' follow
>
> The compile and link failed.
>
>
> And that's where the archives and I run out of steam. Can someone
> please
> help?
>
> It's my impression that Ubuntu stores some system files in odd places.
> For example, there was no /usr/X11R6/lib directory, so I created a
> symlink for it to /usr/lib. Are there other oddities I need to deal
> with?
>
> The ultimate goal is to allow one of our scientists to compile and run
> legacy f77/ncarg code using the Portland Group compiler. This code is
> currently running and compiling happily on a Debian system, but we
> wanted to try porting to Ubuntu.
>
> Thanks.
>
> Chris
> _______________________________________________
> ncl-install mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-install

_______________________________________________
ncl-install mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-install
Received on Tue May 4 08:44:21 2010

This archive was generated by hypermail 2.1.8 : Thu May 13 2010 - 10:05:37 MDT