Setting the path to Rtools for package compilation on Windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting the path to Rtools for package compilation on Windows

plangfelder
Hi all,

I'm trying to set up the Windows Rtools toolset for building packages
with compiled code. I installed for Windows R-3.4.3 from CRAN and
installed Rtools-3.4 in a custom location M:\R\R-3.4.3 and
M:\R\Rtools-3.4

Following the instructions, in shell, I set
Path=M:\R\Rtools-3.4\bin;M:\R\Rtools-3.4\gcc-4.6.3\bin;M:\R\R-3.4.3\bin;...
(the ... are other paths irrelevant for R/Rtools).

When I run

M:\Work\RLibs>R.exe CMD INSTALL --build WGCNA

I get the following ouput:

In R CMD INSTALL
* installing to library 'M:/R/R-3.4.3/library'
* installing *source* package 'WGCNA' ...
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -I"M:/R/R-3.4.3/include" -DNDEBUG
-O2 -Wall  -mtune=generic -c bucketApproxSort.cc
-o bucketApproxSort.o
c:/Rtools/mingw_32/bin/g++: not found
make: *** [bucketApproxSort.o] Error 127
Warning: running command 'make -f "Makevars.win" -f
"M:/R/R-3.4.3/etc/i386/Makeconf" -f "M:/R/R-3.4.3/share/make/winshli
b.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
SHLIB="WGCNA.dll" OBJECTS="bucketApproxSort.o corFun
ctions-common.o corFunctions-unified.o networkFunctions.o pivot.o
quantileC.o"' had status 2
ERROR: compilation failed for package 'WGCNA'
* removing 'M:/R/R-3.4.3/library/WGCNA'
* restoring previous 'M:/R/R-3.4.3/library/WGCNA'


Apparently the install is looking for Rtools in c:\Rtools. I am a
perpetual Windows newbie and would be really thankful for any pointers
as to how to proceed.

Peter

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting the path to Rtools for package compilation on Windows

Søren Højsgaard-2
I can confirm the behaviour that you report. 

Usually I put Rtools in c:\programs\Rtools and modify the path
accordingly. Recently (don't recall for how long) I have encountered
the same problems as you have and I have resorted to moving Rtools to
c:\Rtools

I have no idea as how to proceed; perhaps it could be worth trying an
older version of Rtools (though that may cause other problems).

Regards
Søren


On Mon, 2018-02-12 at 22:45 -0800, Peter Langfelder wrote:

> Hi all,
>
> I'm trying to set up the Windows Rtools toolset for building packages
> with compiled code. I installed for Windows R-3.4.3 from CRAN and
> installed Rtools-3.4 in a custom location M:\R\R-3.4.3 and
> M:\R\Rtools-3.4
>
> Following the instructions, in shell, I set
> Path=M:\R\Rtools-3.4\bin;M:\R\Rtools-3.4\gcc-4.6.3\bin;M:\R\R-
> 3.4.3\bin;...
> (the ... are other paths irrelevant for R/Rtools).
>
> When I run
>
> M:\Work\RLibs>R.exe CMD INSTALL --build WGCNA
>
> I get the following ouput:
>
> In R CMD INSTALL
> * installing to library 'M:/R/R-3.4.3/library'
> * installing *source* package 'WGCNA' ...
> ** libs
>
> *** arch - i386
> c:/Rtools/mingw_32/bin/g++  -I"M:/R/R-3.4.3/include" -DNDEBUG
> -O2 -Wall  -mtune=generic -c bucketApproxSort.cc
> -o bucketApproxSort.o
> c:/Rtools/mingw_32/bin/g++: not found
> make: *** [bucketApproxSort.o] Error 127
> Warning: running command 'make -f "Makevars.win" -f
> "M:/R/R-3.4.3/etc/i386/Makeconf" -f "M:/R/R-3.4.3/share/make/winshli
> b.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
> SHLIB="WGCNA.dll" OBJECTS="bucketApproxSort.o corFun
> ctions-common.o corFunctions-unified.o networkFunctions.o pivot.o
> quantileC.o"' had status 2
> ERROR: compilation failed for package 'WGCNA'
> * removing 'M:/R/R-3.4.3/library/WGCNA'
> * restoring previous 'M:/R/R-3.4.3/library/WGCNA'
>
>
> Apparently the install is looking for Rtools in c:\Rtools. I am a
> perpetual Windows newbie and would be really thankful for any
> pointers
> as to how to proceed.
>
> Peter
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting the path to Rtools for package compilation on Windows

Tomas Kalibera
Thanks for the report - this has been already reported as bug 17376, it
is caused by scripts that build the Windows binaries and by now has been
fixed in R-patched and R-devel snapshot builds. So as a solution that
works now I would recommend using R-patched.

Tomas


On 02/13/2018 08:33 AM, Søren Højsgaard wrote:

> I can confirm the behaviour that you report.
>
> Usually I put Rtools in c:\programs\Rtools and modify the path
> accordingly. Recently (don't recall for how long) I have encountered
> the same problems as you have and I have resorted to moving Rtools to
> c:\Rtools
>
> I have no idea as how to proceed; perhaps it could be worth trying an
> older version of Rtools (though that may cause other problems).
>
> Regards
> Søren
>
>
> On Mon, 2018-02-12 at 22:45 -0800, Peter Langfelder wrote:
>> Hi all,
>>
>> I'm trying to set up the Windows Rtools toolset for building packages
>> with compiled code. I installed for Windows R-3.4.3 from CRAN and
>> installed Rtools-3.4 in a custom location M:\R\R-3.4.3 and
>> M:\R\Rtools-3.4
>>
>> Following the instructions, in shell, I set
>> Path=M:\R\Rtools-3.4\bin;M:\R\Rtools-3.4\gcc-4.6.3\bin;M:\R\R-
>> 3.4.3\bin;...
>> (the ... are other paths irrelevant for R/Rtools).
>>
>> When I run
>>
>> M:\Work\RLibs>R.exe CMD INSTALL --build WGCNA
>>
>> I get the following ouput:
>>
>> In R CMD INSTALL
>> * installing to library 'M:/R/R-3.4.3/library'
>> * installing *source* package 'WGCNA' ...
>> ** libs
>>
>> *** arch - i386
>> c:/Rtools/mingw_32/bin/g++  -I"M:/R/R-3.4.3/include" -DNDEBUG
>> -O2 -Wall  -mtune=generic -c bucketApproxSort.cc
>> -o bucketApproxSort.o
>> c:/Rtools/mingw_32/bin/g++: not found
>> make: *** [bucketApproxSort.o] Error 127
>> Warning: running command 'make -f "Makevars.win" -f
>> "M:/R/R-3.4.3/etc/i386/Makeconf" -f "M:/R/R-3.4.3/share/make/winshli
>> b.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
>> SHLIB="WGCNA.dll" OBJECTS="bucketApproxSort.o corFun
>> ctions-common.o corFunctions-unified.o networkFunctions.o pivot.o
>> quantileC.o"' had status 2
>> ERROR: compilation failed for package 'WGCNA'
>> * removing 'M:/R/R-3.4.3/library/WGCNA'
>> * restoring previous 'M:/R/R-3.4.3/library/WGCNA'
>>
>>
>> Apparently the install is looking for Rtools in c:\Rtools. I am a
>> perpetual Windows newbie and would be really thankful for any
>> pointers
>> as to how to proceed.
>>
>> Peter
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting the path to Rtools for package compilation on Windows

Jeroen Ooms
In reply to this post by plangfelder
On Tue, Feb 13, 2018 at 7:45 AM, Peter Langfelder
<[hidden email]> wrote:

> Hi all,
>
> I'm trying to set up the Windows Rtools toolset for building packages
> with compiled code. I installed for Windows R-3.4.3 from CRAN and
> installed Rtools-3.4 in a custom location M:\R\R-3.4.3 and
> M:\R\Rtools-3.4
>
> Following the instructions, in shell, I set
> Path=M:\R\Rtools-3.4\bin;M:\R\Rtools-3.4\gcc-4.6.3\bin;M:\R\R-3.4.3\bin;...
> (the ... are other paths irrelevant for R/Rtools).

Thanks for your question. Your logs show that 'gcc' is not found. As
of R 3.3 you need to set the path to the compiler using the BINPREF
variable. This is because we ship two separate versions of gcc, one
targeting win32 and one targeting win64. I am not sure what your
rtools installation looks like, but could you try setting this
environment variable:

  BINPREF="M:/R/Rtools-3.4/mingw_$(WIN)/bin/"

I think this will do the job.

On Tue, Feb 13, 2018 at 10:21 AM, Tomas Kalibera
<[hidden email]> wrote:
> Thanks for the report - this has been already reported as bug 17376, it is
> caused by scripts that build the Windows binaries and by now has been fixed
> in R-patched and R-devel snapshot builds. So as a solution that works now I
> would recommend using R-patched.

This issue is unrelated, I doubt your advice will solve anything. The
only thing that 17376 does is add c:/rtools/bin to the default path.
But this dir does not exist for this user, so it is ignored by windows
when searching the PATH.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting the path to Rtools for package compilation on Windows

plangfelder
On Tue, Feb 13, 2018 at 2:20 AM, Jeroen Ooms <[hidden email]> wrote:

> Thanks for your question. Your logs show that 'gcc' is not found. As
> of R 3.3 you need to set the path to the compiler using the BINPREF
> variable. This is because we ship two separate versions of gcc, one
> targeting win32 and one targeting win64. I am not sure what your
> rtools installation looks like, but could you try setting this
> environment variable:
>
>   BINPREF="M:/R/Rtools-3.4/mingw_$(WIN)/bin/"
>
> I think this will do the job.

Thanks, that indeed did the trick. May I suggest that this hint be
also included in "REMAINING TASKS" section of the file Rtools.txt that
is part of the Rtools distribution?  The R installation manual does
mention BINPREF and BINPREF64 but I missed that part...

Peter

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting the path to Rtools for package compilation on Windows

Jeroen Ooms
On Tue, Feb 13, 2018 at 7:58 PM, Peter Langfelder
<[hidden email]> wrote:

> On Tue, Feb 13, 2018 at 2:20 AM, Jeroen Ooms <[hidden email]> wrote:
>
>> Thanks for your question. Your logs show that 'gcc' is not found. As
>> of R 3.3 you need to set the path to the compiler using the BINPREF
>> variable. This is because we ship two separate versions of gcc, one
>> targeting win32 and one targeting win64. I am not sure what your
>> rtools installation looks like, but could you try setting this
>> environment variable:
>>
>>   BINPREF="M:/R/Rtools-3.4/mingw_$(WIN)/bin/"
>>
>> I think this will do the job.
>
> Thanks, that indeed did the trick. May I suggest that this hint be
> also included in "REMAINING TASKS" section of the file Rtools.txt that
> is part of the Rtools distribution?  The R installation manual does
> mention BINPREF and BINPREF64 but I missed that part...

Glad it worked. Actually BINPREF64 only exists when building R itself.
For the R user there is no BINPREF64. There is only BINPREF which has
to point to a 32bit gcc when R runs in 32bit, and a 64bit compiler
when R runs in 64bit. But if you compile R packages you need both at
the same time. Hence the "$(WIN)" variable in the BINPREF above.

Yes the rtools setup is a bit convoluted, and we're currently
discussing ways to improve this. Thanks for your suggestion.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting the path to Rtools for package compilation on Windows

Gabor Grothendieck
If there is work going on to improve Rtools

1. one of the most annoying aspects of it is that it does not play nice
with builtin Windows commands.  In particular, it defines a command
called find which works like UNIX find but it masks Windows find
if you add the Rtools folders to your PATH making it quite dangerous
to do so.

2. Another annoyance is that what to put on the PATH can change from
one Rtools version to another and it is not straight forward to
discover that automatically.  One can extract it from the unins000.dat
(and I have done that) but it is not straight forward.

3. Ideally it would be nice if it were as easy to install Rtools as installing
an R package.  In fact, maybe Rtools could be an R package or maybe
it could be part of the R installation process itself.



On Wed, Feb 14, 2018 at 7:32 AM, Jeroen Ooms <[hidden email]> wrote:

> On Tue, Feb 13, 2018 at 7:58 PM, Peter Langfelder
> <[hidden email]> wrote:
>> On Tue, Feb 13, 2018 at 2:20 AM, Jeroen Ooms <[hidden email]> wrote:
>>
>>> Thanks for your question. Your logs show that 'gcc' is not found. As
>>> of R 3.3 you need to set the path to the compiler using the BINPREF
>>> variable. This is because we ship two separate versions of gcc, one
>>> targeting win32 and one targeting win64. I am not sure what your
>>> rtools installation looks like, but could you try setting this
>>> environment variable:
>>>
>>>   BINPREF="M:/R/Rtools-3.4/mingw_$(WIN)/bin/"
>>>
>>> I think this will do the job.
>>
>> Thanks, that indeed did the trick. May I suggest that this hint be
>> also included in "REMAINING TASKS" section of the file Rtools.txt that
>> is part of the Rtools distribution?  The R installation manual does
>> mention BINPREF and BINPREF64 but I missed that part...
>
> Glad it worked. Actually BINPREF64 only exists when building R itself.
> For the R user there is no BINPREF64. There is only BINPREF which has
> to point to a 32bit gcc when R runs in 32bit, and a 64bit compiler
> when R runs in 64bit. But if you compile R packages you need both at
> the same time. Hence the "$(WIN)" variable in the BINPREF above.
>
> Yes the rtools setup is a bit convoluted, and we're currently
> discussing ways to improve this. Thanks for your suggestion.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel