From tom@@@k@||ber@ @end|ng |rom gm@||@com  Tue Nov 29 13:44:30 2022
From: tom@@@k@||ber@ @end|ng |rom gm@||@com (Tomas Kalibera)
Date: Tue, 29 Nov 2022 13:44:30 +0100
Subject: [Rd] RTools40 Error - sh: line 1: gcc: command not found
In-Reply-To: <CAOBARVhCJfGTv_7x_OkvN+1whoRegwTKBa9z_gWJqg6kdmXrXA@mail.gmail.com>
References: <CAOBARVi9JV0fJcxjt-=gH3Xa8t6GYFOVKty1EHpm8CodyO+txw@mail.gmail.com>
 <3E9F1E02-93E4-4B46-9774-D5BC9D505BB0@R-project.org>
 <CAOBARVhCJfGTv_7x_OkvN+1whoRegwTKBa9z_gWJqg6kdmXrXA@mail.gmail.com>
Message-ID: <bf6c8a17-1567-8023-1d49-b29caef4777e@gmail.com>

On 11/28/22 23:33, Gene Leynes wrote:
> Thanks. Not sure how I ended up on 40 instead of 42.
>
> After deleting the 40 version and installing the 42 version, the 42
> installer seemed to create path variables for 40. I just edited that
> however and the jsonlite test worked.

Rtools42 is not creating variables for Rtools40, so that shouldn't be 
the cause.

You can have Rtools40 and Rtools42 both installed on the machine (if 
needed, e.g. for older versions of R).

> I do think that it would be advisable to tell users to check the path and
> explain what result is desired there. Many users would benefit from knowing
> that they need R's executables and the RTools bin on their path and that
> they can add them via the *user *environment variables, which saves them
> from needing administrative permission (and is better anyway for system
> maintenance).
>
> However, it's less important now that I see that the installer handles it
> for you.

Right, the paths don't have to be set manually when using the defaults. 
For other cases, please see

https://cran.r-project.org/bin/windows/base/howto-R-4.2.html

Best
Tomas

>
> Thank you again.
>
>
>
>
>
>
> On Mon, Nov 28, 2022 at 3:54 PM Simon Urbanek <simon.urbanek at r-project.org>
> wrote:
>
>> Gene,
>>
>> I believe you have the wrong page - the link you listed is for an old
>> version of R (4.0-4.1) - the current one (for 4.2.x) is
>>
>> https://cran.r-project.org/bin/windows/Rtools/rtools42/rtools.html
>>
>> Cheers,
>> Simon
>>
>>
>>> On 29/11/2022, at 7:39 AM, Gene Leynes <gleynes at gmail.com> wrote:
>>>
>>> Hello,
>>>
>>> I installed git bash for windows, R, RStudio, and R Tools on a fresh
>>> Windows 10 machine.
>>>
>>> I followed the directions for RTools:
>>> https://cran.r-project.org/bin/windows/Rtools/rtools40.html
>>>
>>> I added RTools to my user path, but I was getting an error when
>>> installing jsonlite from source (even though it could find "make"
>>> correctly). So, I tried the .Renviron method, and that didn't work
>> either.
>>> I was getting errors like this:
>>>
>>>> install.packages("jsonlite", type = "source")
>>> --- Please select a CRAN mirror for use in this session ---
>>> trying URL '
>> https://cloud.r-project.org/src/contrib/jsonlite_1.8.3.tar.gz'
>>> Content type 'application/x-gzip' length 1053099 bytes (1.0 MB)
>>> downloaded 1.0 MB
>>>
>>>
>>> * installing *source* package 'jsonlite' ...
>>> ** package 'jsonlite' successfully unpacked and MD5 sums checked
>>> ** using staged installation
>>> ** libs
>>> gcc  -I"C:/Users/XXXXXXX/AppData/Local/Programs/R/R-42~1.2/include"
>>> -DNDEBUG -Iyajl/api
>>> -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"
>>> -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2
>>> -mstackrealign  -c base64.c -o base64.o
>>> sh: line 1: gcc: command not found
>>> make: *** [C:/Users/ XXXXXXX
>>> /AppData/Local/Programs/R/R-42~1.2/etc/x64/Makeconf:253:
>>> base64.o] Error 127
>>> ERROR: compilation failed for package 'jsonlite'
>>> * removing
>>> 'C:/Users/375492/AppData/Local/Programs/R/R-4.2.2/library/jsonlite'
>>>
>>>
>>> The downloaded source packages are in
>>>         ?C:\Users\ XXXXXXX
>>> \AppData\Local\Temp\RtmpeCLXit\downloaded_packages?
>>> Warning message:
>>> In install.packages("jsonlite", type = "source") :
>>>   installation of package ?jsonlite? had non-zero exit status
>>>
>>>
>>> I can't reproduce this part, but at one point it said that gcc wasn't
>> found
>>> in C:\rtools40\mingw_64\bin (not sure where the underscore was, but it
>> had
>>> an underscore)
>>>
>>> I noticed that my folder is named C:\rtools40\mingw64\bin
>>>
>>> That gave me the idea to add C:\rtools40\mingw64\bin to my user path
>> which
>>> resolved the issues. Adding that to the path allowed me to compile from
>>> source, etc. Fixed RStudio and the R GUI (whatever we call it now).
>>>
>>> TLDR: I think there's a bug in the installer or something that creating
>> an
>>> incompatible path name with an underscore, or the instructions are
>> missing
>>> the advice to add C:\rtools40\mingw{WIN}\bin to the path.
>>>
>>>
>>>
>>> Somewhat related:
>>>
>>> By the way, I think adding RTools to the user path is the superior option
>>> for Windows users, and I would like to propose an edit to that
>>> documentation.
>>>
>>> First, it will help avoid complications for users who may
>>> experience different paths for ~ depending on network availability.
>>>
>>> Second, it is a more standard way to edit the path and helps users learn
>>> what's going on with the path and makes R less of a mysterious "exception
>>> to the rule". No other program uses ~/.Renviron to edit the path.
>>>
>>> Although it's worth mentioning the option to create ~/.Renviorn, it
>>> shouldn't be the primary instruction.
>>>
>>> Would it be possible to create a pull request for those edits? I don't
>> know
>>> where that documentation is maintained.
>>>
>>>
>>> Thank you, and I hope you all are doing well.
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] RTools40 Error - sh: line 1: gcc: command not found
Tomas Kalibera