richarddmorey / BayesFactor

BayesFactor R package for Bayesian data analysis with common statistical models.
https://richarddmorey.github.io/BayesFactor/
132 stars 49 forks source link

Build failure on OS X #43

Closed hadley closed 9 years ago

hadley commented 9 years ago
* installing *source* package ‘BayesFactor’ ...
** package ‘BayesFactor’ successfully unpacked and MD5 sums checked
** libs
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c RcppCallback.cpp -o RcppCallback.o
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c RcppExports.cpp -o RcppExports.o
ccache clang -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c common.c -o common.o
ccache clang -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c debug.c -o debug.o
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c interrupts.cpp -o interrupts.o
ccache clang -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c linearReg.c -o linearReg.o
linearReg.c:42:46: warning: unused variable 'bTemp' [-Wunused-variable]
 double Rf_beta[P], sig2=sig2start, yTemp[N],bTemp, XtXoN[PSq];
                                             ^
linearReg.c:39:14: warning: unused variable 'k' [-Wunused-variable]
 int i=0,j=0,k=0, nPars=P+2, PSq=P*P, iOne=1;
             ^
2 warnings generated.
ccache clang -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c logMean.c -o logMean.o
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c matSums.cpp -o matSums.o
matSums.cpp:16:20: warning: expression result unused [-Wunused-value]
      sums[j] += X[i,j];
                   ^
matSums.cpp:31:20: warning: expression result unused [-Wunused-value]
      sums[i] += X[i,j];
                   ^
2 warnings generated.
ccache clang -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c matrix.c -o matrix.o
matrix.c:43:27: warning: unused variable 'j' [-Wunused-variable]
  int Nsqr = N*N,info,i=0,j=0;
                          ^
1 warning generated.
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c metattest.cpp -o metattest.o
ccache clang -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c nWayAOV.c -o nWayAOV.o
nWayAOV.c:67:31: warning: unused variable 'W' [-Wunused-variable]
 double avg = 0, *g1, g2[P], *W;
                              ^
nWayAOV.c:327:13: warning: unused variable 'b' [-Wunused-variable]
 double *a,*b,*Xty,*XtX,*samples,*X, *y, *r,*priorX;
            ^
nWayAOV.c:327:10: warning: unused variable 'a' [-Wunused-variable]
 double *a,*b,*Xty,*XtX,*samples,*X, *y, *r,*priorX;
         ^
nWayAOV.c:371:10: warning: unused variable 'g1' [-Wunused-variable]
 double *g1, Sigma[P1Sq], SSq, oneOverSig2,dZero=0,dOne=1,dnegOne=-1;
         ^
4 warnings generated.
ccache clang -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c oneWayAOV.c -o oneWayAOV.o
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c progress.cpp -o progress.o
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c proportion.cpp -o proportion.o
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c ttestIndepRcpp.cpp -o ttestIndepRcpp.o
ccache clang++ -Qunused-arguments -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/hadley/R-revdep/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c ttestRcpp.cpp -o ttestRcpp.o
ccache clang++ -Qunused-arguments -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o BayesFactor.so RcppCallback.o RcppExports.o common.o debug.o interrupts.o linearReg.o logMean.o matSums.o matrix.o metattest.o nWayAOV.o oneWayAOV.o progress.o proportion.o ttestIndepRcpp.o ttestRcpp.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [BayesFactor.so] Error 1
ERROR: compilation failed for package ‘BayesFactor’
* removing ‘/private/tmp/Rtmpaufjai/check_cranb1c93c554172/BayesFactor.Rcheck/BayesFactor’

Any ideas?

richarddmorey commented 9 years ago

Hmmm, I develop on OSX and I haven't seen this problem. But this looks relevant: http://stackoverflow.com/questions/25224325/compile-c-code-in-r-does-not-work-anymore

(I notice that the compile uses clang, and the error references gcc)

hadley commented 9 years ago

I think it's failing because quadmath uses __float128, which clang doesn't support.

Do you know why you're using quadmath? (I didn't see it when grepping the source)

richarddmorey commented 9 years ago

it may have been removed recently as I've been updating the code base. I'll check on it.

richarddmorey commented 9 years ago

Does this help? http://www.thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error

richarddmorey commented 9 years ago

I'm going to close this; let me know if that last link didn't solve the problem.