From tom@@@k@||ber@ @end|ng |rom gm@||@com  Wed Mar 11 13:57:12 2020
From: tom@@@k@||ber@ @end|ng |rom gm@||@com (Tomas Kalibera)
Date: Wed, 11 Mar 2020 13:57:12 +0100
Subject: [Rd] R CMD INSTALL cannot recognize full path on Windows
In-Reply-To: <CAGiFhPPWY64mPjett5aZ5EdRwAkP2TBJn42d9G4iCyLsq_3g+g@mail.gmail.com>
References: <CAGiFhPM1C_J_LGUWVHc-jb8DpbVqt_c9ZwMjCafT0ZLozsbe0Q@mail.gmail.com>
 <b372a694-da0b-e16a-4798-7978c78b6bd5@gmail.com>
 <CAGiFhPOutqdxQ+is13-bFGx93f531O28zb20kPDsD1AdMn9_TA@mail.gmail.com>
 <CAGiFhPPWY64mPjett5aZ5EdRwAkP2TBJn42d9G4iCyLsq_3g+g@mail.gmail.com>
Message-ID: <8b15a23e-7db0-b4f7-d5a4-327230e6fdbb@gmail.com>


Thanks, Jiefei, unfortunately your example does not work on my system, 
and also it is far from minimal. The error message you are getting is 
from Windows and could be caused for example by accidental quoting of 
the path using single quotes.

Issues with RStudio or devtools would have to be discussed in their 
mailing lists/with their authors, but my guess is that the problem is in 
your local configuration, and after all you need it to work with the 
base R CMD INSTALL anyway. There is not much wrong R could do here, it 
just sets R_HOME and runs "make".

For example this works for me, but some closer alternations of your code 
work as well:

test1 := $(shell $(R_HOME)/bin/R --slave -e 'runif(3)')
all:
 ??????? echo "test1 is $(test1)"
 ??????? echo "R_HOME is $(R_HOME)"

I would recommend that you try to narrow down your example so that it is 
really minimal. Use R_HOME, not hard-coded paths, as that is what you 
would use in reality anyway. Print R_HOME and check it is valid. If the 
problem persists, find out why it works when invoked from the command 
line but not from R CMD INSTALL.

Best
Tomas

On 3/10/20 10:15 AM, Wang Jiefei wrote:
> ? Oops, I think both of us forget to cite the r-devel channel.
>
> Best,
> Jiefei
>
> On Tue, Mar 10, 2020 at 5:13 AM Wang Jiefei <szwjf08 at gmail.com 
> <mailto:szwjf08 at gmail.com>> wrote:
>
>     Thanks for your quick response, Tomas.
>
>     Yes, this is a path issue, I think the problem is related to R,
>     not the Rtools make. I built an example package for reproducing
>     the problem: https://github.com/Jiefei-Wang/example
>
>     Here is the version of my R and Rtools:
>     The release R version:
>     R version 3.6.2 (2019-12-12)
>     Platform: x86_64-w64-mingw32/x64 (64-bit)
>     Running under: Windows 10 x64 (build 18362)
>
>     The devel R version:
>     R Under development (unstable) (2020-03-09 r77919)
>     Platform: x86_64-w64-mingw32/x64 (64-bit)
>     Running under: Windows 10 x64 (build 18362)
>
>     Rtools version 3.5.0.4
>
>     Things become interesting?after I did more tests. I originally
>     thought this might be only related to the devel R, but it seems
>     like the released version is also affected. Here is a summary of
>     my test results using the example package:
>
>     1. command-line Rtools make: Success
>     2. command-line R CMD INSTALL: Failed on both R3.6.2 and R4.0
>     3. Rstudio install button: Success on R3.6.2 but failed on R4.0
>     4. Rstudio running devtool::install: Success on both
>
>     Now the problem becomes more intricate. I have no idea which one
>     goes wrong. Here are the details of my test results, I hope it can
>     be helpful:
>
>     *Command line:*
>     1. "C:\Rtools\mingw_64\bin\mingw32-make.exe" -f
>     example-master/src/Makevars
>     test1 is [1] 0.2039269 0.1454402 0.1578401
>     test2 is [1] 0.1919521 0.9257183 0.2130247
>     test3 is [1] 0.06255174 0.27555363 0.72737111
>     mingw32-make: *** No targets.? Stop.
>
>     2. "C:\Program Files\R\R-3.6.2\bin\R" CMD INSTALL
>     testPackage_1.0.tar.gz
>     *** arch - x64
>     test1 is [1] 0.1584299 0.9338829 0.9528810
>     The filename, directory name, or volume label syntax is incorrect.
>     test2 is
>     The filename, directory name, or volume label syntax is incorrect.
>     test3 is
>
>     ? 3. "C:\Program Files\R\R-devel\bin\R" CMD INSTALL
>     testPackage_1.0.tar.gz
>     *** arch - x64
>     test1 is [1] 0.2668522 0.9246174 0.0184601
>     The filename, directory name, or volume label syntax is incorrect.
>     test2 is
>     The filename, directory name, or volume label syntax is incorrect.
>     test3 is
>
>     *R studio:*
>     1. R3.6: Clicking the install button
>     ==> Rcmd.exe INSTALL --no-multiarch --with-keep.source example-master
>     * installing to library 'C:/Users/wangj/Documents/R/win-library/3.6'
>     * installing *source* package 'testPackage' ...
>     ** using staged installation
>     ** libs
>     test1 is [1] 0.1583112 0.6631700 0.2265564
>     test2 is [1] 0.6999799 0.5205237 0.8264029
>     test3 is [1] 0.3591798 0.1767392 0.2869383
>
>     2.? R4.0: Clicking the install button
>     Rcmd.exe INSTALL --no-multiarch --with-keep.source example-master
>     * installing to library 'C:/Program Files/R/R-devel/library'
>     * installing *source* package 'testPackage' ...
>     ** using staged installation
>     ** libs
>     test1 is [1] 0.2091070 0.5411138 0.1051517
>     The filename, directory name, or volume label syntax is incorrect.
>     test2 is
>     The filename, directory name, or volume label syntax is incorrect.
>     test3 is
>
>     3. R3.6:? devtools::load_all(".")
>     devtools::load_all(".")
>     Loading testPackage
>     Re-compiling testPackage
>     - ?installing *source* package 'testPackage' ... (364ms)
>     ? ?** using staged installation
>     ? ?** libs
>     ? ?test1 is [1] 0.93251741 0.03975758 0.57824150
>     ? ?test2 is [1] 0.8681301 0.4801464 0.9112827
>     ? ?test3 is [1] 0.430470791 0.008393394 0.341484128
>     ? ?test1 is [1] 0.68865768 0.05354531 0.91665539
>     ? ?test2 is [1] 0.19473846 0.60293655 0.09421961
>     ? ?test3 is [1] 0.90653581 0.12456034 0.09526018
>
>     4. R4.0: devtools::load_all(".")
>     Loading testPackage
>     Re-compiling testPackage
>     ? ?installing *source* package 'testPackage' ... (357ms)
>     ? ?** using staged installation
>     ? ?** libs
>     ? ?test1 is [1] 0.00545376 0.30696231 0.68752312
>     ? ?test2 is [1] 0.1059506 0.7506894 0.8607918
>     ? ?test3 is [1] 0.5321226 0.6985332 0.7343680
>     ? ?test1 is [1] 0.7722255 0.3881171 0.5611294
>     ? ?test2 is [1] 0.5443175 0.8418503 0.3479382
>     ? ?test3 is [1] 0.7400557 0.3322797 0.6818899
>
>
>     Cheers,
>     Jiefei
>
>     On Tue, Mar 10, 2020 at 4:11 AM Tomas Kalibera
>     <tomas.kalibera at gmail.com <mailto:tomas.kalibera at gmail.com>> wrote:
>
>         Hi Jiefei,
>
>         thanks for your report, but I don't understand from you current
>         description what the problem is. Are you saying that "make"
>         shipped with
>         some recent Rtools is not accepting some forms of PATHs? But,
>         which
>         Rtools then, which version of make, how do you run it?
>
>         Why are you referring to "R CMD INSTALL" when none of your
>         examples use
>         it? Is "R CMD INSTALL" necessary for reproducing the problem,
>         cannot you
>         just run "make" directly?
>
>         Or are you reporting a bug inside R itself? (you are referring to
>         specific svn revisions of R). But how could R be involved in
>         this, is it
>         in how it executes make?
>
>         Please provide a minimal but complete reproducible example,
>         please
>         provide somehow test files that can be used.? Perhaps if you
>         try to do a
>         little bit of debugging on your end, it might help you to
>         narrow down
>         the problem to the point that it will be then easier to
>         understand it.
>         For example: if the problem is in "make", it should be
>         possible to
>         trigger it directly from the command line, then you could
>         easily try
>         with different versions of make and report which ones are the
>         problem..
>
>         Thanks
>         Tomas
>
>
>         On 3/10/20 8:22 AM, Wang Jiefei wrote:
>         > Hi all,
>         >
>         > Here is a bug(or feature?) that exists at least from R
>         2020-02-24
>         > r77852 to 2020-03-09 r77919 on Window. Consider this example
>         makefile in a
>         > package
>         > ```
>         >
>         >
>         >
>         >
>         >
>         >
>         > *test1=$(shell echo 'runif(3)'|R --vanilla
>         --slave)test2=$(shell echo
>         > 'runif(3)'|"C:/Program Files/R/R-devel/bin/R" --vanilla
>         > --slave)test3=$(shell echo
>         'runif(3)'|"C:/PROGRA~1/R/R-devel/bin/R"
>         > --vanilla --slave)$(info test1 is $(test1))$(info test2 is
>         $(test2))$(info
>         > test3 is $(test3))*
>         > ```
>         >
>         > I have no problem running the file using GUN make or
>         installing the package
>         > on R 3.6, both give the same result.
>         > ```
>         > *C:\Rtools\mingw_64\bin\mingw32-make.exe? *
>         >
>         >
>         >
>         > *test1 is [1] 0.3427626 0.8027041 0.5611914test2 is [1]
>         0.9904205 0.3922129
>         > 0.5970083test3 is [1] 0.3469528 0.1993838
>         0.8434841mingw32-make: *** No
>         > targets.? Stop.*
>         > *```*
>         >
>         > However, on the devel version of R, it cannot recognize both
>         the full and
>         > short path of R and gives an error
>         > ```
>         >
>         >
>         >
>         >
>         > *test1 is? [1] 0.42686376 0.84126831 0.09538047The filename,
>         directory
>         > name, or volume label syntax is incorrect.test2 isThe
>         filename, directory
>         > name, or volume label syntax is incorrect.test3 is*
>         > ```
>         >
>         > I found this issue because my package needs to call R
>         functions in the
>         > makefile. The code is similar to:
>         > ```
>         > *? myvar = $(shell echo 'runif(3)'|"${R_HOME}/bin/R"
>         --vanilla --slave)*
>         > ```
>         > Since *R_HOME *is set to *C:/PROGRA~1/R/R-devel/*, this will
>         result in the
>         > same error as I mentioned above. I do not know whether this
>         is intentional.
>         > If so, what is the correct way to call R function in a makefile?
>         >
>         > Best,
>         > Jiefei
>         >
>         >? ? ? ?[[alternative HTML version deleted]]
>         >
>         > ______________________________________________
>         > R-devel at r-project.org <mailto:R-devel at r-project.org> mailing
>         list
>         > https://stat.ethz.ch/mailman/listinfo/r-devel
>
>


	[[alternative HTML version deleted]]



[Rd] R CMD INSTALL cannot recognize full path on Windows
Tomas Kalibera