Thanks a lot for your suggestions. I see what you mean. I have removed all unnecessary files and dependences on https://github.com/Jiefei-Wang/example, but still no luck. I've tried to install the package as a user, not admin, but I got the same error. Also, I apologize for spamming the mail list. I will keep my reply as neat as possible.
Martin has suggested checking the encoding of the file and locale in the session info, so here is this missing information: The makefile is encoded in UTF-8, and the locale is: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 That is where I am stuck, any help would be appreciated. Best, Jiefei On Wed, Mar 11, 2020 at 9:56 AM Tomas Kalibera <tomas.kalib...@gmail.com> wrote: > On 3/11/20 2:26 PM, Wang Jiefei wrote: > > Thanks, Tomas. I took your suggestion and change the make file to > > test1:=$(shell $(R_HOME)/bin/R --slave -e 'runif(3)') > > all: testPackage.dll > echo "test1 is $(test1)" > echo "R_HOME is $(R_HOME)" > > However, R CMD INSTALL still gives me the same error: > > > R CMD INSTALL testPackage_1.0.tar.gz* installing to library 'C:/Program > Files/R/R-devel/library' > * installing *source* package 'testPackage' ... > ** using staged installation > ** libs > > *** arch - i386 > The filename, directory name, or volume label syntax is incorrect. > c:/Rtools/mingw_32/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-devel/include" > -DNDEBUG -I'C:/Program Files/R/R-devel/library/Rcpp/include' > -I"C:/projects/BUILD/R-source-win32/extsoft/include" -O2 -Wall > -mfpmath=sse -msse2 -c RcppExports.cpp -o RcppExports.o > c:/Rtools/mingw_32/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-devel/include" > -DNDEBUG -I'C:/Program Files/R/R-devel/library/Rcpp/include' > -I"C:/projects/BUILD/R-source-win32/extsoft/include" -O2 -Wall > -mfpmath=sse -msse2 -c example.cpp -o example.o > c:/Rtools/mingw_32/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o > testPackage.dll tmp.def RcppExports.o example.o > -LC:/projects/BUILD/R-source-win32/extsoft/lib/i386 > -LC:/projects/BUILD/R-source-win32/extsoft/lib > -LC:/PROGRA~1/R/R-devel/bin/i386 -lR > echo "test1 is " > test1 is > echo "R_HOME is C:/PROGRA~1/R/R-devel" > installing to C:/Program > Files/R/R-devel/library/00LOCK-testPackage/00new/testPackage/libs/i386 > > > I have no idea how to make the example even more minimal for there is > literally nothing in the package now. Like you said if R just sets R_HOME > and runs "make", I do not understand why it cannot find R in this case for > R_HOME seems correct to me. I think there are some other things behind R > CMD INSTALL but my poor knowledge does not allow me to see them...Any help > will be appreciated. > > Please lets not spam the whole list with this any more - this is also why > I didn't add R-devel to cc originally. The makefile may be minimal, but the > example package is not - you have Rcpp dependency there, two C source > files, some R Studio specific thing (an .Rproj file at least). Maybe it is > not related, but if you want other to help you, it would be nice to spend > some of your time reducing it anyway. > > That test1 is empty means that executing R has failed. You need to find > out why. > > I see that you are installing into C:/Program Files/R/R-devel/library. > Normally that directory should not be writeable. Are you running this as > Administrator? In principle this could be related, but better to find out > directly why executing R is failing. > > Best > Tomas > > > > > Best, > Jiefei > > > On Wed, Mar 11, 2020 at 8:57 AM Tomas Kalibera <tomas.kalib...@gmail.com> > wrote: > >> >> 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 <szwj...@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.kalib...@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@r-project.org mailing list >>>> > https://stat.ethz.ch/mailman/listinfo/r-devel >>>> >>>> >>>> >> > [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel