I am trying to set up Rcpp on my Windows machine (have not had issues on my unix box).
I have installed R in C:/opt/R/current (a Google search suggested that spaces in installation paths could give trouble), and I have installed Rtools.
I have the simple cpp file:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
int timesTwo(int x) {
return x * 2;
}
and an R file:
library(Rcpp)
sourceCpp("cppfile.cpp")
I get the following error:
C:/opt/R/current/etc/x64/Makeconf:196: warning: overriding recipe for target `.m.o' C:/opt/R/current/etc/x64/Makeconf:189: warning: ignoring old recipe for target `.m.o' C:\MINGW3~1\bin\make.exe: Interrupt/Exception caught (code = 0xc0000005, addr = 0x0x750343f9) Warning message: running command 'make -f "C:/opt/R/current/etc/x64/Makeconf" -f "C:/opt/R/current/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_67515.dll" WIN=64 TCLBIN=64 OBJECTS="cppfile.o"' had status 255
Error in sourceCpp("cppfile.cpp") :
Error 1 occurred building shared library.
Any help would be appreciated.
PS: Install e.g. dplyr from github via devtools works fine (and does quite a lot of compiling Rcpp stuff).
UPDATE: I added the Rtools bin dir to PATH, and now I get another error which seems to relate to 32/64bit:
g++ -m64 -I"C:/opt/R/current/include" -DNDEBUG -I"C:/opt/R/current/library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c cppfile.cpp -o cppfile.o cppfile.cpp:1:0: sorry, unimplemented: 64-bit mode not compiled in make: *** [cppfile.o] Error 1 Warning message: running command 'make -f "C:/opt/R/current/etc/x64/Makeconf" -f "C:/opt/R/current/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_41862.dll" WIN=64 TCLBIN=64 OBJECTS="cppfile.o"' had status 2
Error in sourceCpp("cppfile.cpp") :
Error 1 occurred building shared library.
Turned out that I needed to add both the RTools/bin and the Rtools/gcc-x.y.z/bin to PATH. Now things work smoothly.
Related
I just used Rcpp
Rcpp::sourceCpp('D:\\6_R_tool\\04_track_cluster\\line_cluster_c.cpp')
and error occcurs: It works Ok some days ago, but failed today suddenly.
My R version is 4.0.2.
C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:244: warning: overriding commands for target `.m.o'
C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:237: warning: ignoring old commands for target `.m.o'
"C:/rtools40/mingw64/bin/"g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -I"C:/Users/justin/Documents/R/win-library/4.0/Rcpp/include" -I"D:/6_R_tool/04_track_cluster" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c line_cluster_c.cpp -o line_cluster_c.o
process_begin: CreateProcess(NULL, basename sourceCpp_2.dll .dll, ...) failed.
process_begin: CreateProcess(NULL, basename sourceCpp_2.dll .dll, ...) failed.
process_begin: CreateProcess(NULL, basename sourceCpp_2.dll .dll, ...) failed.
"zline_cluster_c.o" was unexpected at this time.
make: *** [sourceCpp_2.dll] Error 255
Error in Rcpp::sourceCpp("D:\\6_R_tool\\04_track_cluster\\line_cluster_c.cpp") :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please download and install the appropriate version of Rtools:
http://cran.r-project.org/bin/windows/Rtools/
What can be the problem and what should I do?
It is resolved by typing the command in RGui.
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
And I noted that the path has been reset. See it by Sys.which("make") .
The new path is "C:\\rtools40\\usr\\bin\\make.exe", whose value is definitely different before I fixed the problem.
But who can I tell me why? Thank you.
Watch this video https://www.youtube.com/watch?v=hBTObNFFkhs and ensure that you get a result. If there is a warning, something is not correct.
Also, in my case, using Rtools42. Here is my new path:
PATH="C:\rtools42\usr\bin;${PATH};C:\Program Files\R\R-4.2.2\library\stats\libs\x64"
Here is my command running on the R STUDIO console
writeLines('PATH="C:\rtools42\usr\bin;${PATH};C:\Program Files\R\R-4.2.2\library\stats\libs\x64"', con = "~/.Renviron")
I am working in building Japanese NLP sentiment analysis, to tokenise the Japanese sentence we have a package called "SudachiPy".I tried to install it but I am getting error while installing the package. I'm using anaconda in MAC Book pro.
I tried all the steps mentioned in stack overflow by installing following libraries to debug the error.
pip3 install python3-dev
Also I tried launching an "Ubuntu" instance from AWS and try to install "SudachiPy" but still encountering the same error.
pip3 install SudachiPy
Building wheels for collected packages: dartsclone
Building wheel for dartsclone (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/setup.py'"'"'; __file__='"'"'/private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-wheel-x8k1ryul --python-tag cp36
cwd: /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/
Complete output (25 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.6
creating build/lib.macosx-10.7-x86_64-3.6/dartsclone
copying dartsclone/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/dartsclone
running build_ext
cythoning dartsclone/_dartsclone.pyx to dartsclone/_dartsclone.cpp
/anaconda3/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/lf/4754h1x94x39xfw_q6c8_ryc0000gn/T/pip-install-st3sqcmm/dartsclone/dartsclone/_dartsclone.pxd
tree = Parsing.p_module(s, pxd, full_module_name)
warning: dartsclone/_dartsclone.pyx:119:49: local variable 'result' referenced before assignment
warning: dartsclone/_dartsclone.pyx:120:15: local variable 'result' referenced before assignment
building 'dartsclone._dartsclone' extension
creating build/temp.macosx-10.7-x86_64-3.6
creating build/temp.macosx-10.7-x86_64-3.6/dartsclone
creating build/temp.macosx-10.7-x86_64-3.6/csrc
creating build/temp.macosx-10.7-x86_64-3.6/csrc/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I./csrc/include -I/anaconda3/include/python3.6m -c dartsclone/_dartsclone.cpp -o build/temp.macosx-10.7-x86_64-3.6/dartsclone/_dartsclone.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
dartsclone/_dartsclone.cpp:610:10: fatal error: 'ios' file not found
#include "ios"
^~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for dartsclone
You need to install some deps before, similar to Linux build-essential:
xcode-select install
Also, you may need to specify the right compiler, by setting this env. variable:
CFLAGS='-stdlib=libc++'
I am trying to compile the wkhtmltopdf with patched qt using these instructions and when i get to the make && make install it gives me an error has anyone else done this on Ubuntu 14.04? I can't figure out what to do from here.
these are the instructions i am following i know they are not for 14.04 but i hoped they would have worked https://gist.github.com/Zauberfisch/8773593
This is the error i get:
cd src/lib/ && make -f Makefile make[1]: Entering directory /temp/wkhtmltopdf/src/lib' rm -f libwkhtmltox.so.0.12.1 libwkhtmltox.so libwkhtmltox.so.0 libwkhtmltox.so.0.12 g++ -Wl,-O1 -Wl,-rpath,/temp/wkqt/lib -shared -Wl,-soname,libwkhtmltox.so.0 -o libwkhtmltox.so.0.12.1 ../../build/loadsettings.o ../../build/multipageloader.o ../../build/tempfile.o ../../build/converter.o ../../build/websettings.o ../../build/reflect.o ../../build/utilities.o ../../build/pdfsettings.o ../../build/pdfconverter.o ../../build/outline.o ../../build/tocstylesheet.o ../../build/imagesettings.o ../../build/imageconverter.o ../../build/pdf_c_bindings.o ../../build/image_c_bindings.o ../../build/moc_multipageloader_p.o ../../build/moc_converter_p.o ../../build/moc_pdfconverter_p.o ../../build/moc_imageconverter_p.o ../../build/moc_pdf_c_bindings_p.o ../../build/moc_image_c_bindings_p.o ../../build/moc_converter.o ../../build/moc_multipageloader.o ../../build/moc_utilities.o ../../build/moc_pdfconverter.o ../../build/moc_imageconverter.o ../../build/qrc_wkhtmltopdf.o -L/temp/wkqt/lib -lQtWebKit -lQtSvg -L/temp/wkqt/lib -L/usr/X11R6/lib -lQtXmlPatterns -lQtGui -lQtNetwork -lQtCore -lpthread /usr/bin/ld: ../../build/qrc_wkhtmltopdf.o: relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC ../../build/qrc_wkhtmltopdf.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status make[1]: * [../../bin/libwkhtmltox.so.0.12.1] Error 1 make[1]: Leaving directory `/temp/wkhtmltopdf/src/lib' make: * [sub-src-lib-make_default-ordered] Error 2
I downloaded a binary from their site that already had the QT build and that fixed the issue for me. Thanks!
I cannot get Rcpp to work on Windows 8.1. When I run the following minimal example, I get an error.
> library(Rcpp)
> evalCpp("1 + 1")
g++ -m64 -I"C:/R/R-31~1.0/include" -DNDEBUG -I"C:/R/R-3.1.0/library/Rcpp/include" -
I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c file11dc2120723d.cpp -o
file11dc2120723d.o g++: not found make: *** [file11dc2120723d.o] Error 127 Warning message: running
command 'make -f "C:/R/R-31~1.0/etc/x64/Makeconf" -f "C:/R/R-31~1.0/share/make/winshlib.mk"
SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_97232.dll" WIN=64 TCLBIN=64
OBJECTS="file11dc2120723d.o"' had status 2
Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput, :
Error 1 occurred building shared library.
The two first entries in my path are:
PATH=c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;
R is installed in a directory C:\R\R-3.1.0
Rtools is in the directory C:\R\Rtools
Some additional information:
> library(devtools)
> find_rtools(T)
Scanning path...
ls : c:\Rtools\bin\ls.exe
Scanning registry...
Found c:/Rtools for 3.1
VERSION.txt
Rtools version 3.1.0.1942
[1] TRUE
> has_devel()
"C:/R/R-31~1.0/bin/x64/R" --vanilla CMD SHLIB foo.c
gcc -m64 -I"C:/R/R-31~1.0/include" -DNDEBUG -I"d:/RCompile/CRANpkg/extralibs64/local/include"
O2 -Wall -std=gnu99 -mtune=core2 -c foo.c -o foo.o
gcc: not found
make: *** [foo.o] Error 127
Warning message:
running command 'make -f "C:/R/R-31~1.0/etc/x64/Makeconf" -f "C:/R/R-31~1.0/share/make/winshlib.mk"
SHLIB="foo.dll" WIN=64 TCLBIN=64 OBJECTS="foo.o"' had status 2
Error: Command failed (1)
> system('g++ -v')
Warning message:
running command 'g++ -v' had status 127
Unsure if you have solved your problem but it appears you don't have gcc or g++ installed. For windows you can get these tools with MinGW.
Install MinGW which you can donwload from here. The homepage for information is here
Once you have it installed MinGW, you can open the 'MinGW Installation Manager' and install the bin and dev for 'mingw32-gcc-g++'.
You must then update your PATH environmental variable to include 'C:\MinGW\bin' and 'C:\MinGW\msys\1.0\bin'.
Restart your R session, couldn't hurt to also reinstall 'Rcpp', and tryrequire(Rcpp); evalCpp("1 + 1") again.
I had this problem while trying to call C-code directly. Switching from the function system() to system2() solved it immediately.
I got that fix by installing RTools and adding RBuildTools to the path:
Sys.setenv("PATH" = paste(Sys.getenv("PATH"),
"C:\\RBuildTools\\3.4\\bin",
"C:\\RBuildTools\\3.4\\mingw_32",
"C:\\RBuildTools\\3.4\\mingw_64", sep = ";"))
I don't understand these things clearly but #cdeterman solutions was not working for building my package while its example evalCpp("1 + 1") did.
I've successfully build my own package with Rcpp in R-Studio. However, when building the package in the Windows console, there are some error messages complaining file missing of R.h.
I set the path and R_Home environments with
SET PATH=D:\RTools\gcc-4.6.3\bin;D:\R3\bin;D:\RTools\bin;
SET R_HOME=D:\R3\
And the build command is
R CMD INSTALL --byte-compile --build mypkg
Below are the compiling error messages:
g++ -m32 -I"/include" -DNDEBUG -I"D:/R3/library/Rcpp/include" -I"d:
/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c Rcpp
Exports.cpp -o RcppExports.o
In file included from D:/R3/library/Rcpp/include/Rcpp.h:27:0,
from RcppExports.cpp:4:
D:/R3/library/Rcpp/include/RcppCommon.h:35:15: fatal error: R.h: No su
ch file or directory
compilation terminated.
You are missing an include for R.h, as the error says.
And if you look at your compile line, the statement
-I"/include"
is wrong relative to your stated R_HOME in D:/R3
You need to check your setup, somehow you confused R from using the correct include directory.
Rcpp builds just fine on Windows, you can even check by submitting your package to the win-builder service.