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
Related
I am running MRO 3.5.0 on Win10, and trying to install a package image.CannyImage from bnosac/image on the github. But it keeps reporting fatal errors as following.
* installing *source* package 'image.CannyEdges' ...
** libs
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_64/bin/gcc -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -std=gnu99 -mtune=core2 -c adsf.c -o adsf.o
c:/Rtools/mingw_64/bin/g++ -m64 -I"C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/include" -DNDEBUG -I"C:/Users/eric1/Documents/R/win-library/3.5/Rcpp/include" -I"C:/swarm/workspace/External-R-3.5.0/vendor/extsoft/include" -O2 -Wall -mtune=core2 -c rcpp_canny.cpp -o rcpp_canny.o
In file included from rcpp_canny.cpp:13:0:
canny.h:8:19: fatal error: fftw3.h: No such file or directory
#include <fftw3.h>
^
compilation terminated.
make: *** [C:/PROGRA~1/MICROS~1/ROPEN~1/R-35~1.0/etc/x64/Makeconf:215: rcpp_canny.o] Error 1
ERROR: compilation failed for package 'image.CannyEdges'
* removing 'C:/Users/eric1/Documents/R/win-library/3.5/image.CannyEdges'
In R CMD INSTALL
Installation failed: Command failed (1)
^
compilation terminated.
Google says I can solve the issue by sudo apt-get remove libfftw3-dev. Unfortunately, I am on Windows, and some advised, apply lib /machine:i386 /def:libfftw3-3.def on cmd mode. Ouch, there is no such command or file called lib.exe on Win10.
Please advise, how I can solve this issue on my Win10+MRO system. Thanks.
Even though this question is already a bit old:
By now (Feb 2020) there are precompiled packages available that work also under Windows:
Canny Edges - Package
and more general:
List of all available packages
I have tried installing them and (at least for me) it worked.
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.
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;
I am developing an R package on Mac OSX with some low level C/C++ code and openMP support. The C++ code is written using Rcpp package. My global ''Makevars'' file is placed under ~/.R/ folder. The file looks like following.
CC=clang-omp
CXX=clang-omp++
PKG_CFLAGS=Wall -pedantic
PKG_CFLAGS= -fopenmp
PKG_CXXFLAGS= -fopenmp
PKG_LIBS= -fopenmp -lgomp
Everything works great under this configuration!
However, now I want to build package-specific Makevars file for its own compilation to make the package portable. What I tried was simply move the global Makevars file into my R pakcage src folder. However, the compiler complained about that it cannot find the openMP header file omp.h:
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/bigmemory/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/BH/include" -fopenmp -fPIC -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:12:10: fatal error: 'omp.h' file not found
#include <omp.h>
^
1 error generated.
make: *** [RcppExports.o] Error 1
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/bigmemory/include" -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/BH/include" -fopenmp -fPIC -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:12:10: fatal error: 'omp.h' file not found
#include <omp.h>
^
1 error generated.
make: *** [RcppExports.o] Error 1
As you can see, the compilers become clang and clang++, but not what specified in the Makevars files: CC=clang-omp and CXX=clang-omp++.
Question 1: So how could I fix this issue and build a Makevars file within the R package?
Another thing is that, I noticed from Writing R extensions that,
For example, a package with C code written for OpenMP should have in src/Makevars the lines
PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS)
Question 2: What is the difference between, for example, macro $(SHLIB_OPENMP_CFLAGS) and flag -fopenmp? which one under which circumstance should I use? I tried to replace the flags with the macros, but still cannot fix the issue.
Regarding question, my favourite approach is to copy from working packages. Here is eg the part from (recommended / Core) package mgcv:
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS)
PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
I use the same snippet in the smaller winsorize package (on GitHub) by myself and Andreas.
Regarding question 2: The first form is more general and would allow other OpenMP implementations. It uses what R found to be useable when it was configured.
It sounds like you need the package Makevars as Dirk describes; for your local environment, have ~/.R/Makevars setting your C and C++ compilers to your OpenMP enabled versions using CC and CXX.
Your package (if destined for CRAN, and indeed any Mac R users who haven't battled to install an OpenMP version of clang) will need to work without OpenMP, so your code and compiler flags probably shouldn't assume its presence.
I am trying to build a mapnik 2.2.0 RPM file on my RHEL/CENTOS 7 machine.
so I took the RPM SRC file from Fedora 22 which is mapnik-2.2.0-11.fc21.src.rpm ( I have the same result with mapnik-2.2.0-5.fc20.src.rpm )
when I am running the rpmbuild I receive the following error message:
Welcome to Mapnik...
scons: warning: Ignoring missing SConscript 'deps/agg/build.py'
File "/root/rpmbuild/BUILD/mapnik-v2.2.0/SConstruct", line 1799, in <module>
scons: warning: Ignoring missing SConscript 'deps/mapnik/build.py'
File "/root/rpmbuild/BUILD/mapnik-v2.2.0/SConstruct", line 1808, in <module>
scons: done reading SConscript files.
scons: Building targets ...
g++ -o bindings/python/mapnik_building_symbolizer.os -c -ansi -Wall -pthread -ftemplate-depth-300 -O3 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fno-strict-aliasing -finline-functions -Wno-inline -Wno-parentheses -Wno-char-subscripts -fPIC -DHAVE_JPEG -DMAPNIK_USE_PROJ4 -DHAVE_PNG -DHAVE_TIFF -DBIGINT -DBOOST_REGEX_HAS_ICU -DLINUX -DMAPNIK_THREADSAFE -DNDEBUG -DHAVE_CAIRO -DHAVE_PYCAIRO -I. -Iinclude -I/usr/include/polyclipping -I/usr/include/agg2 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libxml2 -I/usr/include/gdal -I/usr/include/python2.7 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng15 -I/usr/include/libdrm -I/usr/include/pycairo bindings/python/mapnik_building_symbolizer.cpp
In file included from include/mapnik/symbolizer.hpp:29:0,
from include/mapnik/building_symbolizer.hpp:29,
from bindings/python/mapnik_building_symbolizer.cpp:26:
include/mapnik/image_compositing.hpp:74:19: error: 'comp_op_grain_merge' is not a member of 'agg'
grain_merge = agg::comp_op_grain_merge,
^
include/mapnik/image_compositing.hpp:75:21: error: 'comp_op_grain_extract' is not a member of 'agg'
grain_extract = agg::comp_op_grain_extract,
^
scons: *** [bindings/python/mapnik_building_symbolizer.os] Error 1
scons: building terminated because of errors.
error: Bad exit status from /var/tmp/rpm-tmp.kuI6KW (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.kuI6KW (%build)
Mapnik normally comes with a heavily patched version of the AGG library right there in its source tree. The Fedora build however disables that in favour of having the Mapnik-AGG patches directly in its own AGG package (because they don't like duplicating system libraries elsewhere).
You either need an AGG library for CentOS that is feature-compatible with the patched Fedora version, or you have to modify your Mapnik build to disable the "system_agg" patch (and drop the "rm -rf boost deps" from the spec file).