I am trying to use a library (Intel TBB) in my R package on Windows, but not sure how to write makevars.win.
I have Rtools installed, and there are the library under include:
C:\RBuildTools\4.3\x86_64-w64-mingw32.static.posix\include\tbb
My makevars.win is
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) -ltbb
PKG_CXXFLAGS = -DARMA_64BIT_WORD=1
PKG_CPPFLAGS = -I../inst/include -DARMA_DONT_PRINT_OPENMP_WARNING=1
but it errors.
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
Would you tell me what is missing?
I tried manually adding -LC:\RBuildTools\4.3\x86_64-w64-mingw32.static.posix\include to makevars.win, but did not work...
By replacing RBuildTools with rtools43 and adding
-ltbb12 -fstack-protectortomakevars.win, I could compile the package.