[ncl-install] v 5.1.1 on x86_64 with PGI but g++ complains about unrecognized option '-pgf90libs', undefined references

Marcin Sliwowski ms275 at duke.edu
Wed Sep 30 08:47:05 MDT 2009


It is very funny how slowing down and taking the time to write up a
problem so that someone else can look at it will often lead one to a
solution.

Still don't like the fact that g++ is somehow getting involved in the
compiling process, now half the stuff is compiled with PGI and a piece
with GNU GCC.

I was able to resolve the problem with the following change. It appears
that the -pgf90libs flag, which definitely is a PGI specific thing, is
short hand for actually linking the following libraries: -lpgc -lpgf90 
-lpgf90_rpm1  -lpgf902 -lpgftnrtl -lpghpf.

However, since g++ is somehow stepping in and that flag has no meaning
to it, then you need to tell g++ which libraries it needs, which I did
with all the -l<libname>, however, I also needed to tell it where to
find these libraries. In my case I added

-L/opt/pgi-8.04/linux86-64/8.0-4/lib -L/opt/pgi-8.04/linux86-64/8.0-4/libso

to both the LIBSEARCH and LIB_SEARCH variables in the Makefile I am
dealing with.

At this point I still had a couple of undefined references after a "make
all", added -lpgf90rtl to the  CTOFLIBS variable in the Makefile and
they were resolved.

I would still like to find out more about the string substitution that
seems to occur to the word 'linux'. Is this only happening to me? It is
a pain to always have to expect that the hdfeos libraries will not be
found because of this. I guess an error that you can expect is that not
bad....

Thank You,
Marcin


Marcin Sliwowski wrote:
> Hello Mary Haley and Fellow NCL Compilers,
>
> Trying to compile NCL v. 5.1.1 on a 64 bit openSuse 11.1 system. The
> system has the full suite of Portland Group Compilers, c/c++ and fortran
> at v. 8.0-4. Have previously successfully compiled v. 5.0.0 andv.  5.1.0
> with these compilers.
>
> Current problem is a 2 part problem, not leaving out any details:
>
> The log from 'make Everything' shows the following single error:
>
> g++: unrecognized option '-pgf90libs'
> /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld:
> cannot find -lhdfeos
> collect2: ld returned 1 exit status
> make[4]: *** [ncl] Error 1
>
> Skipping over the first problematic issue that somehow g++ is involved
> in the mix even though in $NCARG/config/ I have copied the file
> LINUX.64.PGI over the file LINUX, so now the #define of CCompiler and
> FCompiler are set to pgcc and pgf90 respectively. I must be doing
> something wrong or forgetting to do something.
>
> The other issue is that ld cannot file the library hdfeos. I have seen
> this problem in both of the 2 previous versions of NCL that I have
> compiled. To fix this problem I always have to do the following:
>
> The Makefile in $NCARG/ni/src/ncl seems to mangle up its LIBSEARCH and
> LIB_SEARCH paths somehow. In both of those variables the path to the
> hdfeos libraries has the string 'linux' replaced with the string '1'.
> For example in my case it should be
> -L/usr/local/hdfeos-2.14.v1/lib/linux but instead in both of the
> variables in the Makefile it is -L/usr/local/hdfeos-2.14.v1/lib/1. I
> don't know why the string 'linux' is replaced with the string '1', maybe
> it has something to do with the fact that I installed hdfeos under
> /usr/local/hdfeos-2.14.v1 instead of the default /usr/local. Does anyone
> know why this replacement occurs?
>
> There is another instance of the string 'linux' being replaced with the
> string '1'. In the INC_SEARCH and INCSEARCH variables in the same
> Makefile -I/usr/include/linux is replaced with -I/usr/include/1 which
> leads to the following error during a subsequent make depend in the
> current directory:
>
> cannot find include file "stddef.h" not in /usr/include/stddef.h
> cannot find include file "limits.h"
>
> I edit the Makefile replace the instances of '1' with 'linux' and then
> in that same directory I issue the commands: make includes, make depend
> and make all.
>
> On the "make all" is where I run into the serious trouble that I need
> help with. I get a whole slew of errors regarding undefined references,
> but before them I get the line: g++: unrecognized option '-pgf90libs'.
> Here are the undefined reference errors:
>
> dspmv.f:(.data+0x18): undefined reference to `pgf90_compiled'
> undefined reference to `pgf90io_encode_fmt'
> undefined reference to `pgf90io_fmt_write'
> undefined reference to `__c_mset8'
>
> At this point I comment out the current definition of the variable
> CTOFLIBS and insert the following in the Makefile:
> #CTOFLIBS       = -pgf90libs
> CTOFLIBS        = -pgf90libs -lpgc -lpgf90  -lpgf90_rpm1  -lpgf902
> -lpgftnrtl -lpghpf
>
> After this change the make all still states: g++: unrecognized option
> '-pgf90libs' and the number of undefined references drops significantly
> but the following kind still remain:
>
> /opt/pgi-8.04/linux86-64/8.0-4/lib/libpgf90.a(ftnexit.o): In function
> `f90io_pause':
> ftnexit.c:(.text+0x13e): undefined reference to `_mp_bcs_stdio'
> ftnexit.c:(.text+0x1d1): undefined reference to `_mp_ecs_stdio'
> /opt/pgi-8.04/linux86-64/8.0-4/lib/libpgftnrtl.a(ftncharsup.o): In
> function `ftn_str_copy':
> /usr/pgrel/extract/x86/8.0/rte/pgftn/hammer/lib-linux86-64/../../port/support/src/ftncharsup.c:83:
> undefined reference to `_mp_malloc'
> /usr/pgrel/extract/x86/8.0/rte/pgftn/hammer/lib-linux86-64/../../port/support/src/ftncharsup.c:106:
> undefined reference to `_mp_malloc'
> /usr/pgrel/extract/x86/8.0/rte/pgftn/hammer/lib-linux86-64/../../port/support/src/ftncharsup.c:147:
> undefined reference to `_mp_free'
> /usr/pgrel/extract/x86/8.0/rte/pgftn/hammer/lib-linux86-64/../../port/support/src/ftncharsup.c:159:
> undefined reference to `_mp_free'
>
> I am guessing that because g++ somehow gets involved it is not able to
> find the libraries that the PGI compilers come with that I am guessing
> would provided these methods that are currently undefined. In my
> environment I have the following variables exported:
>
> export CC=pgcc
> export CXX=pgCC
> export FC=pgf95
> export F77=pgf77
> export
> LD_LIBRARY_PATH=${PORTLAND_COMPILERS}/libso:${PORTLAND_COMPILERS}/lib:${LD_LIBRARY_PATH}
> export
> LIBRARY_PATH=${PORTLAND_COMPILERS}/lib:${PORTLAND_COMPILERS}/libso:${LIBRARY_PATH}
>
> Any help would be greatly appreciated.
>
> Thank You,
> Marcin
>
>   


-- 
Marcin Sliwowski
Systems Programmer
Duke University - Pratt School of Engineering
Office: 919-660-8450



More information about the ncl-install mailing list