LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2012, 12:05 AM   #1
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
[R] Compiling R program on Windows - is not recognized as an internal or external command


Quote:
Originally Posted by NevemTeve View Post
Code:
PATH C:\Progra~1\GnuWin32\bin;%PATH%
It wasn't a joke, that's how you can avoid file-names having spaces in them. (Use DIR /X to find out the short names. (When in linux, it is all-capitals: /mnt/C/PROGRA~1/))
Thanks for the tip, but see the screenshots attached:

From: http://cran.r-project.org/bin/window...r-Windows_003f
Quote:
If you want to be able to build packages from sources, we recommend that you choose an installation path not containing spaces.
I haven't modified this Makefile except the home path. This Makefile was already present in the Windows examples of R.

Makefile:
Code:
## -*- mode: make; tab-width: 8; -*-
##
## Simple Makefile
##
## TODO: 
##  proper configure for non-Debian file locations,   [ Done ]
##  allow RHOME to be set for non-default R etc

## comment this out if you need a different version of R, 
## and set set R_HOME accordingly as an environment variable
R_HOME = 		"C:\PROGRA~1\R\R-2.15.1"

sources = 		$(wildcard *.cpp)
programs = 		$(sources:.cpp=)


## include headers and libraries for R 
RCPPFLAGS = 		$(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS = 		$(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS = 		$(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK = 		$(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)

## if you need to set an rpath to R itself, also uncomment
#RRPATH =		-Wl,-rpath,$(R_HOME)/lib

## include headers and libraries for Rcpp interface classes
RCPPINCL = 		$(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RCPPLIBS = 		$(shell echo 'Rcpp:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)


## include headers and libraries for RInside embedding classes
RINSIDEINCL = 		$(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RINSIDELIBS = 		$(shell echo 'RInside:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## compiler etc settings used in default make rules
CXX = 			$(shell $(R_HOME)/bin/R CMD config CXX)
CPPFLAGS = 		-Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
CXXFLAGS = 		$(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R CMD config CXXFLAGS)
LDLIBS = 		$(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)

all: 			$(programs)
			@test -x /usr/bin/strip && strip $^

run:			$(programs)
			@for p in $(programs); do echo; echo "Running $$p:"; ./$$p; done

clean:
			rm -vf $(programs)
			rm -vrf *.dSYM

runAll:
			for p in $(programs); do echo "Running $$p"; ./$$p; done
Path in environment variable:
Code:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\R\batchfiles_0.6-6;C:\R\Rtools\bin;C:\R\Rtools\MinGW\bin;"C:\PROGRA~1\R\R-2.15.1\";"C:\PROGRA~1\GnuWin32\bin";
Please point out the point that I am missing.
(WindowsXP)

Last edited by Aquarius_Girl; 02-16-2015 at 11:57 PM.
 
Old 10-29-2012, 12:57 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Some Unix-based programs use '/' as directory-separator:

Code:
R_HOME = 		"C:/PROGRA~1/R/R-2.15.1"
 
Old 10-29-2012, 01:41 AM   #3
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
I had tried that before - didn't help.


Makefile:
Code:
    ## -*- mode: make; tab-width: 8; -*-
    ##
    ## Simple Makefile
    ##
    ## TODO: 
    ##  proper configure for non-Debian file locations,   [ Done ]
    ##  allow RHOME to be set for non-default R etc
    
    ## comment this out if you need a different version of R, 
    ## and set set R_HOME accordingly as an environment variable
    R_HOME = 		"C:/PROGRA~1/R/R-2.15.1"
    
    sources = 		$(wildcard *.cpp)
    programs = 		$(sources:.cpp=)
    
    
    ## include headers and libraries for R 
    RCPPFLAGS = 		$(shell $(R_HOME)/bin/R CMD config --cppflags)
    RLDFLAGS = 		$(shell $(R_HOME)/bin/R CMD config --ldflags)
    RBLAS = 		$(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
    RLAPACK = 		$(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)
    
    ## if you need to set an rpath to R itself, also uncomment
    #RRPATH =		-Wl,-rpath,$(R_HOME)/lib
    
    ## include headers and libraries for Rcpp interface classes
    RCPPINCL = 		$(shell echo 'Rcpp:::CxxFlags()' | 
    
    $(R_HOME)/bin/R --vanilla --slave)
    RCPPLIBS = 		$(shell echo 'Rcpp:::LdFlags()'  | 
    
    $(R_HOME)/bin/R --vanilla --slave)
    
    
    ## include headers and libraries for RInside embedding classes
    RINSIDEINCL = 		$(shell echo 'RInside:::CxxFlags()' | 
    
    $(R_HOME)/bin/R --vanilla --slave)
    RINSIDELIBS = 		$(shell echo 'RInside:::LdFlags()'  | 
    
    $(R_HOME)/bin/R --vanilla --slave)
    
    ## compiler etc settings used in default make rules
    CXX = 			$(shell $(R_HOME)/bin/R CMD config CXX)
    CPPFLAGS = 		-Wall $(shell $(R_HOME)/bin/R CMD config 
    
    CPPFLAGS)
    CXXFLAGS = 		$(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell 
    
    $(R_HOME)/bin/R CMD config CXXFLAGS)
    LDLIBS = 		$(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) 
    
    $(RCPPLIBS) $(RINSIDELIBS)
    
    all: 			$(programs)
    			@test -x /usr/bin/strip && strip $^
    
    run:			$(programs)
    			@for p in $(programs); do echo; echo "Running 
    
    $$p:"; ./$$p; done
    
    clean:
    			rm -vf $(programs)
    			rm -vrf *.dSYM
    
    runAll:
    			for p in $(programs); do echo "Running $$p"; 
    
    ./$$p; done
From here: http://stackoverflow.com/a/5650694/462608
The last comment:
Quote:
Setting .Library.site <- file.path("C:/R/R-2.12.2/library") in my RProfile.site file was the medicine!
I changed my RProfile as follows (don't have the `site-library` thing):
Code:
    # Things you might want to change
    
    # options(papersize="a4")
    # options(editor="notepad")
    # options(pager="internal")
    
    # set the default help type
    # options(help_type="text")
      options(help_type="html")
    
    # set a site library
    # .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")
    
    .Library.site <- file.path("C:/R/R-2.15.1/library")
    
    # set a CRAN mirror
    # local({r <- getOption("repos")
    #       r["CRAN"] <- "http://my.local.cran"
    #       options(repos=r)})
    
    # Give a fortune cookie, but only to interactive sessions
    # (This would need the fortunes package to be installed.)
    #  if (interactive()) 
    #    fortunes::fortune()

The environment variable contains:
Code:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\R\batchfiles_0.6-6;C:\R\Rtools\bin;C:\R\Rtools\MinGW\bin;"C:\PROGRA~1\R\R-2.15.1";"C:\PROGRA~1\GnuWin32\bin";

Last edited by Aquarius_Girl; 02-16-2015 at 11:57 PM.
 
Old 10-30-2012, 12:14 AM   #4
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Solved:

Now, I reinstalled R in a different directory which didn't have any spaces in its name but that didn't help either.
So, this time I replaced the manual R_HOME setting with the following statement, and the above error vanished.

Code:
R_HOME = $(shell R RHOME)
 
Old 10-30-2012, 01:36 AM   #5
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
The above post though solved the said error, but it also introduced new errors like:
Code:
R: command not found
Did anyone notice that I hadn't placed : before the equalto = ??

old - R_HOME = "C:\R-2.15.1"
new - R_HOME := "C:\R-2.15.1"

The original Makefile on Windows provided for demo by R contained those colons which I had removed!
Now I put those semicolons back, and the command not found errors are gone!

Also, later on I replaced the R_HOME as '/cygdrive/c/R-2.15.1'
(which worked).

Last edited by Aquarius_Girl; 10-30-2012 at 06:36 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] 'make' is not recognized as an internal or external command - WindowsXP (Virtualbox) Aquarius_Girl Programming 11 10-17-2012 01:08 PM
LXer: Linux command Types (Internal and External) LXer Syndicated Linux News 0 08-03-2011 02:50 AM
Distingush between internal and external command dina3e Linux - Newbie 3 03-31-2008 08:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration