PGI 16.9 libRblas.so

I am somewhat new to PGI and working on a R build using the compiler. During the first step of the compile (blas), I am having the following problem linking. Am I missing any PGI specific libraries that I need to link against? Any hints are appreciated.


make[4]: Entering directory /apps/build/R-3.3.2/src/extra/blas' pgf77 -mp -fpic -g -c blas.f -o blas.o pgf77 -mp -fpic -g -c cmplxblas.f -o cmplxblas.o pgcc -L/apps/software/pgi-16.9/bzip2/1.0.6/lib -L/apps/software/pgi-16.9/xz/5.2.2/lib -L/apps/software/pgi-16.9/pcre/8.39/lib -L/apps/software/pgi-16.9/curl/7.51.0/lib -mp -L/apps/software/pgi-16.9/bzip2/1.0.6/lib -L/apps/software/pgi-16.9/xz/5.2.2/lib -L/apps/software/pgi-16.9/pcre/8.39/lib -L/apps/software/pgi-16.9/curl/7.51.0/lib -o libRblas.so blas.o cmplxblas.o -lpgftnrtl -lpgmp -lnuma -lpthread -lnspgc -lpgc -lrt -lm /usr/lib64/crt1.o: In function start’:
(.text+0x20): undefined reference to main' blas.o: In function dgbmv
’:
/apps/build/R-3.3.2/src/extra/blas/./blas.f:357: undefined reference to xerbla_' blas.o: In function dgemm_‘:
/apps/build/R-3.3.2/src/extra/blas/./blas.f:682: undefined reference to xerbla_' blas.o: In function dgemv_’:
/apps/build/R-3.3.2/src/extra/blas/./blas.f:940: undefined reference to xerbla_' blas.o: In function dger_‘:
/apps/build/R-3.3.2/src/extra/blas/./blas.f:1171: undefined reference to xerbla_' blas.o: In function dsbmv_’:
/apps/build/R-3.3.2/src/extra/blas/./blas.f:1800: undefined reference to xerbla_' blas.o:/apps/build/R-3.3.2/src/extra/blas/./blas.f:2183: more undefined references to xerbla_’ follow
make[4]: *** [libRblas.so] Error 2

Hi Michael,

BLAS has dependencies to the LAPACK library, which is where “xerbla” is defined. You will need to add you’re own Lapack library to your link, or use the one we ship by adding “-llapack”.

Hope this helps,
Mat

Mat,

Thank you for the support. I have tried that and got the following error.

pgcc -L/apps/compilers/pgi/linux86-64/16.9/lib -mp -L/apps/software/gcc-4.9.4/zlib/1.2.8/lib -L/apps/software/gcc-4.9.4/bzip2/1.0.6/lib -L/apps/software/gcc-4.9.4/xz/5.2.2/lib -L/apps/software/gcc-4.9.4/pcre/8.39/lib -L/apps/software/gcc-4.9.4/curl/7.51.0/lib -L/apps/compilers/pgi/linux86-64/16.9/lib -o libRblas.so blas.o cmplxblas.o -lpgftnrtl -lpgmp -lnuma -lpthread -lnspgc -lpgc -lrt -lm -llapack
/apps/default/bin/ld: blas.o: undefined reference to symbol ‘xerbla_’
/apps/compilers/pgi/linux86-64/16.9/lib/libblas.so.0: error adding symbols: DSO missing from command line
make[4]: *** [libRblas.so] Error 2

Does this mean that the libraries are in the wrong order for dependencies?

Mike

Compiling the sources -fPIC was correct, but creating the library
required you link with -shared switch set - otherwise you are trying
to create a executable.

We build from blas from netlib.org, which has many source files, in fortran.

If you are trying to build a shared library libblas.so, try

pgcc -shared -o libRblas.so blas.o cmplxblas.o -pgf77libs

liblapack has dependencies found in libblas, not the other way around.

If you are linking the lapack routines that you call from a
fortran program foo.f, for example, you would

pgfortran -o foo foo.f -llapack -lblas

Note: we recommend pgfortran instead of pgf77 for most compiles,
especially if you intend to use OpenACC or CUDA Fortran.

so above would be

pgfortran -o libRblas.so -fPIC blas.f cmplxblas.f -shared