Skip to content
Prev 11777 / 12125 Next

[R-pkg-devel] Misusing CFLAGS?

Pepijn,

the comment points out three somewhat separate issues:

a) recommending brew is generally not a good idea especially for something as lightweight (brew tends to cause conflicts with the system) - not that it prevents people from doing it ;)

b) the test doesn?t log the compiler call, so it doesn't show the actual compiler invocation with flags - which is crucial to be able to say where the problem lies on error

c) the test uses incomplete flags - it fails to include CXXFLAGS in the test (I assume that is the CFLAGS comment, but if not sure you can ask for clarification).

Looking at the file I see another problem as well - this fallback is most certainly wrong:

  for pre in /usr /usr/X11 /usr/X11R6 /usr/local /opt /opt/R/arm64 opt/R/x86_64 /sw; do

I don?t think you should use headers from another platform and/or hard-code them (I?m looking the the two odd "/opt/R/arm64" and "opt/R/x86_64" entires). Also unclear why the latter is missing leading slash? At the moment you can get away with something like /opt/R/$(uname -m), but technically the architecture may be defined by ${R_ARCH} instead, although we avoided using it recently, because people often ignore it and then it causes issues. (I principle this is moot, since if you have any of those, then they should be on the PATH so likely it is a user error to start with).

Cheers,
Simon