I am using RInside to integrate R into a Qt application. Currently, I am trying to run the Qt example present in the RInside package. I am able to build the example but the execution gets stuck while creating an embedded R instance.
#include <QApplication>
#include "qtdensity.h"
int main(int argc, char *argv[])
{
qDebug() << "First";
RInside R(argc, argv); // Execution halts at this point
qDebug() << "Second";
QApplication app(argc, argv);
QtDensity qtdensity(R); // pass R inst. by reference
return app.exec();
}
The execution is getting stuck while creating the embedded R instance and is giving no errors.
Working Environment Used
RInside Package : Release 0.2.14
Linux version : Red Hat Enterprise Linux Client release 5.8 (Tikanga)
R : 3.1.1
Rcpp lib : 0.11.4
RInside lib : 0.2.14
Qt : 4.7.4
Any help or suggestions would be much appreciated. Thanks.
Now, I am trying a simpler example inside the rinside_sample0.cpp.
#include <RInside.h> // for the embedded R via RInside
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
cout << "Starting \n";
RInside R(argc, argv); // create an embedded R instance
cout << "R instance created\n";
R["txt"] = "Hello, world!\n"; // assign a char* (string) to 'txt'
R.parseEvalQ("cat(txt)"); // eval the init string, ignoring any returns
exit(0);
}
This code is also getting stuck while running. It is getting stuck at RInside R(argc, argv);
Now, when I set R_HOME to my R directory the execution gives me this error:
cannot find system Renviron
Fatal error: unable to open the base package
Compilation Log :
g++ -I/pkg/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/include -I/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include -I/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/RInside/include -g -O2 -Wall -I/usr/local/include rinside_sample0.cpp -Wl,--export-dynamic -fopenmp -L/pkg/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/lib -lR -lrt -ldl -lm -licuuc -licui18n -Wl,-rpath,"/pkg/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5"/lib -L/pkg/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/lib -lRblas -L/pkg/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/lib -lRlapack -L/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/RInside/lib -lRInside -Wl,-rpath,/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/RInside/lib -o rinside_sample0
In file included from /pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/RcppCommon.h:34,
from /pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp.h:27,
from /pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/RInside/include/RInsideCommon.h:38,
from /pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/RInside/include/RInside.h:26,
from rinside_sample0.cpp:10:
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:35: warning: ignoring #pragma push_macro
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:40: warning: ignoring #pragma push_macro
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:45: warning: ignoring #pragma push_macro
In file included from /pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/RcppCommon.h:34,
from /pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp.h:27,
from /pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/RInside/include/RInsideCommon.h:38,
from /pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/RInside/include/RInside.h:26,
from rinside_sample0.cpp:10:
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:60: warning: ignoring #pragma pop_macro
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:64: warning: ignoring #pragma pop_macro
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/r/headers.h:68: warning: ignoring #pragma pop_macro
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/Date.h: In member function ‘void Rcpp::Date::update_tm()’:
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/Date.h:108: warning: converting to ‘time_t’ from ‘double’
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/Date.h: In function ‘Rcpp::Date Rcpp::operator+(const Rcpp::Date&, int)’:
/pkg/.site/pkgs05/OSS-R-/3.1.1/x86_64-linux2.6-glibc2.5/lib64/R/library/Rcpp/include/Rcpp/Date.h:139: warning: converting to ‘time_t’ from ‘double’
Thank you Dirk for your suggestion. The R installation
that I was using was built on RHEL6
and I was working on RHEL5
. So, I did a fresh installation of the R package. I installed R 3.1.3
with the compatible RInside
and Rcpp
libraries on my RHEL5
machine. After the installation fix the examples started running.
Working Environment Used
RInside Package : Release 0.2.14
Linux version : Red Hat Enterprise Linux Client release 5.8 (Tikanga)
R : 3.1.3
Rcpp lib : 0.12.12
RInside lib : 0.2.14
Qt : 4.7.4