Error: Failed to create the shared library. Is it the Rtools version?

124 views
Skip to first unread message

Glenn Stauffer

unread,
Jun 13, 2019, 6:29:36 PM6/13/19
to nimble-users
I just got a new laptop, and when I tried to compile a model, I got an error Failed to create shared library: 

> Cnim <- compileNimble(nim,showCompilerOutput=TRUE)
compiling... this may take a minute. On some systems there may be some compiler warnings that can be safely ignored.
Warning message:
In system(cmd) : 'make' not found
Error: Failed to create the shared library.


I then realized that my IT tech had not installed Rtools, so I installed Rtools35. The problem persisted (even after a reboot), so I thought maybe I needed Rtools34 instead. I installed it (but it failed to update the Windows registry - not sure if that is a problem), but still no luck compiling. 
Running the following code suggest that R 3.5.0 (the latest version I am authorized to install) needs Rtools35.

> pkgbuild::find_rtools(debug = TRUE)
Scanning R CMD config CC...
cc_path:  
'.exe' does not exist
Scanning path...
Scanning registry...
Found C:/Rtools for 3.4 
Found C:/Rtools for 3.5 
VERSION.txt
Rtools version 3.4.0.1964 
WARNING: Rtools is required to build R packages, but no version of Rtools compatible with R 3.5.0 was found. Rtools 3.5 was previously installed in C:/Rtools but now that directory contains Rtools 3.4.

Please download and install Rtools 3.5 from http://cran.r-project.org/bin/windows/Rtools/.


Is this likely to be Rtools problem, and if so, does it really matter whether I have 34 or 35? The old laptop (which is gone now) definitely also had R 3.5.0, and I am almost certain it had Rtools 34, not 35, so I am puzzled by the message that 34 is not compatible with R 3.5.0.


Thanks,
Glenn

Perry de Valpine

unread,
Jun 14, 2019, 5:46:22 PM6/14/19
to Glenn Stauffer, nimble-users
Hi Glenn,

It's hard for us to diagnose what seem to be system-specific issues.

On Windows, when installing Rtools, it is important to be sure to check the box that tells it to modify the PATH system variable.

If that doesn't help, I suggest as a first step to try to diagnose Rtools installation issues outside of nimble, such as with a simple Rcpp example (easy to find online).

-Perry


--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To post to this group, send email to nimble...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/438e4458-cefc-4380-ad6c-5c3984b2a4b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Glenn Stauffer

unread,
Jun 17, 2019, 11:17:55 AM6/17/19
to nimble-users
Perry,
Thanks for the reply - I was out a few days and didn't see it until this morning.

I tried a few things and have not resolved the problem. 

1) I had failed to properly uninstall Rtools 3.5 before I tried to install Rtools 3.4, so that may have been the problem with the note about "Rtools 3.5 was previously installed..." Uninstalling, and then reinstalling made that message go away, and it seems that find_rtools(debug=TRUE) successfully find Rtools regardless of whether I installed Rtools 3.5 or 3.4. But the nimble model won't compile either way.

2) I tried a few of the examples in the package RcppExamples, and they all seemed to work. So, if Rtools is required for those to work, then it seems that things are working on that front.

3) Rtools 3.5 installs without errors, but it appears that there is not an option to modify the PATH system variable, as there is with Rtools 3.4. Not sure what that means for nimble.

4) When I install Rtools 3.4 (checking the box to modify PATH), I encounter an error: 

Error creating registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

RegCreateKeyEx Failed; code S.
Access is denied.

Click Retry to try again, Ignore to proceed anyway, or Abort to cancel installation.

5) Clicking Ignore to proceed anyway does seem to go ahead and install Rtools anyway, and find_rtools(debug=TRUE) does find it, and the examples from RcppExamples do seem to work. But my nimble model still won't compile.

6) when I install Rtools 3.4 (checking the box for PATH, but unchecking the box to modify the registry key), I still get the same error message, and find_rtools() still returns TRUE, and the examples from RcppExamples still succeed. However, find_rtools(debug==TRUE) returns the following:

Scanning R CMD config CC...
cc_path:  
'.exe' does not exist
Scanning path...
Scanning registry...
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 3.5 from http://cran.r-project.org/bin/windows/Rtools/.


So, I suspect the you are right and that it is a system-specific issue. I think my best guess (but it is just a guess), is that maybe nimble really does not work with Rtool 3.5 (no option to modify PATH), and the missing registry key for Rtools 3.4 (maybe because I installed Rtools 3.5 first) is also now preventing proper function of 3.4. I will see if I can take this up with my IT guy and resolve the registry issue. But if others have had success with Rtools 3.5 (this is now the recommended version on the install page), then clearly that is not my problem.

Thanks again for the suggestions.
Glenn

Perry de Valpine

unread,
Jun 17, 2019, 1:52:13 PM6/17/19
to Glenn Stauffer, nimble-users
Thanks for the detailed information, Glenn.

I will try to look into this later, but it's not clear how nimble-related it is or not.

Searching on "RegCreateKeyEx Failed; code S." suggests that this is an issue people are seeing on Windows (not necessarily related to Rtools) and that using administrative privileges may overcome it.

Any Windows users with related experience out there?

-Perry


--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To post to this group, send email to nimble...@googlegroups.com.

Glenn Stauffer

unread,
Jun 17, 2019, 2:15:12 PM6/17/19
to nimble-users
I strongly suspect that you are correct that it is a permissions issue, possibly even with Rtools 3.5. But I am curious if others have succeed with nimble and Rtools 3.5?

At this point, I am not entirely sure that I will be able to get the possible permissions issues satisfactorily resolved (in which case I'll just have to use nimble exclusively on my personal Linux laptop). But I'll report back here if I get it resolved.

Glenn
To unsubscribe from this group and stop receiving emails from it, send an email to nimble...@googlegroups.com.

Perry de Valpine

unread,
Jun 18, 2019, 1:17:14 PM6/18/19
to Glenn Stauffer, nimble-users
Hi Glenn,

I was able to install everything on Windows from the ground up: R 3.6.0, Rtools 3.5, then nimble, with no problems.  I see you are required to work on R 3.5.0.  I did not attempt to go back to that and check everything.

You noted Rtools 3.5 did not ask you about the PATH variable.  When I installed it, it showed a checkbox for “Add rtools to system PATH”, which I needed to check.

If you need to work locally (i.e. not in directories requiring admin privileges), I think it is possible.  You can install packages locally by options in install.packages() and library().  One way to automate that is to use .libPaths("directory_you_want") in a .Rprofile file.  I believe you do need to be careful when upgrading R, as the locally-installed packages may then fall out of date.  I think it is also possible to install Rtools locally, although I've never tried it.

I hope it helps.  If you figure out a solution on your system that might be useful to others, please share it.

-Perry


To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.

To post to this group, send email to nimble...@googlegroups.com.

Carl Boettiger

unread,
Jun 18, 2019, 2:00:58 PM6/18/19
to Perry de Valpine, Glenn Stauffer, nimble-users
Hi Glenn,

Just a quick note that you can always set  your PATH after the fact in a `.Renviron` file, either in your project dir or home dir, see https://github.com/rwinlib/rtools35/blob/master/docs/Rtools.txt#L16-L22

There's not much difference between Rtools 3.4 & 3.5

HTH,


Glenn Stauffer

unread,
Jun 19, 2019, 2:43:45 PM6/19/19
to nimble-users
Thanks Carl and Perry,

I think I am up and running now. I didn't know about a '.Renviron' file, but I defined a '.Rprofile' file, located in the  Sys.getenv("HOME") directory and put this line in it:
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))

and now things seem to work as they should.

> Sys.getenv("PATH")
[1] "C:\\Rtools\\bin;C:\\Oracle\\ORA11\\64\\bin;C:\\Oracle\\ORA11\\32\\bin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\CCM;C:\\Program Files (x86)\\Microsoft Application Virtualization Client;C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\Users\\staufge\\AppData\\Local\\Microsoft\\WindowsApps;"

> pkgbuild::find_rtools(debug=TRUE)

Scanning R CMD config CC...

cc_path
: c:/Rtools/mingw_64/bin/gcc
install_path
: c:/Rtools
VERSION
.txt
Rtools version 3.5.0.4
Found compatible gcc from R CMD config CC
[1] TRUE


Interestingly, I also tried to get things working at home on a Windows 7 laptop, where I should not have any permissions issues at all, but I couldn't get it to work there. It doesn't matter, because I don't use that computer for analysis, but it's a curiousity issue for me now. I made sure Rtools was not installed, and then did a fresh install of R 3.5.0 (I also tried 3.6.0) and Rtools 3.5. As Perry noted, this time there was indeed an option to change the PATH variable (there was not on the other laptop with the permissions issue). The install seem to go fine, and the path looks OK (I think - not sure why the one location seems to be duplicated),

> Sys.getenv("PATH")
[1]  "C:\\Rtools\\bin;c:\\Rtools\\bin;c:\\Rtools\\mingw_32\\bin;C:\\Rtools\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;c:\\Program Files (x86)\\Intel\\iCLS Client\\;c:\\Program Files\\Intel\\iCLS Client\\;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;c:\\Program Files (x86)\\Hewlett-Packard\\HP ProtectTools Security Manager\\Bin\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\2.0\\bin\\x86;C:\\Program Files (x86)\\Intel\\OpenCL SDK\\2.0\\bin\\x64;C:\\Program Files (x86)\\Common Files\\HP\\Digital Imaging\\bin;C:\\Program Files (x86)\\HP\\Digital Imaging\\bin\\;C:\\Program Files (x86)\\HP\\Digital Imaging\\bin\\Qt\\Qt 4.3.3;"


but find_rtools returned:
 > pkgbuild::find_rtools(debug=TRUE)

Scanning R CMD config CC...
cc_path:
'.exe' does not exist
Scanning path...
ls: C:\Rtools\bin\ls.exe
gcc_path: c:\Rtools\mingw_32\bin\gcc.exe
VERSION.txt
Rtools version 3.5.0.4
Version: 3.5
Found compatible gcc on path
[1] TRUE(
Note that the cc_path says "
'.exe' does not exist", which, although I'm not sure exactly what that means, made me suspect that things were not as they should be (above it was "c:/Rtools/mingw_64/bin/gcc"), and the message about compatible gcc is different. Sure enough, the pump example would not compile. And interestingly, setting 'showCompilerOutput=TRUE' seemed to return less information rather than more. 

> Cpump <- compileNimble(pump)
compiling... this may take a minute. Use 'showCompilerOutput = TRUE' to see C++ compilation details.

Error: Failed to create the shared library.
In addition: Warning message:
In system(ssdSHLIBcmd, ignore.stdout = !showCompilerOutput, ignore.stderr = !showCompilerOutput,  :
  'C:/Program' not found

> Cpump <- compileNimble(pump,showCompilerOutput=TRUE)

compiling... this may take a minute. On some systems there may be some compiler warnings that can be safely ignored.
Error: Failed to create the shared library.

I am puzzled because it seems like the PATH is set correctly. So it seems to me that the solution I describe above likely would not work in this case - there must some other issue (with not finding the cc_path?). 

But anyway, where it counts, things are working again, and I don't want to waste anyone's time ferreting out the issue on the home laptop.
Thanks for the help!

Glenn



Reply all
Reply to author
Forward
0 new messages