[英]Error in R CMD SHLIB compiling C code
I am trying to use R CMD SHLIB for a C program written using Lapack and Blas . 我正在尝试将R CMD SHLIB用于使用Lapack和Blas编写的C程序。 I am using the command prompt in Windows.
我在Windows中使用命令提示符。 But it seems unable to link to the external libraries.
但它似乎无法链接到外部库。 How can I link these libraries?
我如何链接这些库?
D:\R\testR>Rcmd SHLIB fmpc.c
c:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o fmpc.dll tmp.def fmpc.o
-Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -L
D:/R/R-3.3.2/bin/x64 -lR
fmpc.o:fmpc.c:(.text+0x76d): undefined reference to `dposv_'
fmpc.o:fmpc.c:(.text+0x800): undefined reference to `dtrtrs_'
fmpc.o:fmpc.c:(.text+0x83b): undefined reference to `dtrtrs_'
fmpc.o:fmpc.c:(.text+0x92f): undefined reference to `dposv_'
fmpc.o:fmpc.c:(.text+0x9bf): undefined reference to `dtrtrs_'
fmpc.o:fmpc.c:(.text+0x9fa): undefined reference to `dtrtrs_'
fmpc.o:fmpc.c:(.text+0xb19): undefined reference to `dgemm_'
You have a linker error and not a compiler error. 您有链接器错误而不是编译器错误。 The compilation step passed fine.
编译步骤顺利通过。
Solution: Tell R to link against the missing library, most by adding a file src/Makevars.win
with the following: 解决方案:告诉R链接缺少的库,大多数是通过添加以下文件
src/Makevars.win
:
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
It is a variable declaration using other variable which R knows. 它是使用R知道的其他变量的变量声明。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.