<pre tabindex="0" class="" style="font-family:Consolas,'Lucida Console',monospace;font-size:14px;outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:15px;color:rgb(0,0,0);background-color:rgb(225,226,229);white-space:pre-wrap!important">
First:: Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)</pre><pre tabindex="0" class="" style="font-family:Consolas,'Lucida Console',monospace;font-size:14px;outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:15px;color:rgb(0,0,0);background-color:rgb(225,226,229);white-space:pre-wrap!important">
<br></pre><pre tabindex="0" class="" style="font-family:Consolas,'Lucida Console',monospace;font-size:14px;outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:15px;color:rgb(0,0,0);background-color:rgb(225,226,229);white-space:pre-wrap!important">
>> setting environment variables:
PKG_LIBS = -lmpfr -lgmp -L/home/thell/R/library/Rcpp/lib -lRcpp -Wl,-rpath,/home/thell/R/library/Rcpp/lib
PKG_CPPFLAGS = -std=c++11
>> LinkingTo : Rcpp
CLINK_CPPFLAGS = -I"/home/thell/R/library/Rcpp/include"
>> Program source :
1 :
2 : // includes from the plugin
3 :
4 : #include <cmath>
5 : #include <iterator>
6 : #include <RcppCommon.h>
7 : #include <mpreal.h>
8 :
9 : namespace Rcpp {
10 : template <> SEXP wrap( const mpfr::mpreal& ) ;
11 : }
12 :
13 : #include <Rcpp.h>
14 :
15 : // Definitions from Rmpfr conversion utilities.
16 : #if GMP_NUMB_BITS == 32
17 :
18 : # define R_mpfr_nr_ints nr_limbs
19 : # define R_mpfr_exp_size 1
20 :
21 : #elif GMP_NUMB_BITS == 64
22 :
23 : # define R_mpfr_nr_ints (2*nr_limbs)
24 : # define R_mpfr_exp_size 2
25 :
26 : #endif
27 :
28 : # define RIGHT_HALF(_LONG_) ((long long)(_LONG_) & 0x00000000FFFFFFFF)
29 : # define LEFT_SHIFT(_LONG_) (((long long)(_LONG_)) << 32)
30 :
31 : namespace Rcpp {
32 :
33 : template<> SEXP wrap( const mpfr::mpreal& v )
34 : {
35 : mpfr_srcptr pv( v.mpfr_srcptr() );
36 :
37 : S4 vS4("mpfr1");
38 : vS4.slot("prec") = wrap( (int)pv->_mpfr_prec );
39 : vS4.slot("sign") = wrap( (int)pv->_mpfr_sign);
40 :
41 : IntegerVector d( std::ceil( (double)pv->_mpfr_prec / (double)mp_bits_per_limb ) );
42 : mp_size_t i = 0;
43 :
44 : if( GMP_NUMB_BITS == 32 ) {
45 :
46 : vS4.slot("exp") = wrap( (int)pv->_mpfr_exp );
47 :
48 : for( auto & e : d ) {
49 : e = (int) pv->_mpfr_d[i];
50 : ++i;
51 : }
52 :
53 : } else {
54 :
55 : IntegerVector exp(2);
56 : exp[0] = (int) RIGHT_HALF(pv->_mpfr_exp);
57 : exp[1] = (int) (pv->_mpfr_exp >> 32);
58 : vS4.slot("exp") = exp;
59 :
60 : for(i=0; i < d.size(); i++) {
61 : d[2*i] = (int) RIGHT_HALF(pv->_mpfr_d[i]);
62 : d[2*i+1]= (int) (pv->_mpfr_d[i] >> 32);
63 : }
64 :
65 : }
66 :
67 : vS4.slot("d") = d;
68 : return vS4;
69 : }
70 :
71 : }
72 :
73 :
74 : #ifndef BEGIN_RCPP
75 : #define BEGIN_RCPP
76 : #endif
77 :
78 : #ifndef END_RCPP
79 : #define END_RCPP
80 : #endif
81 :
82 : using namespace Rcpp;
83 :
84 :
85 : // user includes
86 :
87 :
88 :
89 : // declarations
90 : extern "C" {
91 : SEXP file34e23fb9ce5( SEXP x, SEXP prec) ;
92 : }
93 :
94 : // definition
95 :
96 : SEXP file34e23fb9ce5( SEXP x, SEXP prec ){
97 : BEGIN_RCPP
98 :
99 : using namespace mpfr;
100 : using namespace Rcpp;
101 :
102 : mpreal::set_default_prec( as< unsigned long >( prec ) );
103 : return wrap( fac_ui( as< double >( x ) ) );
104 :
105 : END_RCPP
106 : }
107 :
108 :
Compilation argument:
/usr/lib/R/bin/R CMD SHLIB file34e23fb9ce5.cpp 2> file34e23fb9ce5.cpp.err.txt
"/usr/bin/clang++" -I/usr/share/R/include -DNDEBUG -std=c++11 -I"/home/thell/R/library/Rcpp/include" -fpic -O3 -pipe -g -c file34e23fb9ce5.cpp -o file34e23fb9ce5.o
In file included from file34e23fb9ce5.cpp:13:
In file included from /home/thell/R/library/Rcpp/include/Rcpp.h:68:
In file included from /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar.h:25:
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:28:2: error: invalid preprocessing directive
#elseif defined(HAS_TR1_UNORDERED_SET)
^
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:29:13: warning: 'RCPP_UNIQUE_SET' macro redefined
#define RCPP_UNIQUE_SET std::tr1::unordered_set
^
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:26:13: note: previous definition is here
#define RCPP_UNIQUE_SET std::unordered_set
^
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:30:13: warning: 'RCPP_UNIQUE_MAP' macro redefined
#define RCPP_UNIQUE_MAP std::tr1::unordered_map
^
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:27:13: note: previous definition is here
#define RCPP_UNIQUE_MAP std::unordered_map
^
file34e23fb9ce5.cpp:57:31: warning: shift count >= width of type [-Wshift-count-overflow]
exp[1] = (int) (pv->_mpfr_exp >> 32);
^ ~~
file34e23fb9ce5.cpp:62:33: warning: shift count >= width of type [-Wshift-count-overflow]
d[2*i+1]= (int) (pv->_mpfr_d[i] >> 32);
^ ~~
4 warnings and 1 error generated.
make: *** [file34e23fb9ce5.o] Error 1
ERROR(s) during compilation: source code errors or compiler configuration errors!</pre><div><br></div><div>================================</div><div>Now:: clang version 3.3 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a> 86256af6c8515077278d0a78f183fb6d322518ac) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a> 8f54a53f0ed2091e05d5ca87d239487da292cbbc)</div>
<div><br></div><div><pre tabindex="0" class="" style="font-family:Consolas,'Lucida Console',monospace;font-size:14px;outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:15px;color:rgb(0,0,0);background-color:rgb(225,226,229);white-space:pre-wrap!important">
>> setting environment variables:
PKG_LIBS = -lmpfr -lgmp -L/home/thell/R/library/Rcpp/lib -lRcpp -Wl,-rpath,/home/thell/R/library/Rcpp/lib
PKG_CPPFLAGS = -std=c++11
>> LinkingTo : Rcpp
CLINK_CPPFLAGS = -I"/home/thell/R/library/Rcpp/include"
>> Program source :
1 :
2 : // includes from the plugin
3 :
4 : #include <cmath>
5 : #include <iterator>
6 : #include <RcppCommon.h>
7 : #include <mpreal.h>
8 :
9 : namespace Rcpp {
10 : template <> SEXP wrap( const mpfr::mpreal& ) ;
11 : }
12 :
13 : #include <Rcpp.h>
14 :
15 : // Definitions from Rmpfr conversion utilities.
16 : #if GMP_NUMB_BITS == 32
17 :
18 : # define R_mpfr_nr_ints nr_limbs
19 : # define R_mpfr_exp_size 1
20 :
21 : #elif GMP_NUMB_BITS == 64
22 :
23 : # define R_mpfr_nr_ints (2*nr_limbs)
24 : # define R_mpfr_exp_size 2
25 :
26 : #endif
27 :
28 : # define RIGHT_HALF(_LONG_) ((long long)(_LONG_) & 0x00000000FFFFFFFF)
29 : # define LEFT_SHIFT(_LONG_) (((long long)(_LONG_)) << 32)
30 :
31 : namespace Rcpp {
32 :
33 : template<> SEXP wrap( const mpfr::mpreal& v )
34 : {
35 : mpfr_srcptr pv( v.mpfr_srcptr() );
36 :
37 : S4 vS4("mpfr1");
38 : vS4.slot("prec") = wrap( (int)pv->_mpfr_prec );
39 : vS4.slot("sign") = wrap( (int)pv->_mpfr_sign);
40 :
41 : IntegerVector d( std::ceil( (double)pv->_mpfr_prec / (double)mp_bits_per_limb ) );
42 : mp_size_t i = 0;
43 :
44 : if( GMP_NUMB_BITS == 32 ) {
45 :
46 : vS4.slot("exp") = wrap( (int)pv->_mpfr_exp );
47 :
48 : for( auto & e : d ) {
49 : e = (int) pv->_mpfr_d[i];
50 : ++i;
51 : }
52 :
53 : } else {
54 :
55 : IntegerVector exp(2);
56 : exp[0] = (int) RIGHT_HALF(pv->_mpfr_exp);
57 : exp[1] = (int) (pv->_mpfr_exp >> 32);
58 : vS4.slot("exp") = exp;
59 :
60 : for(i=0; i < d.size(); i++) {
61 : d[2*i] = (int) RIGHT_HALF(pv->_mpfr_d[i]);
62 : d[2*i+1]= (int) (pv->_mpfr_d[i] >> 32);
63 : }
64 :
65 : }
66 :
67 : vS4.slot("d") = d;
68 : return vS4;
69 : }
70 :
71 : }
72 :
73 :
74 : #ifndef BEGIN_RCPP
75 : #define BEGIN_RCPP
76 : #endif
77 :
78 : #ifndef END_RCPP
79 : #define END_RCPP
80 : #endif
81 :
82 : using namespace Rcpp;
83 :
84 :
85 : // user includes
86 :
87 :
88 :
89 : // declarations
90 : extern "C" {
91 : SEXP file34e215a2f7e7( SEXP x, SEXP prec) ;
92 : }
93 :
94 : // definition
95 :
96 : SEXP file34e215a2f7e7( SEXP x, SEXP prec ){
97 : BEGIN_RCPP
98 :
99 : using namespace mpfr;
100 : using namespace Rcpp;
101 :
102 : mpreal::set_default_prec( as< unsigned long >( prec ) );
103 : return wrap( fac_ui( as< double >( x ) ) );
104 :
105 : END_RCPP
106 : }
107 :
108 :
Compilation argument:
/usr/lib/R/bin/R CMD SHLIB file34e215a2f7e7.cpp 2> file34e215a2f7e7.cpp.err.txt
"clang++" -I/usr/share/R/include -DNDEBUG -std=c++11 -I"/home/thell/R/library/Rcpp/include" -fpic -O3 -pipe -g -c file34e215a2f7e7.cpp -o file34e215a2f7e7.o
In file included from file34e215a2f7e7.cpp:6:
In file included from /home/thell/R/library/Rcpp/include/RcppCommon.h:349:
In file included from /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar_forward.h:29:
In file included from /home/thell/R/library/Rcpp/include/Rcpp/sugar/logical/logical.h:27:
/home/thell/R/library/Rcpp/include/Rcpp/sugar/logical/SingleLogicalResult.h:36:2: error: circular inheritance between 'conversion_to_bool_is_forbidden<x>' and 'conversion_to_bool_is_forbidden<x>'
conversion_to_bool_is_forbidden<x>{
^
In file included from file34e215a2f7e7.cpp:13:
In file included from /home/thell/R/library/Rcpp/include/Rcpp.h:68:
In file included from /home/thell/R/library/Rcpp/include/Rcpp/sugar/sugar.h:25:
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:28:2: error: invalid preprocessing directive
#elseif defined(HAS_TR1_UNORDERED_SET)
^
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:29:13: warning: 'RCPP_UNIQUE_SET' macro redefined
#define RCPP_UNIQUE_SET std::tr1::unordered_set
^
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:26:13: note: previous definition is here
#define RCPP_UNIQUE_SET std::unordered_set
^
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:30:13: warning: 'RCPP_UNIQUE_MAP' macro redefined
#define RCPP_UNIQUE_MAP std::tr1::unordered_map
^
/home/thell/R/library/Rcpp/include/Rcpp/sugar/sets.h:27:13: note: previous definition is here
#define RCPP_UNIQUE_MAP std::unordered_map
^
file34e215a2f7e7.cpp:57:31: warning: shift count >= width of type [-Wshift-count-overflow]
exp[1] = (int) (pv->_mpfr_exp >> 32);
^ ~~
file34e215a2f7e7.cpp:62:33: warning: shift count >= width of type [-Wshift-count-overflow]
d[2*i+1]= (int) (pv->_mpfr_d[i] >> 32);
^ ~~
4 warnings and 2 errors generated.
make: *** [file34e215a2f7e7.o] Error 1
ERROR(s) during compilation: source code errors or compiler configuration errors!</pre><pre tabindex="0" class="" style="font-family:Consolas,'Lucida Console',monospace;font-size:14px;outline:none;border:none;margin-top:0px;margin-bottom:0px;line-height:15px;color:rgb(0,0,0);background-color:rgb(225,226,229);white-space:pre-wrap!important">
<br></pre></div><div><br></div><div>The code compiles and works (the warnings are expected for now) using g++.</div>-- <br>Sincerely,<br>Thell<br>