[Rd] Library not loaded: /usr/local/lib/libquadmath.0.dylib

2014-09-02 Thread Xiao He
Hi all,

I tried to load a package which includes a shared object on one of my Macs,
and I got an error message below, which suggests that the file "
libquadmath.0.dylib" is missing in the /usr/local/lib folder. On my other
Mac however, I have no problem loading the package, and the file "
libquadmath.0.dylib" is in the /usr/local/lib folder. I wonder where this
libquadmath.0.dylib file is from, and how I can install it on the computer
where it is missing. Thanks!

library(WRScpp)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so':

dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so,
6): Library not loaded: /usr/local/lib/libquadmath.0.dylib
  Referenced from:
/Library/Frameworks/R.framework/Versions/3.1/Resources/library/WRScpp/libs/WRScpp.so
  Reason: image not found
Error: package or namespace load failed for ‘WRScpp’​

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] invalid operands of types ‘SEXPREC*’ and ‘R_len_t’ to binary ‘operator/’ with Rcpp.

2013-05-14 Thread Xiao He
Dear R-Developers,

I just started learning how to use Rcpp. Earlier while using it, I
encountered an error as shown below:

file74d8254b96d4.cpp: In function ‘Rcpp::NumericVector
foo(Rcpp::NumericVector, Rcpp::NumericVector, Rcpp::NumericVector,
Rcpp::Function, Rcpp::Function)’:
file74d8254b96d4.cpp:10: error: invalid operands of types ‘SEXPREC*’ and
‘R_len_t’ to binary ‘operator/’
make: *** [file74d8254b96d4.o] Error 1

Below is a mock function that can reproduce this error. I wonder if anyone
can tell me what is the problem here. Thank you in advance!!

foo<-cppFunction('
   NumericVector foo(NumericVector q, NumericVector shape1, NumericVector
shape2, Function pbeta, Function sequence){
 NumericVector output(q.size());
 output=pbeta(sequence(q.size())/q.size(), shape1, shape2);
return output;
 }
 ')


Best,
Xiao

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] invalid operands of types ‘SEXPREC*’ an d ‘R_len_t’ to binary ‘operator/’ wit h Rcpp.

2013-05-14 Thread Xiao He
Thank you!

I will send my reply to Rcpp-devel from now on Re: my question -. Since I
thought cppFunction() allows vectorized operations, I thought any R
functions I call from R would also allow it. pbeta() within R can be
specified as  pbeta(runif(10), 1, 2) where the first argument is a vector.
the function sequence() basically takes an integer, and produce a vector of
consecutive integers starting from 1 to the provided value.


Best,
Xiao

On Tue, May 14, 2013 at 6:39 AM, Dirk Eddelbuettel  wrote:

>
> On 13 May 2013 at 21:42, Xiao He wrote:
> | Dear R-Developers,
> |
> | I just started learning how to use Rcpp. Earlier while using it, I
> | encountered an error as shown below:
> |
> | file74d8254b96d4.cpp: In function ‘Rcpp::NumericVector
> | foo(Rcpp::NumericVector, Rcpp::NumericVector, Rcpp::NumericVector,
> | Rcpp::Function, Rcpp::Function)’:
> | file74d8254b96d4.cpp:10: error: invalid operands of types ‘SEXPREC*’ and
> | ‘R_len_t’ to binary ‘operator/’
> | make: *** [file74d8254b96d4.o] Error 1
> |
> | Below is a mock function that can reproduce this error. I wonder if
> anyone
> | can tell me what is the problem here. Thank you in advance!!
> |
> | foo<-cppFunction('
> |NumericVector foo(NumericVector q, NumericVector shape1, NumericVector
> | shape2, Function pbeta, Function sequence){
> |  NumericVector output(q.size());
> |  output=pbeta(sequence(q.size())/q.size(), shape1, shape2);
> | return output;
> |  }
> |  ')
>
> Really briefly:
>
>  1)  Wrong mailing list. Rcpp question are to be sent to rcpp-devel
>
>  2)  Possible error in your function setup.  Why do you supply pbeta?
>  What is sequence?
>
>  3)  Error in how you call pbeta.  The first argument is a vector, the
> other
>  two are scalars.
>
>  4)  Compiler error is pretty clear for once: it does not understand the
>  division, and you only have one so look there.
>
>
> Here is a minimal working example:
>
> library(Rcpp)
> foo<-cppFunction('NumericVector foo(NumericVector q, double shape1, double
> shape2){
>   return pbeta(q, shape1, shape2);
>
>}')
>
> for which I get
>
> R> source('/tmp/foo.R')
> R> foo(seq(0.1, 0.5, by=0.1), 2, 3)
> [1] 0.0523 0.1808 0.3483 0.5248 0.6875
>
> Dirk
>
> --
> Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Using a shared object without installing a library required by the object.

2013-05-23 Thread Xiao He
Dear all,

I have a C++ code. To create a shared object from this particular code, I
had to install a Fortran library on my computer (Mac). The compiled code
runs fine on my computer. However,  if I try to dyn.load() said shared
object on a computer that does not have the Fortran library installed, the
object won't load, and instead I get a message below:

usr/local/lib/libgfortran.2.dylib
 Referenced from: /Users/xh/Downloads/foo2.so

I wonder if there is any way to compile the original C++ code such that I
can include the necessary components of the Fortran library without having
to install the library.


Thank you in advance.

Best,
Xiao

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Using a shared object without installing a library required by the object.

2013-05-23 Thread Xiao He
Oops, Sorry, did not reply-all:

Thanks for the reply Simon,

I have a follow-up question:

So after I run the first code you suggested on a computer, the shared
object will use the Fortran run-time included in R. Does this code change
the shared object itself? Meaning if I send this object to yet another
computer and run it, will it know to link to the Fortran included in R?
Thanks!

-Best,
Xiao


On Thu, May 23, 2013 at 5:06 PM, Xiao He  wrote:

> Thanks for the reply Simon,
>
> I have a follow-up question:
>
> So after I run the first code you suggested on a computer, the shared
> object will use the Fortran run-time included in R. Does this code change
> the shared object itself? Meaning if I send this object to yet another
> computer and run it, will it know to link to the Fortran included in R?
> Thanks!
>
> Best,
> Xiao
>
>
>
> On Thu, May 23, 2013 at 4:54 PM, Simon Urbanek <
> simon.urba...@r-project.org> wrote:
>
>> On May 23, 2013, at 4:18 PM, Xiao He  wrote:
>>
>> > Dear all,
>> >
>> > I have a C++ code. To create a shared object from this particular code,
>> I
>> > had to install a Fortran library on my computer (Mac). The compiled code
>> > runs fine on my computer. However,  if I try to dyn.load() said shared
>> > object on a computer that does not have the Fortran library installed,
>> the
>> > object won't load, and instead I get a message below:
>> >
>> > usr/local/lib/libgfortran.2.dylib
>> > Referenced from: /Users/xh/Downloads/foo2.so
>> >
>> > I wonder if there is any way to compile the original C++ code such that
>> I
>> > can include the necessary components of the Fortran library without
>> having
>> > to install the library.
>> >
>>
>> The Fortran run-time is included with R, so you only need to change the
>> path -- e.g.
>>
>> install_name_tool -change /usr/local/lib/libgfortran.2.dylib
>> /Library/Frameworks/R.framework/Resources/lib/libgfortran.2.dylib
>> /Users/xh/Downloads/foo2.so
>>
>> You can make that permanent on your build machine by running
>>
>> install_name_tool -id
>>  /Library/Frameworks/R.framework/Resources/lib/libgfortran.2.dylib
>> /usr/local/lib/libgfortran.2.dylib
>>
>> If you do that, all code compiled against it subsequently will point to
>> the version inside R instead.
>>
>> Cheers,
>> Simon
>>
>> FWIW: There is R-SIG-Mac for Mac-specific questions.
>>
>>
>> >
>> > Thank you in advance.
>> >
>> > Best,
>> > Xiao
>> >
>> >   [[alternative HTML version deleted]]
>> >
>> > __
>> > R-devel@r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-devel
>> >
>> >
>>
>>
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel