[R-SIG-Mac] compiling with R-3.4.0
Charles C. Berry
ccberry at ucsd.edu
Mon Jun 5 00:03:52 CEST 2017
TL;DR: I can compile C/Fortran to install packages that need
compilation, but I get loads of warnings. I must have quirks in my
setup, possibly including the need to add system header files
compatible with clang4.
Details:
I have
: R version 3.4.0 (2017-04-21) -- "You Stupid Darkness"
: macOS 10.12.5 (16F73) aka Sierra -- on an older MacBook Pro
: Xcode 7.3 (mindful of advice that version 8.0 has some gotchas)
: clang version 4.0.0 (tags/RELEASE_400/final) (in /usr/local/clang4/bin)
: gfortran reports: gcc version 6.1.0 (GCC) (in /usr/local/bin)
: PATH=/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/bin
bash-3.2$ grep -v "#" ~/.R/MakeVars
CC=/usr/local/clang4/bin/clang
CXX=/usr/local/clang4/bin/clang++
LDFLAGS=-L/usr/local/clang4/lib
CPPFLAGS=-I/usr/local/clang4/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include
bash-3.2$
I came to the CPPFLAGS setting by trial and error - noticing that
compilations generated fatal errors and complaints about not finding
<string.h> and hunting my system for it.
----
With all this packages will install, but generate lots of warnings, viz.
* installing *source* package ‘ECTC’ ...
** libs
/usr/local/clang4/bin/clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/clang4/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include -fPIC -Wall -g -O2 -c estimateCTC.c -o estimateCTC.o
In file included from estimateCTC.c:26:
In file included from ./ectc.h:1:
In file included from /Library/Frameworks/R.framework/Resources/include/R.h:55:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/stdlib.h:92:6: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if !__DARWIN_NO_LONG_LONG
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/cdefs.h:633:32: note: expanded from macro '__DARWIN_NO_LONG_LONG'
#define __DARWIN_NO_LONG_LONG (defined(__STRICT_ANSI__) \
^
[ ... ]
14 warnings generated.
/usr/local/clang4/bin/clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang4/lib -o ECTC.so estimateCTC.o init.o utils.o zmat.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/cberry/projects/bushman/ECTC.Rcheck/ECTC/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (ECTC)
---
Further, attempts to use inline::cfunction(...) will *sometimes* fail.
I recall that this depends on whether I specify #include directives
and maybe which headers I use.
Advice appreciated.
Chuck
More information about the R-SIG-Mac
mailing list