如何在 Windows 上的 Rtools 中链接库?

问题描述 投票:0回答:1

我正在尝试在 Windows 上的 R 包中使用库(Intel TBB),但不知道如何编写

makevars.win

我安装了Rtools,

include
下有库:

C:\RBuildTools\4.3\x86_64-w64-mingw32.static.posix\include\tbb

我的

makevars.win

PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) -ltbb
PKG_CXXFLAGS = -DARMA_64BIT_WORD=1
PKG_CPPFLAGS = -I../inst/include -DARMA_DONT_PRINT_OPENMP_WARNING=1 

但它出错了。

g++ -std=gnu++17 -shared -s -static-libgcc -o quanteda.dll tmp.def RcppExports.o fcm.o index.o kwic.o pattern2fixed.o serialize.o tokens_chunk.o tokens_combine.o tokens_compound.o tokens_group.o tokens_lookup.o tokens_ngrams.o tokens_recompile.o tokens_replace.o tokens_restore.o tokens_segment.o tokens_select.o tokens_xptr.o utility.o -LC:/PROGRA~1/R/R-43~1.2/bin/x64 -lRlapack -LC:/PROGRA~1/R/R-43~1.2/bin/x64 -lRblas -ltbb -LC:/RBuildTools/4.3/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/RBuildTools/4.3/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~1/R/R-43~1.2/bin/x64 -lR
C:\RBuildTools\4.3\x86_64-w64-mingw32.static.posix\bin/ld.exe: cannot find -ltbb: No such file or directory
collect2.exe: error: ld returned 1 exit status

你能告诉我缺少什么吗?

我尝试手动将

-LC:\RBuildTools\4.3\x86_64-w64-mingw32.static.posix\include
添加到
makevars.win
,但没有成功...

c++ r rcpp tbb rtools
1个回答
0
投票

通过用 rtools43 替换 RBuildTools 并将

-ltbb12 -fstack-protector
添加到
makevars.win
,我可以编译该包。

PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) -ltbb12 -fstack-protector
PKG_CXXFLAGS = -DARMA_64BIT_WORD=1
PKG_CPPFLAGS = -I../inst/include -DARMA_DONT_PRINT_OPENMP_WARNING=1
g++ -std=gnu++17 -shared -s -static-libgcc -o quanteda.dll tmp.def RcppExports.o fcm.o index.o kwic.o pattern2fixed.o serialize.o tokens_chunk.o tokens_combine.o tokens_compound.o tokens_group.o tokens_lookup.o tokens_ngrams.o tokens_recompile.o tokens_replace.o tokens_restore.o tokens_segment.o tokens_select.o tokens_xptr.o utility.o -LC:/PROGRA~1/R/R-43~1.2/bin/x64 -lRlapack -LC:/PROGRA~1/R/R-43~1.2/bin/x64 -lRblas -ltbb12 -fstack-protector -LC:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools43/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~1/R/R-43~1.2/bin/x64 -lR
installing to C:/Users/watan/AppData/Local/R/win-library/4.3/00LOCK-quanteda/00new/quanteda/libs/x64
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (quanteda)
© www.soinside.com 2019 - 2024. All rights reserved.