swarm-lab / Rvision

Basic computer vision library for R
https://swarm-lab.github.io/Rvision/
GNU General Public License v3.0
142 stars 34 forks source link

Can't install Rvision #82

Open lishen-qian opened 1 year ago

lishen-qian commented 1 year ago

Describe the bug Sorry to bother your team, after I follow the steps of https://swarm-lab.github.io/Rvision/articles/z1_install.html, I still can't install Rvision. I have already go through the all steps of installing installr, cmake, devtools, rtools, opencvlite in Rstudio. At the last step, devtools::install_github("swarm-lab/Rvision"), it goes wrong as follow:


devtools::install_github("swarm-lab/Rvision") Downloading GitHub repo swarm-lab/Rvision@HEAD -- R CMD build ------------------------------------------------------------------------------------ v checking for file 'C:\Users\Shanshan\AppData\Local\Temp\RtmpATbkCC\remotes2c74f01970\swarm-lab-Rvision-1ad0f19/DESCRIPTION' (379ms)

  • preparing 'Rvision': (885ms) v checking DESCRIPTION meta-information ...
  • cleaning src
  • checking for LF line-endings in source and make files and shell scripts (1.7s)
  • checking for empty or unneeded directories Removed empty directory 'Rvision/man/figures'
  • building 'Rvision_0.7.0.tar.gz' Warning: file 'Rvision/configure' did not have execute permissions: corrected

*** arch - i386 "C:/D/Apps/R/rtools40/mingw32/bin/"g++ -std=gnu++11 -I"C:/D/Apps/R/R-41~1.2/include" -DNDEBUG -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\include\opencv2" -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\include" -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\x86\mingw\bin" -I'C:/D/Apps/R/R-4.1.2/library/Rcpp/include' -I'C:/D/Apps/R/R-4.1.2/library/RcppArmadillo/include' -I"C:/D/Apps/R/R-4.1.2/library/Rcpp/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o "C:/D/Apps/R/rtools40/mingw32/bin/"g++ -std=gnu++11 -I"C:/D/Apps/R/R-41~1.2/include" -DNDEBUG -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\include\opencv2" -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\include" -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\x86\mingw\bin" -I'C:/D/Apps/R/R-4.1.2/library/Rcpp/include' -I'C:/D/Apps/R/R-4.1.2/library/RcppArmadillo/include' -I"C:/D/Apps/R/R-4.1.2/library/Rcpp/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c visionModule.cpp -o visionModule.o In file included from visionModule.cpp:14: Image.h: In function 'bool _writeMulti(std::__cxx11::string, Rcpp::List)': Image.h:625:30: warning: comparison of integer expressions of different signedness: 'unsigned int' and 'R_xlen_t' {aka 'int'} [-Wsign-compare] for (unsigned int i = 0; i < imgList.size(); i++) { ^~~~~~ In file included from visionModule.cpp:332: shape.h: In function 'double _contourArea(Rcpp::NumericVector, Rcpp::NumericVector, bool)': shape.h:44:22: warning: comparison of integer expressions of different signedness: 'uint' {aka 'unsigned int'} and 'R_xlen_t' {aka 'int'} [-Wsign-compare] for (uint i = 0; i < x.size(); i++) { ^~~~ C:/D/Apps/R/rtools40/mingw32/bin/g++ -shared -s -static-libgcc -o Rvision.dll tmp.def RcppExports.o visionModule.o -LC:\D\Apps\R\R-41~1.2\library\ROpenCV\x86\mingw\lib -lopencv_calib3d470 -lopencv_core470 -lopencv_features2d470 -lopencv_flann470 -lopencv_gapi470 -lopencv_highgui470 -lopencv_imgcodecs470 -lopencv_imgproc470 -lopencv_ml470 -lopencv_objdetect470 -lopencv_photo470 -lopencv_stitching470 -lopencv_video470 -lopencv_videoio470 -lopencv_ximgproc470 -LC:/D/Apps/R/R-41~1.2/bin/i386 -lR installing to C:/D/Apps/R/R-4.1.2/library/Rvision/libs/i386

*** arch - x64 "C:/D/Apps/R/rtools40/mingw64/bin/"g++ -std=gnu++11 -I"C:/D/Apps/R/R-41~1.2/include" -DNDEBUG -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\include\opencv2" -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\include" -I"C:\D\Apps\R\R-4.1.2\library\ROpenCV\x64\mingw\bin" -I'C:/D/Apps/R/R-4.1.2/library/Rcpp/include' -I'C:/D/Apps/R/R-4.1.2/library/RcppArmadillo/include' -I"C:/D/Apps/R/R-4.1.2/library/Rcpp/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o "C:/D/Apps/R/rtools40/mingw64/bin/"g++ -std=gnu++11 -I"C:/D/Apps/R/R-41~1.2/include" -DNDEBUG -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\include\opencv2" -I"C:\D\Apps\R\R-41~1.2\library\ROpenCV\include" -I"C:\D\Apps\R\R-4.1.2\library\ROpenCV\x64\mingw\bin" -I'C:/D/Apps/R/R-4.1.2/library/Rcpp/include' -I'C:/D/Apps/R/R-4.1.2/library/RcppArmadillo/include' -I"C:/D/Apps/R/R-4.1.2/library/Rcpp/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c visionModule.cpp -o visionModule.o C:/D/Apps/R/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o Rvision.dll tmp.def RcppExports.o visionModule.o -LC:\D\Apps\R\R-4.1.2\library\ROpenCV\x64\mingw\lib -l -LC:/D/Apps/R/R-41~1.2/bin/x64 -lR C:/D/Apps/R/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l-LC:/D/Apps/R/R-41~1.2/bin/x64 C:/D/Apps/R/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-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 'Rvision'

Besides, I have also tried to library() (or not library()) of all the opencvlite or installr stuff, or restart rstudio, restart system, or runing the last line in RGui rather than Rstudio, or use proxy to crossing the Great Fire Wall (I'm in China) or not, it always failed as same as above. Seems it lack some file called "ld.exe: cannot find -l-LC:/D/Apps/R/R-41~1.2/bin/x64". There is no other people arond me used this package.

To Reproduce I'm not sure if anyone can reproduce this error. So how may I solve the problem? Or how may I install Rvision by other alternative ways? I didn't find Rvision package from CRAN archive website which I can do manual installation. Really hope for your reply. Best wishes!

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Computer (please complete the following information):

Sys.info() sysname release version nodename machine login user effective_user "Windows" "10 x64" "build 19044" "SHAN" "x86-64" "Shanshan" "Shanshan" "Shanshan"

R (please complete the following information):

Additional context Add any other context about the problem here.

sjmgarnier commented 1 year ago

@lishen-qian Thanks for reporting this issue. I'm not sure what's happening exactly but it looks like you're using a fairly old version of R and Rtools. Would you mind trying again after updating to their respective latest versions (R 4.2.3 and Rtools 4.2)?

lishen-qian commented 1 year ago

Thanks for your advise! after I tried to update to R 4.2.3 and Rtools 4.2, it still goes wrong as follow:

devtools::install_github("swarm-lab/Rvision") Downloading GitHub repo swarm-lab/Rvision@HEAD ── R CMD build ─────────────────────────────────────────────────────────────────────────────────── ✔ checking for file 'C:\Users\Shanshan\AppData\Local\Temp\RtmpyUyDFd\remotes394468b5775d\swarm-lab-Rvision-1ad0f19/DESCRIPTION' ... ─ preparing 'Rvision': (472ms) ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts (573ms) ─ checking for empty or unneeded directories Removed empty directory 'Rvision/man/figures' ─ building 'Rvision_0.7.0.tar.gz' Warning: file 'Rvision/configure' did not have execute permissions: corrected

Does it have something to do with the installation path of R4.2.3 and Rtools 4.2? I put it in C:\D\Apps\R\ rather than the default path.

sjmgarnier commented 1 year ago

@lishen-qian When installing Rtools, did you make sure that the installer added it to the system's path?

lishen-qian commented 1 year ago

@sjmgarnier Here are some steps I have tried:

  1. I re-installed the rtools 4.2 to it's default path c:\rtools42, as "https://cran.r-project.org/bin/windows/Rtools/rtools42/rtools.html" recomended
  2. I put the location of the rtools42 on the PATH manualy as "https://cran.microsoft.com/snapshot/2020-07-16/bin/windows/Rtools/" recomended
  3. I also set path in windows as "https://www.hanss.info/sebastian/post/rtools-path/" recomended
  4. I updated all the packages installed in my windows. But it still fails as follow:

devtools::install_github("swarm-lab/Rvision") Downloading GitHub repo swarm-lab/Rvision@HEAD ── R CMD build ──────────────────────────────────────────────────────────────────────────────────── ✔ checking for file 'C:\Users\Shanshan\AppData\Local\Temp\Rtmp6nEEWG\remotes4b681046b40\swarm-lab-Rvision-1ad0f19/DESCRIPTION' ... ─ preparing 'Rvision': (480ms) ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts (588ms) ─ checking for empty or unneeded directories Removed empty directory 'Rvision/man/figures' ─ building 'Rvision_0.7.0.tar.gz' Warning: file 'Rvision/configure' did not have execute permissions: corrected

Sys.which("make") make "C:\rtools42\usr\bin\make.exe"

system.PATH() [1] "C:\D\Apps\R\R-4.2.3\library\opencv\x64\mingw\bin"
[2] "C:\D\Apps\R\R-4.2.3\library\opencv\x64\mingw\bin"
[3] "C:\rtools42\x86_64-w64-mingw32.static.posix\bin"
[4] "C:\rtools42\usr\bin"
[5] "C:\rtools42\usr\bin"
[6] "C:\D\Apps\R\R-4.2.3\bin\x64"
[7] "C:\Program Files\Common Files\Oracle\Java\javapath_target_92031"
[8] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS" [9] "C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS"
[10] "C:\Windows\System32"
[11] "C:\Windows"
[12] "C:\Windows\System32\wbem"
[13] "C:\Windows\System32\WindowsPowerShell\v1.0"
[14] "C:\Windows\System32\OpenSSH"
[15] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL" [16] "C:\Program Files\Intel\Intel(R) Management Engine Components\DAL"
[17] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT" [18] "C:\Program Files\Intel\Intel(R) Management Engine Components\IPT"
[19] "C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common"
[20] "C:\D\Apps\MEGA-X"
[21] "C:\Windows\System32"
[22] "C:\Windows"
[23] "C:\Windows\System32\wbem"
[24] "C:\Windows\System32\WindowsPowerShell\v1.0"
[25] "C:\Windows\System32\OpenSSH"
[26] "C:\Users\Shanshan\Documents\Program FilesJavajdk-15bin"
[27] "C:\Users\Shanshan\Documents\Program FilesJavajdk-15jrebin"
[28] "C:\D\Apps\python"
[29] "C:\D\Apps\python\Scripts"
[30] "C:\Program Files\CMake\bin"
[31] "C:\rtools42\usr\bin"
[32] "C:\Users\Shanshan\AppData\Local\Microsoft\WindowsApps"
[33] "C:\D\Apps\Bandzip"
[34] "C:\D\Apps\TBtools"
[35] "C:\D\Apps\Zonation\zonation 4.0.0rc1_compact\bin"
[36] "C:\D\Apps\R\R-4.2.3\bin"
[37] "C:\D\Apps\RStudio\resources\app\bin\quarto\bin"
[38] "C:\D\Apps\RStudio\resources\app\bin\postback "

The element [31] and [36] of PATH vector above should be the right path, I think. 图片

@lishen-qian When installing Rtools, did you make sure that the installer added it to the system's path?

sjmgarnier commented 1 year ago

@lishen-qian What's the output of ROpenCVLite::isOpenCVInstalled()?

sjmgarnier commented 1 year ago

@lishen-qian I could not reproduce the error on Windows 10 and 11. The output of installr::system.PATH() on my machines is:

 [1] "C:\\rtools42\\x86_64-w64-mingw32.static.posix\\bin"                            
 [2] "C:\\rtools42\\usr\\bin"                                                        
 [3] "C:\\Program Files\\R\\R-4.2.3\\bin\\x64"   
...

As you can see, Rtools is first, followed by R, both in their standard locations. I do not have at the beginning the equivalent of your:

[1] "C:\D\Apps\R\R-4.2.3\library\opencv\x64\mingw\bin"
[2] "C:\D\Apps\R\R-4.2.3\library\opencv\x64\mingw\bin"

Maybe remove that.

Also, you have "C:\rtools42\usr\bin" multiple times in your path. I'd remove the repetitions.

I'm not sure why you have [36] "C:\D\Apps\R\R-4.2.3\bin" in addition to [6] "C:\D\Apps\R\R-4.2.3\bin\x64". Only the latter should be necessary.

I'm afraid that's the best I can do without directly accessing the machine itself.

lishen-qian commented 1 year ago

So sorry for occupy so much time of you, the output is:

ROpenCVLite::isOpenCVInstalled() [1] TRUE

I have removed all r and rstudio and all packages, re-install them in their default path like I use r the first time, and re-install all cmake, ropencvlite, opencv, installr and devtools, it still goes wrong as:

installr::system.PATH() [1] "C:\Program Files\R\R-4.2.3\library\opencv\x64\mingw\bin"
[2] "C:\rtools42\x86_64-w64-mingw32.static.posix\bin"
[3] "C:\rtools42\usr\bin"
[4] "C:\rtools42\usr\bin"
[5] "C:\Program Files\R\R-4.2.3\bin\x64"
[6] "C:\Program Files\Common Files\Oracle\Java\javapath_target_92031"
[7] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS" [8] "C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS"
[9] "C:\Windows\System32"
[10] "C:\Windows"
[11] "C:\Windows\System32\wbem"
[12] "C:\Windows\System32\WindowsPowerShell\v1.0"
[13] "C:\Windows\System32\OpenSSH"
[14] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL" [15] "C:\Program Files\Intel\Intel(R) Management Engine Components\DAL"
[16] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT" [17] "C:\Program Files\Intel\Intel(R) Management Engine Components\IPT"
[18] "C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common"
[19] "C:\D\Apps\MEGA-X"
[20] "C:\Windows\System32"
[21] "C:\Windows"
[22] "C:\Windows\System32\wbem"
[23] "C:\Windows\System32\WindowsPowerShell\v1.0"
[24] "C:\Windows\System32\OpenSSH"
[25] "C:\Users\Shanshan\Documents\Program FilesJavajdk-15bin"
[26] "C:\Users\Shanshan\Documents\Program FilesJavajdk-15jrebin"
[27] "C:\D\Apps\python"
[28] "C:\D\Apps\python\Scripts"
[29] "C:\Program Files\CMake\bin"
[30] "C:\Users\Shanshan\AppData\Local\Microsoft\WindowsApps"
[31] "C:\D\Apps\Bandzip"
[32] "C:\D\Apps\TBtools"
[33] "C:\D\Apps\Zonation\zonation 4.0.0rc1_compact\bin"
[34] "C:\D\Apps\RStudio\resources\app\bin\quarto\bin"
[35] "C:\D\Apps\RStudio\resources\app\bin\postback "
ROpenCVLite::isOpenCVInstalled() [1] TRUE

devtools::install_github("swarm-lab/Rvision") Downloading GitHub repo swarm-lab/Rvision@HEAD ── R CMD build ──────────────────────────────────────────────────────────────────────────────────── ✔ checking for file 'C:\Users\Shanshan\AppData\Local\Temp\RtmpGC8reh\remotes13f045966566\swarm-lab-Rvision-1ad0f19/DESCRIPTION' ... ─ preparing 'Rvision': (555ms) ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts (614ms) ─ checking for empty or unneeded directories Removed empty directory 'Rvision/man/figures' ─ building 'Rvision_0.7.0.tar.gz' Warning: file 'Rvision/configure' did not have execute permissions: corrected

Strange thing is, the output of installr::system.PATH() is depend on time, some times it goes these at first:

[1] "C:\rtools42\x86_64-w64-mingw32.static.posix\bin"
[2] "C:\rtools42\usr\bin" [3]xxxxxx...... and some times it goes these at first: [1] "C:\Program Files\R\R-4.2.3\library\opencv\x64\mingw\bin"
[2] "C:\rtools42\x86_64-w64-mingw32.static.posix\bin"
[3] "C:\rtools42\usr\bin"
[4] "C:\rtools42\usr\bin" [5] xxxx......

I also did some controlled experiments,manually change the first three PATH as yours, remove the duplicate, it still goes the same error:

newpath<-"C:\rtools42\x86_64-w64-mingw32.static.posix\bin;C:\rtools42\usr\bin;C:\Program Files\R\R-4.2.3\bin\x64;C:\Program Files\Common Files\Oracle\Java\javapath_target_92031;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\D\Apps\MEGA-X;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Shanshan\Documents\Program FilesJavajdk-15bin;C:\Users\Shanshan\Documents\Program FilesJavajdk-15jrebin;C:\D\Apps\python;C:\D\Apps\python\Scripts;C:\Program Files\CMake\bin;C:\Users\Shanshan\AppData\Local\Microsoft\WindowsApps;C:\D\Apps\Bandzip;C:\D\Apps\TBtools;C:\D\Apps\Zonation\zonation 4.0.0rc1_compact\bin;C:\D\Apps\RStudio\resources\app\bin\quarto\bin;C:\D\Apps\RStudio\resources\app\bin\postback" Sys.setenv(PATH=newpath) installr::system.PATH() [1] "C:\rtools42\x86_64-w64-mingw32.static.posix\bin"
[2] "C:\rtools42\usr\bin"
[3] "C:\Program Files\R\R-4.2.3\bin\x64"
[4] "C:\Program Files\Common Files\Oracle\Java\javapath_target_92031"
[5] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS" [6] "C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS"
[7] "C:\Windows\System32"
[8] "C:\Windows"
[9] "C:\Windows\System32\wbem"
[10] "C:\Windows\System32\WindowsPowerShell\v1.0"
[11] "C:\Windows\System32\OpenSSH"
[12] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL" [13] "C:\Program Files\Intel\Intel(R) Management Engine Components\DAL"
[14] "C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT" [15] "C:\Program Files\Intel\Intel(R) Management Engine Components\IPT"
[16] "C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common"
[17] "C:\D\Apps\MEGA-X"
[18] "C:\Windows\System32"
[19] "C:\Windows"
[20] "C:\Windows\System32\wbem"
[21] "C:\Windows\System32\WindowsPowerShell\v1.0"
[22] "C:\Windows\System32\OpenSSH"
[23] "C:\Users\Shanshan\Documents\Program FilesJavajdk-15bin"
[24] "C:\Users\Shanshan\Documents\Program FilesJavajdk-15jrebin"
[25] "C:\D\Apps\python"
[26] "C:\D\Apps\python\Scripts"
[27] "C:\Program Files\CMake\bin"
[28] "C:\Users\Shanshan\AppData\Local\Microsoft\WindowsApps"
[29] "C:\D\Apps\Bandzip"
[30] "C:\D\Apps\TBtools"
[31] "C:\D\Apps\Zonation\zonation 4.0.0rc1_compact\bin"
[32] "C:\D\Apps\RStudio\resources\app\bin\quarto\bin"
[33] "C:\D\Apps\RStudio\resources\app\bin\postback "
devtools::install_github("swarm-lab/Rvision") Downloading GitHub repo swarm-lab/Rvision@HEAD ── R CMD build ──────────────────────────────────────────────────────────────────────────────────── ✔ checking for file 'C:\Users\Shanshan\AppData\Local\Temp\RtmpGC8reh\remotes13f078c1e2d\swarm-lab-Rvision-1ad0f19/DESCRIPTION' (337ms) ─ preparing 'Rvision': (745ms) ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ checking for LF line-endings in source and make files and shell scripts (863ms) ─ checking for empty or unneeded directories Removed empty directory 'Rvision/man/figures' ─ building 'Rvision_0.7.0.tar.gz' Warning: file 'Rvision/configure' did not have execute permissions: corrected

It seems I have to turn into python if I have to use opencv staff. Thank you anyway! Best wishes.

sjmgarnier commented 1 year ago

@lishen-qian I can't make sense of that error: C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: cannot find -l-LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64. It's not something caused by Rvision itself but by something missing or corrupted in your installation. You may have more luck posting your question on the r-devel mailing list. They're usually very quick to respond.