Request for guidance on compiling C++ using RInside within Xcode 5, OSX 10.9.4,
R 3.1.1 (mavericks version).
Hi R-SIG-mac experts,
I know this question is close to some asked previously, and also to comment
2.10 of the FAQ document on RInside provided by Dirk Eddelbuettel and Romain
Francois, but I still cannot solve it, nor find examples of others doing so
that are clear (or at least, clear to me, apologies if appropriate).
I would like to compile C++ code that uses RInside, but within Xcode 5, and
using OSX 10.9.4, R 3.1.1 (mavericks version). The reason I wish to do this is
that I am writing time series analysis/generative externals for MAXMSP, a
widely used MIDI and audio processing platform, and it is built on C and
focused on Xcode as the developer tool (it is difficult to find people
compiling MAX externals using clang++ and not Xcode, though I continue to
search also towards this possible alternative route.)
So the helpful examples in the RInside source include rinside_sample0.cpp, and
this compiles/builds fine for me with the Make process, or with clang++
directly. And it runs, as do all but one of the other examples. It is very
simple as intended, and I'm sure many of you will have looked at it:
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*-
//
// Simple example showing how to do the standard 'hello, world' using embedded R
//
// Copyright (C) 2009 Dirk Eddelbuettel
// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
//
// GPL'ed
#include <RInside.h> // for the embedded R via RInside
int main(int argc, char *argv[]) {
RInside R(argc, argv); // create an embedded R instance
R["txt"] = "Hello, world!\n"; // assign a char* (string) to 'txt'
R.parseEvalQ("cat(txt)"); // eval the init string, ignoring any
returns
exit(0);
}
I have taken note of the comments about the .R/Makevars, including the
statements about -stdlib=libstdc++ -mmacosx-version-min=10.6 from Sturla Molden
(Feb 8 2014) and others. I am providing to Xcode libR.dylib, and paths to
headers and other libraries. I saw a reference to an Rcpp library, but in my
RCpp source and R 3.1.1 there is only Rcpp.so, not .dylib. I have added this to
the Xcode project, though I am not clear that it will be used.
After innumerable permutations in my attempts, I can only get as far as
reproducible problems with the string.h code from the Rcpp source (see listing
below taken directly from the Xcode 'issues' listing). I realise there is a
historic issue about the LLVM default compiler (now labelled Apple LLVM 5.0),
but I hoped that was what Makevars could solve.
Can anyone advise whether it is currently feasible to do what I want, and
ideally give more specific cues, please?
many thanks in advance
Roger Dean
[email protected]<mailto:[email protected]>
Reported Issues:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:52:17:
Use of undeclared identifier 'internal'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:52:39:
Expected member name or ';' after declaration specifiers
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:53:17:
Use of undeclared identifier 'internal'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:53:45:
Expected member name or ';' after declaration specifiers
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:66:16:
Unknown type name 'SEXP'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:71:23:
Unknown type name 'StringProxy'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:75:23:
Unknown type name 'const_StringProxy'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:102:17:
Unknown type name 'Rcomplex'; did you mean '_Complex'?
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:103:17:
Unknown type name 'Rbyte'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:108:35:
Unknown type name 'Rbyte'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:110:35:
Unknown type name 'Rcomplex'; did you mean '_Complex'?
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:111:35:
Unknown type name 'SEXP'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:112:41:
Unknown type name 'StringProxy'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:170:42:
Unknown type name 'StringProxy'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:178:36:
Unknown type name 'SEXP'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:313:16:
Unknown type name 'SEXP'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:318:16:
Unknown type name 'SEXP'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:355:9:
Unknown type name 'SEXP'
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include/Rcpp/String.h:358:21:
Implicit instantiation of undefined template 'std::basic_string<char,
std::char_traits<char>, std::allocator<char> >'
Too many errors emitted, stopping now
Roger Dean, Founder and Artistic Director, austraLYSIS. Mobile: +61 (0)481 309
612.
Mail: austraLYSIS, PO Box 225, Milperra, NSW 2214, Australia.
Email<mailto:[email protected]> ... Web<http://www.australysis.com/>
Recent CD release: MultiPiano (1978-2012), solo and computer interactive piano,
Tall Poppies TP 225 (double CD). John Shand's review: 'a trail-blazer',
'exquisite', 'surprising and disquieting', 'willing grooves' ...
Prof Roger Dean,PhD, DSc, DLitt, FAHA, Research Professor of Sonic
Communication, Music, Cognition and Action Group, MARCS Institute.
Mail: MARCS Institute, University of Western Sydney, Locked Bag 1797, PENRITH,
NSW 2751, Australia.
Emai<mailto:[email protected]>l
Phone: +61 2 9772 6902 ... Fax: +61 2
9772 6040
We are in Milperra ('Bankstown Campus'), just by the M5 motorway. Check the
campus maps to visit.
Web<http://marcs.uws.edu.au> ... Articles
list<http://tinyurl.com/RTDeanCitations> ...
Wikipedia<http://en.wikipedia.org/wiki/Roger_Dean_(musician)>
I am founding
co-editor of the sound intermedia journal
soundsRite<http://soundsite.uws.edu.au> and currently co-editing the
forthcoming Oxford Handbook of Algorithmic Music.
I try to minimise 'Email Distraction', in order to get on with research and
creative work. So I reply to all appropriate emails, but in batches. If yours
needs a response, please expect to get one normally within 2-4 working days.
[[alternative HTML version deleted]]
_______________________________________________
R-SIG-Mac mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac