rwinlib / rtools35

Scripts for building the rtools installer bundle
15 stars 3 forks source link

cannot find -lR collect2.exe: error #12

Closed TyGu1 closed 4 years ago

TyGu1 commented 4 years ago

I get errors installing packages from source (with RTools).

Details here: (I can also paste the Infos in here if needed:) https://stackoverflow.com/questions/59720177/how-to-avoid-cannot-find-lr-for-r-package-installation-on-windows

What i tried:

As indicated here: https://community.rstudio.com/t/installing-source-package-failure-to-link/14775 it might be the case that for some reason a 32-bit file is linked on my 64-bit machine. But i dont see any Errors in my pathes. (It used to work on three (windows) machines, but suddenly on None of them anymore).

i tried to copy the files (for Debugging) from C:\Program Files\R\R-3.4.2\bin\x64 to C:\Program Files\R\R-3.4.2\bin\i386.

A lot of These Errors:

Cannot export Z10err_printfPKcz: symbol not defined
Cannot export Z10nextOpSecsi: symbol not defined
Cannot export Z10sys_nframev: symbol not defined
jeroen commented 4 years ago

How are you installing the R package? Are you somehow overriding the BINPREF variable?

TyGu1 commented 4 years ago

Wow, thank you for the fast answer.

Basically i run the first two Code snippets posted on #SO:

Sys.setenv(BINPREF = "C:/PROGRA~1/R/Rtools/mingw_64/bin/")
Sys.setenv(BINPREF64 = "C:/PROGRA~1/R/Rtools/mingw_64/bin/") # could probably be removed?
Sys.setenv(PATH = "C:/PROGRA~1/R/R-3.4.2/bin/x64/;C:/PROGRA~1/R/Rtools/bin/;C:/PROGRA~1/R/Rtools/mingw_64/bin/")

install.packages("later", type = "source")
# or install.packages("later")

Therefore, i would not be Aware that i override the binpref variable.

I forgot to mention that i also tried to re-install R, RStudio and Rtools and trying Rtools34 and Rtools35. Also reproduced with 3.6.2 on different machine.

Full log for machine with R 3.6.2:

> Sys.setenv(BINPREF = "C:/Rtools/mingw_64/bin/")
> Sys.setenv(PATH = "C:/PROGRA~1/R/R-3.4.2/bin/x64/;C:/Rtools/bin/;C:/Rtools/mingw_64/bin/")
> Sys.getenv("BINPREF")
[1] "C:/Rtools/mingw_64/bin/"
> Sys.which("gcc.exe")
                             gcc.exe 
"C:\\Rtools\\mingw_64\\bin\\gcc.exe" 
> Sys.which("ld.exe")
                             ld.exe 
"C:\\Rtools\\mingw_64\\bin\\ld.exe" 
> Sys.getenv("PATH")
[1] "C:/PROGRA~1/R/R-3.4.2/bin/x64/;C:/Rtools/bin/;C://Rtools/mingw_64/bin/"
> install.packages("later", type = "source")
Installing package into ‘C:/Users/User1/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/later_1.0.0.tar.gz'
Content type 'application/x-gzip' length 56563 bytes (55 KB)
downloaded 55 KB

* installing *source* package 'later' ...
** Paket 'later' erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs

*** arch - i386
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c RcppExports.cpp -o RcppExports.o
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c callback_registry.cpp -o callback_registry.o
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c debug.cpp -o debug.o
C:/Rtools/mingw_64/bin/gcc  -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c init.c -o init.o
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c later.cpp -o later.o
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c later_posix.cpp -o later_posix.o
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c later_win32.cpp -o later_win32.o
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c timer_posix.cpp -o timer_posix.o
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c timestamp_unix.cpp -o timestamp_unix.o
C:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O2 -Wall  -mtune=generic -c timestamp_win32.cpp -o timestamp_win32.o
C:/Rtools/mingw_64/bin/gcc  -I"C:/PROGRA~1/R/R-36~1.2/include" -DNDEBUG -DSTRICT_R_HEADERS -I"C:/Users/User1/Documents/R/win-library/3.6/Rcpp/include" -I"C:/Users/User1/Documents/R/win-library/3.6/BH/include"        -O3 -Wall  -std=gnu99 -mtune=generic -c tinycthread.c -o tinycthread.o
C:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o later.dll tmp.def RcppExports.o callback_registry.o debug.o init.o later.o later_posix.o later_win32.o timer_posix.o timestamp_unix.o timestamp_win32.o tinycthread.o -LC:/PROGRA~1/R/R-36~1.2/bin/i386 -lR
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-36~1.2/bin/i386/R.dll when searching for -lR
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-36~1.2/bin/i386/R.dll when searching for -lR
C:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lR
collect2.exe: error: ld returned 1 exit status
keine DLL erzeugt
ERROR: compilation failed for package 'later'
* removing 'C:/Users/User1/Documents/R/win-library/3.6/later'
* restoring previous 'C:/Users/User1/Documents/R/win-library/3.6/later'
Warning in install.packages :
  installation of package ‘later’ had non-zero exit status
TyGu1 commented 4 years ago

May i kindly ask if there is a chance for an update or a hint where we could get some help with this? Would be also open to invest some Budget if necessary. Thank you!

jeroen commented 4 years ago

The info in the SO is wrong.

I highly recommend you install rtools in the default location, then it works out of the box. You cannot install Rtools under "program files" or any other directory that has a space in it.

jeroen commented 4 years ago

I have answered the SO question: https://stackoverflow.com/a/60211976/318752