Trouble installing gpuR on Ubuntu ppc64le - r

I am trying to install gpuR on Ubuntu 16.04 LTS ppc64le (IBM POWER8), but crashed into an error which says "vector’ does not name a type".
Can you pls help me out ? Any comment would be much appreciated.
> install.packages("gpuR")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://ftp.iitm.ac.in/cran/src/contrib/gpuR_1.2.1.tar.gz'
Content type 'application/x-gzip' length 451127 bytes (440 KB)
==================================================
downloaded 440 KB
...
** package ‘gpuR’ successfully unpacked and MD5 sums checked
OPENCL_FLAGS not set, using default -DCL_HPP_MINIMUM_OPENCL_VERSION=110 -
DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_HPP_TARGET_OPENCL_VERSION=120
Linux OS
found OpenCL library
Checking OpenCL C++ API
OPENCL_INC not set, using default include directory /usr/include
No OpenCL C++ API found, will use the headers contained in the package
*********** Generated Makevars file ***********
CXX_STD=CXX11
PKG_CPPFLAGS=-I../inst/include -DCL_HPP_MINIMUM_OPENCL_VERSION=110 -
DCL_USE_DEPRECATED_OPENCL_1_2_APIS -DCL_HPP_TARGET_OPENCL_VERSION=120 -
I'/usr/include/' -I. -pthread
PKG_CXXFLAGS=
PKG_LIBS=-lOpenCL
BUILD_LIB=
$(SHLIB): $(BUILD_LIB)
../inst/include/loader/libOpenCL.a:
cd ../inst/include/loader/ && $(MAKE) libOpenCL.a \
CC="$(CC)" CFLAGS="$(ALL_CFLAGS)" AR="$(AR)" RM="$(RM)" \
ICD_OS=icd_linux
***********************************************
** libs
g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -I../inst/include -
DCL_HPP_MINIMUM_OPENCL_VERSION=110 -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -
DCL_HPP_TARGET_OPENCL_VERSION=120 -I'/usr/include/' -I. -pthread -
I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-
library/RcppEigen/include" -I"/usr/local/lib/R/site-
library/RViennaCL/include" -I"/usr/local/lib/R/site-library/BH/include" -
fPIC -g -O3 -fstack-protector-strong -Wformat -Werror=format-security -
Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -I../inst/include -
DCL_HPP_MINIMUM_OPENCL_VERSION=110 -DCL_USE_DEPRECATED_OPENCL_1_2_APIS -
DCL_HPP_TARGET_OPENCL_VERSION=120 -I'/usr/include/' -I. -pthread -
I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-
library/RcppEigen/include" -I"/usr/local/lib/R/site-
library/RViennaCL/include" -I"/usr/local/lib/R/site-library/BH/include" -
fPIC -g -O3 -fstack-protector-strong -Wformat -Werror=format-security -
Wdate-time -D_FORTIFY_SOURCE=2 -g -c chol.cpp -o chol.o
In file included from ../inst/include/CL/cl.h:35:0,
from /usr/local/lib/R/site-
library/RViennaCL/include/viennacl/ocl/context.hpp:28,
from /usr/local/lib/R/site-
library/RViennaCL/include/viennacl/ocl/backend.hpp:26,
from chol.cpp:5:
../inst/include/CL/cl_platform.h:390:12: error: ‘vector’ does not name a
type
typedef vector unsigned char __cl_uchar16;
^
../inst/include/CL/cl_platform.h:391:12: error: ‘vector’ does not name a
type
typedef vector signed char __cl_char16;
^
../inst/include/CL/cl_platform.h:392:12: error: ‘vector’ does not name a
type
typedef vector unsigned short __cl_ushort8;
^
../inst/include/CL/cl_platform.h:393:12: error: ‘vector’ does not name a
type
typedef vector signed short __cl_short8;
...
../inst/include/CL/cl_platform.h:1214:5: error: ‘__cl_float4’ does not name
a type
__cl_float4 v4[4];
^
/usr/lib/R/etc/Makeconf:143: recipe for target 'chol.o' failed
make: *** [chol.o] Error 1
ERROR: compilation failed for package ‘gpuR’
* removing ‘/usr/local/lib/R/site-library/gpuR’
The downloaded source packages are in
‘/tmp/RtmpGoy6Af/downloaded_packages’
Warning message:
In install.packages("gpuR") :
installation of package ‘gpuR’ had non-zero exit status

I solved this specific trouble by modifying cl_platform.h included in gpuR_1.2.1.tar.gz. I simply changed "typedef vector" in the following into "typedef __vector".
u0017649#sys-87458:~$ wget
https://cran.revolutionanalytics.com/src/contrib/gpuR_1.2.1.tar.gz
u0017649#sys-87458:~$ tar -zxvf gpuR_1.2.1.tar.gz
u0017649#sys-87458:~$ cd gpuR/inst/include/CL
u0017649#sys-87458:~/gpuR/inst/include/CL$ vi cl_platform.h
#include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
typedef vector unsigned char __cl_uchar16;
typedef vector signed char __cl_char16;
typedef vector unsigned short __cl_ushort8;
typedef vector signed short __cl_short8;
typedef vector unsigned int __cl_uint4;
typedef vector signed int __cl_int4;
typedef vector float __cl_float4;

Related

make: *** [fusion/calvin_files/fusion/src/FusionCELData.o] Error 1

I tried to build affxparser an R package on my book, M1 MacOS 12.3.1, with R 4.1.3 and gcc 11.2.0.
However the building runs error. (as the limit of characters, i haven't put few beginning lines, to see more details can click here
g++-11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -Ifusion/calvin_files/array/src -Ifusion/calvin_files/data/src -Ifusion/calvin_files/exception/src -Ifusion/calvin_files/fusion/src -Ifusion/calvin_files/fusion/src/GCOSAdapter -Ifusion/calvin_files/fusion/src/CalvinAdapter -Ifusion/calvin_files/parameter/src -Ifusion/calvin_files/parsers/src -Ifusion/calvin_files/portability/src -Ifusion/calvin_files/template/src -Ifusion/calvin_files/utils/src -Ifusion/calvin_files/writers/src -Ifusion/file -Ifusion/file/TsvFile -Ifusion/portability -Ifusion/util -Ifusion -D_USE_MEM_MAPPING_ -I/opt/R/arm64/include -fPIC -mtune=native -g -O2 -Wall -pedantic -Wconversion -Wno-sign-compare -O0 -c fusion/calvin_files/fusion/src/FusionCELData.cpp -o fusion/calvin_files/fusion/src/FusionCELData.o
In file included from fusion/file/CELFileData.h:33,
from fusion/calvin_files/fusion/src/GCOSAdapter/GCOSCELDataAdapter.h:30,
from fusion/calvin_files/fusion/src/FusionCELData.cpp:24:
fusion/file/FileIO.h: In function 'uint16_t affy_swap16(uint16_t)':
fusion/file/FileIO.h:67:31: warning: conversion from 'int' to 'uint16_t' {aka 'short unsigned int'} may change value [-Wconversion]
67 | return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from fusion/calvin_files/fusion/src/GCOSAdapter/GCOSCELDataAdapter.h:30,
from fusion/calvin_files/fusion/src/FusionCELData.cpp:24:
fusion/file/CELFileData.h: At global scope:
fusion/file/CELFileData.h:91:23: warning: malformed '#pragma options align={mac68k|power|reset}', ignoring [-Wpragmas]
91 | #pragma options align=packed
| ^~~~~~
fusion/file/CELFileData.h:127:23: error: too many '#pragma options align=reset'
127 | #pragma options align=reset
| ^~~~~
fusion/calvin_files/fusion/src/FusionCELData.cpp: In member function 'unsigned int affymetrix_fusion_io::FusionCELData::GetFileSize()':
fusion/calvin_files/fusion/src/FusionCELData.cpp:492:22: warning: conversion from 'int64_t' {aka 'long long int'} to 'unsigned int' may change value [-Wconversion]
492 | return Fs::fileSize(filename);
| ~~~~~~~~~~~~^~~~~~~~~~
make: *** [fusion/calvin_files/fusion/src/FusionCELData.o] Error 1
ERROR: compilation failed for package ‘affxparser’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/affxparser’
Besides, i have installed some other packages which also run error. According to some information, i wrote some codes in bash_profile and Makevars in command line.
I add codes below in bash_profile
alias gcc='gcc-11'
alias cc='gcc-11'
alias g++='g++-11'
alias c++='c++-11'
I create a Makevars which is
VER=-11
CC=gcc$(VER)
CXX=g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
FLIBS=-L/usr/local/Cellar/gcc/11.2.0/lib/gcc/11
I thought the make: ***[fusion/calvin_files/fusion/src/FusionCELData.o] Error 1 might be the problem, but I don't know how to fix it. Hope for anyone answer.
I fix this problem with hiding away those codes in my Makevars and bash_profile showed above, which turn my profiler into default clang to profile codes in affxparser. Finally, finish this.

C99 mode error when installing rlang on centos7

I have created a docker image based on Centos7 and installed R with the Dockerfile below:
FROM centos:7
ENV TZ=Etc/UTC
# OS Dependencies
RUN yum install -y \
epel-release \
centos-release-scl-rh \
openblas-Rblas \
devtoolset-8-toolchain \
tre-devel \
wget \
libcurl-devel \
&& yum group install -y "Development Tools"
# Install R
RUN yum install -y \
http://springdale.princeton.edu/data/springdale/7/x86_64/os/Computational/libRmath-devel-4.0.2-1.sdl7.x86_64.rpm \
http://springdale.princeton.edu/data/springdale/7/x86_64/os/Computational/libRmath-4.0.2-1.sdl7.x86_64.rpm \
http://springdale.princeton.edu/data/springdale/7/x86_64/os/Computational/R-java-devel-4.0.2-1.sdl7.x86_64.rpm \
http://springdale.princeton.edu/data/springdale/7/x86_64/os/Computational/R-devel-4.0.2-1.sdl7.x86_64.rpm \
http://springdale.princeton.edu/data/springdale/7/x86_64/os/Computational/R-core-devel-4.0.2-1.sdl7.x86_64.rpm \
http://springdale.princeton.edu/data/springdale/7/x86_64/os/Computational/R-core-4.0.2-1.sdl7.x86_64.rpm
I am trying to install the R package rlang but am getting an error related to "C99" mode that I cannot resolve.
> install.packages("rlang", repos = "https://cran.rstudio.org")
Installing package into '/usr/lib64/R/library'
(as 'lib' is unspecified)
trying URL 'https://cran.rstudio.org/src/contrib/rlang_0.4.10.tar.gz'
Content type 'application/x-gzip' length 915685 bytes (894 KB)
==================================================
downloaded 894 KB
* installing *source* package 'rlang' ...
** package 'rlang' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -m64 -I"/usr/include/R" -DNDEBUG -I./lib/ -I/usr/local/include -fvisibility=hidden -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c capture.c -o capture.o
gcc -m64 -I"/usr/include/R" -DNDEBUG -I./lib/ -I/usr/local/include -fvisibility=hidden -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c export.c -o export.o
In file included from export.c:1:0:
export/exported.c: In function 'rlang_env_bind_list':
export/exported.c:93:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (r_ssize i = 0; i < n; ++i) {
^
export/exported.c:93:3: note: use option -std=c99 or -std=gnu99 to compile your code
In file included from export.c:1:0:
export/exported.c: In function 'rlang_is_string':
export/exported.c:572:3: error: 'for' loop initial declarations are only allowed in C99 mode
for (r_ssize i = 0; i < n; ++i) {
^
make: *** [export.o] Error 1
ERROR: compilation failed for package 'rlang'
* removing '/usr/lib64/R/library/rlang'
The downloaded source packages are in
'/tmp/RtmpEmr8lk/downloaded_packages'
Updating HTML index of packages in '.Library'
Warning messages:
1: In install.packages("rlang", repos = "https://cran.rstudio.org") :
installation of package 'rlang' had non-zero exit status
2: In file.create(f.tg) :
cannot create file '/usr/share/doc/R-4.0.2/html/packages.html', reason 'No such file or directory'
3: In make.packages.html(.Library) : cannot update HTML package index
The error is the same one as discussed here, but I was looking for a solution that I could implement during image build (i.e. an environment var or change to an R config file) that would be persistent for those using the image and installing R packages in the future, allowing them to install with a simple call to install.packages() rather than having to use withr::with_makevars() for every package install.
You can set R's config file under $R_HOME/etc/Makeconf (or add a Makevars in the same directory). By default, R_HOME should be in /usr/lib64/R, although you can get it in R by running > R.home().
Set CC = gcc -std=c11 (or whatever standard you like), you may also want to set CXX standard similarly.
Technically, you can also change what the gcc binary points to. I tried this after setting the CFLAGS environment variable failed. For example, you can rename the gcc binary (usually under /usr/bin) to something like gcc-v4.8.5. Then create a file called gcc (with proper exec permissions) in the same folder with the following shell script
#!/usr/bin/env bash
gcc-v4.8.5 -std=c99 "$#"
This will work by invoking gcc with that extra parameter but it's not recommended since it will probably break after updates to gcc. That said, I am not sure what happens to Makevars/Makeconf when R will be updated.
This shouldn't be a problem if the user runs gcc separately, it just sets the default standard that will be ignored if the user specifies the flag as well (since it will appear later in the command).

Can't install any R packages anymore

I use r for biological data analysis. I'm on a Mac OS Catalina 10.15.4. I recently updated R to version 3.6.3 because I thought that would solve my inability to install a particular package: DESeq2. Huge mistake - amongst the many I've probably made in trying to troubleshoot without really understanding what the problem is. I'm not able to install ANY packages now. I had updated my Clang version when I went down the rabbit hole of potential solutions on the internet. I was going to upgrade gfortran too, but I want to understand what the problem is really before I blindly try more.
Now I've downgraded to R 3.5.3 (I'd like to stick to this R version).
Qst: Using R 3.5.3, how do I successfully install packages from CRAN again? And also from Bioconductor like the DESeq2 package?
Error warning below:
install.packages("readr")
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5:
cannot open URL 'http://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.5/PACKAGES'
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘readr’
Do you want to attempt to install these from sources? (Yes/no/cancel) y
installing the source package ‘readr’
trying URL 'http://cran.rstudio.com/src/contrib/readr_1.3.1.tar.gz'
Content type 'application/x-gzip' length 268853 bytes (262 KB)
==================================================
downloaded 262 KB
* installing *source* package ‘readr’ ...
** package ‘readr’ successfully unpacked and MD5 sums checked
** libs
clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include"
-I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include"
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c Collector.cpp -o Collector.o
clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include"
-I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include"
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c CollectorGuess.cpp -o CollectorGuess.o
clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include"
-I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include"
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c Iconv.cpp -o Iconv.o
clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include"
-I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include"
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c LocaleInfo.cpp -o LocaleInfo.o
clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include"
-I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include"
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include"
-I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include"
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -I. -Ircon -fPIC -Wall -g -O2 -c Reader.cpp -o Reader.o
In file included from Reader.cpp:1:
In file included from ./Reader.h:3:
In file included from ./Collector.h:5:
In file included from ./DateTimeParser.h:6:
In file included from ./QiParsers.h:4:
In file included from ./boost.h:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17:
error: unknown type name 'uuid_t'
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
^
In file included from Reader.cpp:1:
In file included from ./Reader.h:3:
In file included from ./Collector.h:5:
In file included from ./DateTimeParser.h:6:
In file included from ./QiParsers.h:4:
In file included from ./boost.h:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:662:27:
error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int getsgroups_np(int *, uuid_t);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31:
note: 'uid_t' declared here
typedef __darwin_uid_t uid_t;
^
In file included from Reader.cpp:1:
In file included from ./Reader.h:3:
In file included from ./Collector.h:5:
In file included from ./DateTimeParser.h:6:
In file included from ./QiParsers.h:4:
In file included from ./boost.h:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:664:27:
error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int getwgroups_np(int *, uuid_t);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31:
note: 'uid_t' declared here
typedef __darwin_uid_t uid_t;
^
In file included from Reader.cpp:1:
In file included from ./Reader.h:3:
In file included from ./Collector.h:5:
In file included from ./DateTimeParser.h:6:
In file included from ./QiParsers.h:4:
In file included from ./boost.h:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:727:31:
error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int setsgroups_np(int, const uuid_t);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31:
note: 'uid_t' declared here
typedef __darwin_uid_t uid_t;
^
In file included from Reader.cpp:1:
In file included from ./Reader.h:3:
In file included from ./Collector.h:5:
In file included from ./DateTimeParser.h:6:
In file included from ./QiParsers.h:4:
In file included from ./boost.h:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/interprocess/file_mapping.hpp:15:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config.hpp:57:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:729:31:
error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int setwgroups_np(int, const uuid_t);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31:
note: 'uid_t' declared here
typedef __darwin_uid_t uid_t;
^
5 errors generated.
make: *** [Reader.o] Error 1
ERROR: compilation failed for package ‘readr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/readr’
Warning in install.packages :
installation of package ‘readr’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/49/18qlr0bn7xg_mk2pzxvrb0f80000gn/T/RtmpN5hCja/downloaded_packages’
Appreciate your help.
I've had the same problem on my Mac! I'm running Mojave. It appears there has been an issue with CRAN recently. Add the following repo argument has worked for me:
install.packages("readr", repo = 'https://mac.R-project.org')
More info: https://community.rstudio.com/t/i-can-t-install-packages-on-r-studio-non-zero-exit-status/52135
I think the problem is the type uuid_t is not defined at anywhere. So the declaration at line 662 in the file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h will cause error for example.
In the first attempt, I tried to add one line into that unistd.h file:
#include at line 83. But it doesn't help.
Because I don't want to go deeper to edit many system file, I add another line into unistd.h to manually define the type of uuid_t, based on the definition in _uuid_t.h.
typedef __darwin_uuid_t uuid_t; at line 661, after "#endif".
Then it worked.
I am not sure if this is an error in the source code of MacOSX.10.15.sdk or not. But if you want to fix it in this way, please make sure you have the root permission when editing those files.
I relied on these 2 posts to solve my issue:
https://www.nistara.net/post/compile-issues-r/
https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/
Thanks to the Coatless Professor and Nistara Randhawa

loop_apply.o: file not recognized: File format not recognized

I am trying to install R’s plyr package. Here is the error message:
* installing *source* package ‘plyr’ ...
** package ‘plyr’ successfully unpacked and MD5 sums checked
** libs
clang++ -I/opt/R-3.4.1/include -DNDEBUG -I"/home/isomorphismes/R/i686-pc-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -I/opt/boost_1_61_0/boost -c RcppExports.cpp -o RcppExports.o
clang -I/opt/R-3.4.1/include -DNDEBUG -I"/home/cd/R/i686-pc-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -g -O2 -flto -c loop_apply.c -o loop_apply.o
clang++ -I/opt/R-3.4.1/include -DNDEBUG -I"/home/isomorphismes/R/i686-pc-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -I/opt/boost_1_61_0/boost -c split-numeric.cpp -o split-numeric.o
clang++ -shared -L/usr/local/lib -o plyr.so RcppExports.o loop_apply.o split-numeric.o
loop_apply.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1 (use -v to see invocation)
/opt/R-3.4.1/share/make/shlib.mk:6: recipe for target 'plyr.so' failed
make: *** [plyr.so] Error 1
ERROR: compilation failed for package ‘plyr’
* removing ‘/home/cd/R/i686-pc-linux-gnu-library/3.4/plyr’
The *.o files are in /opt/plyr/src, from github.com/hadley/plyr. They look like this on my system:
i#scheherezade:/opt/plyr/src$ file *o
loop_apply.o: LLVM IR bitcode
RcppExports.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
split-numeric.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
In case you didn't know, -flto specifies link time optimization, and has been added by R. How did you manage to end up with such a mis-configured R install?
Adding -flto to the link command may work? Or remove it from the loop_apply compilation line. If either of those works, you need to fix your R install.
Compiling with -flto using clang requires (on Ubuntu) installing the llvm-dev package. Otherwise, the linker is unable to handle -flto object files.
apt-get install clang-10 llvm-10-dev
Now the linking should succeed.

Trouble installing packages in RStudio on Linux

I'm trying to install the following package in RStudio on Linux. I'm getting the follow error code. I don't really understand it. I was wondering if anyone could help me make sense of it.
Thanks,
Nick
> install.packages("PKI")
Installing package into ‘/home/nick/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/PKI_0.1-3.tar.gz'
Content type 'application/x-gzip' length 31058 bytes (30 KB)
==================================================
downloaded 30 KB
* installing *source* package ‘PKI’ ...
** package ‘PKI’ successfully unpacked and MD5 sums checked
** libs
gcc -I/usr/include/R/ -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -c asn1.c -o asn1.o
gcc -I/usr/include/R/ -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -c init.c -o init.o
gcc -I/usr/include/R/ -DNDEBUG -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -c pki-x509.c -o pki-x509.o
pki-x509.c: In function ‘PKI_extract_key’:
pki-x509.c:136:26: error: dereferencing pointer to incomplete type ‘EVP_PKEY {aka struct evp_pkey_st}’
if (EVP_PKEY_type(key->type) != EVP_PKEY_RSA)
^~
pki-x509.c: In function ‘get_cipher’:
pki-x509.c:244:40: error: dereferencing pointer to incomplete type ‘EVP_CIPHER_CTX {aka struct evp_cipher_ctx_st}’
ctx = (EVP_CIPHER_CTX*) malloc(sizeof(*ctx));
^~~~
pki-x509.c: In function ‘PKI_RSAkeygen’:
pki-x509.c:550:5: warning: ‘RSA_generate_key’ is deprecated [-Wdeprecated-declarations]
rsa = RSA_generate_key(bits, 65537, 0, 0);
^~~
In file included from /usr/include/openssl/rsa.h:13:0,
from pki.h:13,
from pki-x509.c:1:
/usr/include/openssl/rsa.h:193:1: note: declared here
DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
^
make: *** [/usr/lib64/R/etc/Makeconf:159: pki-x509.o] Error 1
ERROR: compilation failed for package ‘PKI’
* removing ‘/home/nick/R/x86_64-pc-linux-gnu-library/3.4/PKI’
Warning in install.packages :
installation of package ‘PKI’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpttDG6C/downloaded_packages’
I think I had the same problem recently.
I installed the package by downloading the most recent tarball (the .tar.gz file PKI_0.1-5.tar.gz) from the PKI RForge page and then running
install.packages(<tarball_path>, repos = NULL, type = "source").
EDIT: Actually, it's easier to run install.packages('PKI',,'http://www.rforge.net/') as written in small print at the bottom of the PKI RForge page
EDIT2: Looking at the news, it looks like version 0.1-4 (perhaps more stable) also fixes the problem and, well enough, it works on my system, while 0.1-3 doesn't (the one on CRAN currently).

Resources