R CMD SHLIB 编译 Fortran 代码时出错

Error in R CMD SHLIB compiling Fortran code

我试图在远程机器上编译一个 Fortran 子程序,当我 运行:

R CMD SHLIB -fPIC vintp2p_afterburner_wind.f

我收到以下错误:

gcc -shared -L/sw/installed/R/3.6.2-fosscuda-2019b/lib64/R/lib -L/sw/installed/pocl/1.4-GCC-8.3.0/lib64 -L/sw/installed/ImageMagick/7.0.9-5-GCCcore-8.3.0/lib -L/sw/installed/GSL/2.6-GCC-8.3.0/lib -L/sw/installed/UDUNITS/2.2.26-GCCcore-8.3.0/lib -L/sw/installed/HDF5/1.10.5-gompic-2019b/lib -L/sw/installed/ICU/64.2-GCCcore-8.3.0/lib -L/sw/installed/libsndfile/1.0.28-GCCcore-8.3.0/lib -L/sw/installed/FFTW/3.3.8-gompic-2019b/lib -L/sw/installed/NLopt/2.6.1-GCCcore-8.3.0/lib64 -L/sw/installed/GMP/6.1.2-GCCcore-8.3.0/lib -L/sw/installed/libxml2/2.9.9-GCCcore-8.3.0/lib -L/sw/installed/cURL/7.66.0-GCCcore-8.3.0/lib -L/sw/installed/Tk/8.6.9-GCCcore-8.3.0/lib -L/sw/installed/Java/11.0.2/lib -L/sw/installed/LibTIFF/4.0.10-GCCcore-8.3.0/lib -L/sw/installed/libjpeg-turbo/2.0.3-GCCcore-8.3.0/lib64 -L/sw/installed/libpng/1.6.37-GCCcore-8.3.0/lib -L/sw/installed/PCRE/8.43-GCCcore-8.3.0/lib -L/sw/installed/SQLite/3.29.0-GCCcore-8.3.0/lib -L/sw/installed/zlib/1.2.11-GCCcore-8.3.0/lib -L/sw/installed/XZ/5.2.4-GCCcore-8.3.0/lib -L/sw/installed/bzip2/1.0.8-GCCcore-8.3.0/lib -L/sw/installed/ncurses/6.1-GCCcore-8.3.0/lib -L/sw/installed/libreadline/8.0-GCCcore-8.3.0/lib -L/sw/installed/cairo/1.16.0-GCCcore-8.3.0/lib -L/sw/installed/libGLU/9.0.1-GCCcore-8.3.0/lib -L/sw/installed/Mesa/19.1.7-GCCcore-8.3.0/lib -L/sw/installed/X11/20190717-GCCcore-8.3.0/lib -L/sw/installed/ScaLAPACK/2.0.2-gompic-2019b/lib -L/sw/installed/OpenBLAS/0.3.7-GCC-8.3.0/lib -L/sw/installed/GCCcore/8.3.0/lib64 -L/sw/installed/GCCcore/8.3.0/lib -L/sw/installed/CUDA/10.1.243/lib64 -o vintp2p_afterburner_wind.so vintp2p_afterburner_wind.o -fPIC -lgfortran -L/sw/installed/R/3.6.2-fosscuda-2019b/lib64/R/lib -lR
/sw/installed/binutils/2.28-GCCcore-6.4.0/bin/ld.gold: error: vintp2p_afterburner_wind.o: requires dynamic R_X86_64_PC32 reloc against 'log' which may overflow at runtime; recompile with -fPIC
collect2: error: ld returned 1 exit status
make: *** [vintp2p_afterburner_wind.so] Error 1

该子例程具有 log() 功能。我对这个错误完全陌生,我不知道从哪里开始!

也许有人会发现它有用:编译由 :

gfortran -fPIC -shared -ffree-form vintp2p_afterburner_wind.f -o vintp2p_afterburner_wind.so