Compiling with R new problem

Hi there!

I have been using PGI tools with R and have not had any problems.

When I try to compile a package using PGI 19.4 on a new version of R, this is what happens:

  • installing source package ‘rmpiFort’ …

** using staged installation

** libs

pgf90 -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -Mmpi=msmpi -c rmpiFort.f90 -o rmpiFort.obj -m64
pgf90 -acc -Minfo=accel -Mlarge_arrays -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -ta=tesla:nordc -Ld:/“Program Files”/PGI/win64/19.4/lib/acc_init_link_cuda.obj -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccapi.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccg.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccn.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccg2.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libcudadevice.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/pgc.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libnspgc.lib -defaultlib:legacy_stdio_definitions -defaultlib:oldnames -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -c test4.f90 -o test4.obj -m64
pgf90 -Mmakedll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -Mmpi=msmpi -acc -Minfo=accel -Mlarge_arrays -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -o rmpiFort.dll test4.obj rmpiFort.obj -m64
Creating library rmpiFort.lib and object rmpiFort.exp

test4.obj : error LNK2019: unresolved external symbol pgf90_strcmp_klen referenced in function alloc1a_

rmpiFort.dll : fatal error LNK1120: 1 unresolved externals

make: *** [Makevars:16: rmpiFort.obj] Error 2
ERROR: compilation failed for package ‘rmpiFort’

  • removing ‘D:/brandnewR/rmpiFort.Rcheck/rmpiFort’


    If I use -lpgf90rtl, it compiles but my functions are getting error messages. I tried using -Bdynamic instead, but it still won’t compile.

Any suggestions would be much appreciated.

Sincerely,
Erin

Hi Erin,

It seems like you’ll need that to link to the runtime libraries, so I would think that -lpgf90rtl is the right choice here. What kind of error messages are the functions getting? If you have a sample output or even a test reproducer that encapsulates the issue, feel free to post it here or send it to trs@pgroup.com.

Hi Erin,

I tried using -Bdynamic instead, but it still won’t compile.

It’s possible that the problem is that you need to compile and link with “-Mdll” (or it’s equivalent -Bdynamic), since some of the system runtime library symbol names change depending on whether you are calling the DLL or static versions of the libraries.

Did you add -Bdynamic to the compilation or just the link?

-Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll

While not the cause of this issue, “-L” tells the linker a directory to look for libraries. Given “pgf90.dll” isn’t a directory (as well as the other cases), these are extraneous.

Hope this helps,
Mat

Hi Mat:

Thanks for the quick response.

Here is the Makevars file:

FC= pgf90
F77= pgf90
CC = pgcc
FFLAGS= -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -Bdynamic
FLIBS= -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
MPI_FFLAGS= -Mmpi=msmpi
SHLIB_FFLAGS= -Mmakedll -Bdynamic
CUDA_FFLAGS=-acc -Minfo=accel -Mlarge_arrays -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -Bdynamic
DLLCUDA_FFLAGS=-ta=tesla:nordc -Ld:/“Program Files”/PGI/win64/19.4/lib/acc_init_link_cuda.obj -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccapi.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccg.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccn.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccg2.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libcudadevice.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/pgc.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libnspgc.lib -defaultlib:legacy_stdio_definitions -defaultlib:oldnames -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -Bdynamic


rmpiFort.obj: rmpiFort.f90
$(FC) $(FFLAGS) $(MPI_FFLAGS) -c rmpiFort.f90 -o rmpiFort.obj -m64 -Bdynamic
$(FC) $(CUDA_FFLAGS) $(DLLCUDA_FFLAGS) -c test4.f90 -o test4.obj -m64 -Bdynamic
$(FC) $(SHLIB_FFLAGS) $(FFLAGS) $(MPI_FFLAGS) $(CUDA_FFLAGS) -o rmpiFort.dll test4.obj rmpiFort.obj -m64 -Bdynamic


Then here is the output:

  • installing source package ‘rmpiFort’ …

** using staged installation

** libs

pgf90 -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -Mmpi=msmpi -c rmpiFort.f90 -o rmpiFort.obj -m64 -Bdynamic
pgf90 -acc -Minfo=accel -Mlarge_arrays -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -ta=tesla:nordc -Ld:/“Program Files”/PGI/win64/19.4/lib/acc_init_link_cuda.obj -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccapi.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccg.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccn.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libaccg2.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libcudadevice.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/pgc.lib -Ld:/“Program Files”/PGI/win64/19.4/lib/libnspgc.lib -defaultlib:legacy_stdio_definitions -defaultlib:oldnames -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -c test4.f90 -o test4.obj -m64 -Bdynamic
pgf90 -Mmakedll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -Mmpi=msmpi -acc -Minfo=accel -Mlarge_arrays -Ld:/“Program Files”/PGI/win64/19.4/bin/pgf90.dll -Ld:/“Program Files”/PGI/win64/19.4/bin/pgc.dll -o rmpiFort.dll test4.obj rmpiFort.obj -m64 -Bdynamic
Creating library rmpiFort.lib and object rmpiFort.exp

test4.obj : error LNK2019: unresolved external symbol pgf90_strcmp_klen referenced in function alloc1a_

rmpiFort.dll : fatal error LNK1120: 1 unresolved externals

make: *** [Makevars:16: rmpiFort.obj] Error 2
ERROR: compilation failed for package ‘rmpiFort’

  • removing ‘D:/brandnewR/rmpiFort.Rcheck/rmpiFort’

Still giving the same errors.

This is the same as the previous set up, just pointing to the 19.4 version.

Thanks,
Erin

Hi Erin,

FYI, we’re looking into this. Not sure what’s wrong nor can recreate it as of yet, but are working on it.

-Mat

Thanks so much!

Sincerely,
Erin

Hi Erin,

We were finally able to reproduce the issue and it looks like problem with how we build the libraries where this symbol isn’t getting exported.

We’ve opened TPR #27533 and have sent it to engineering for review. Should be simple to fix, so hopefully something we can get into the next release.

-Mat

FYI this is no longer an issue with 19.10+