Can't build package using "devtools" : cannot find -lrtmp -lssl -lssh2 -lcrypto

Hello,
I just want to build a package using the lastest R (R-4.0.5, rtools40, RStudio-1.4.1106) and devtools on Windows 10. The functions in package can run well, but when I use build("PATH/myPackage") to buile the package, after some checks the Console threw out some errors and the program ended.
I use .Last.error.trace to check the error and the message is shown as follows:

x System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> D:/Coding/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lrtmp
E> D:/Coding/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lssl
E> D:/Coding/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lssh2
E> D:/Coding/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcrypto
E> collect2.exe: error: ld returned 1 exit status
E> no DLL was created
E> ERROR: compilation failed for package 'myPackage'
E> * removing ' ...'
E>       -----------------------------------
E> ERROR: package installation failed 

It is noticed that -lrtmp -lssl -lssh2 -lcrypto cannot be found
I thought the problem may occur in rtools40 so I tried reinstalling the rtools40, but nothing changed. Now I don't know what I can do to solve this. I am a newbie in R please help me.
Thanks a lot!

  • What package are you trying to build?

  • What do the following functions return?

devtools::has_devel()
devtools::dev_sitrep()