braverock / blotter

blotter provides transaction infrastructure for defining transactions, portfolios and accounts for trading systems and simulation. Provides portfolio support for multi-asset class and multi-currency portfolios. Actively maintained and developed.
112 stars 49 forks source link

build fails on Windows - cannot find -lR #107

Closed miaodapang closed 4 years ago

miaodapang commented 4 years ago

I have been trying to install the package for a week. So far no luck. Thank you for your help in advance I copied the output here:

remotes::install_github("braverock/blotter") Downloading GitHub repo braverock/blotter@master √ checking for file 'C:\Users\hm\UserTemp\RtmpsJZH6S\remotes3b307b9e6ef5\braverock-blotter-2393616/DESCRIPTION' (360ms)

Installing package into ‘C:/Users/hm/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)

*** arch - i386 /mingw32/bin/gcc -I"/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c calcPosAvgCost.c -o calcPosAvgCost.o /mingw32/bin/gcc -I"/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init.c -o init.o /mingw32/bin/gcc -shared -s -static-libgcc -o blotter.dll tmp.def calcPosAvgCost.o init.o -L/bin/i386 -lR C:/RBUILD~1/4.0/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lR collect2.exe: error: ld returned 1 exit status no DLL was created ERROR: compilation failed for package 'blotter'

braverock commented 4 years ago

What version of Rtools do you have installed?

The error you are seeing is a compiler error, which appears to indicate that you may not have the standard R API library installed.

I would suggest getting the latest Rtools for your version of R.

I also think it is a little odd that the arch is -i386 and not 64 bit. Is this expected for your machine?

If that doesn't solve the problem, please provide sessionInfo()

miaodapang commented 4 years ago

@braverock Hi Brian, Thank you very much for your quick response. I also have trouble with some other packages from github, but not all of them. Never had any trouble before Rtools 4.0.

sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
system code page: 936

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] devtools_2.3.0 usethis_1.6.1

loaded via a namespace (and not attached): [1] rstudioapi_0.11 magrittr_1.5 knitr_1.29 pkgload_1.1.0 R6_2.4.1
[6] rlang_0.4.6 fansi_0.4.1 tools_4.0.2 pkgbuild_1.0.8.9000 xfun_0.15
[11] sessioninfo_1.1.1 cli_2.0.2 withr_2.2.0 remotes_2.1.1 htmltools_0.5.0
[16] ellipsis_0.3.1 rprojroot_1.3-2 yaml_2.2.1 assertthat_0.2.1 digest_0.6.25
[21] crayon_1.3.4 processx_3.4.3 callr_3.4.3 fs_1.4.1 ps_1.3.3
[26] curl_4.3 testthat_2.3.2 memoise_1.1.0 glue_1.4.1 evaluate_0.14
[31] rmarkdown_2.3 compiler_4.0.2 backports_1.1.7 desc_1.2.0 prettyunits_1.1.1

braverock commented 4 years ago

So, the current Rtools is here:

https://cran.r-project.org/bin/windows/Rtools/

I would suggest installing the first one, that includes both 64 and 32 bit toolchains.

If that proceeds smoothly with no problems, I would probably reinstall devtools as well so that it can find the newest Rtools.

-l in gcc is library, so -lR that is failing is the R.o or R.dll R API files.

It is also possible that RStudio is not locating Rtools, so you may need to add the Rtools installation directory to the PATH that RStudio uses, if e.g. it is still pointed to an older Rtools directory.

jaymon0703 commented 4 years ago

Perhaps before the above, can you confirm whether you are using RStudio, and if you have at least version 1.2.5042?

Noticed this on the Rtools website - Note for RStudio users: please check you are using the latest version of RStudio (at least 1.2.5042) to work with rtools40.

miaodapang commented 4 years ago

Thanks for the responses. I am using Rstudio 1.3.959. I did install the first Rtools. Will uninstall and reinstall r, rtools and rstudio.

miaodapang commented 4 years ago

@braverock You are right, it had something to do with the configuration of the Rstudio. After uninstalling everything and reinstalling everything, it still did not work. I had to reset the Rstudio Desktop's State for a fresh installation of Rstudio. After that, it has not problem. I think this is an issue with Rstudio and Rtools, not Blotter. If anyone runs into the same situation, a fresh installation of Rstudio is needed. Here is a link about that: https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State Thank you very much for your help.