[R-SIG-Mac] unable to install from source packages needing compiled C code

Adrian Dușa du@@@@dr|@n @end|ng |rom gm@||@com
Thu Dec 2 22:12:31 CET 2021


Thank you Simon,

I have the official Apple CLT, but not the full Xcode. If needed I can
install that as well, with a difference of about 10GB more space
getting used.
This is what I get:

$ xcode-select -p
/Library/Developer/CommandLineTools

$ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

$ which clang
/usr/local/opt/llvm/bin/clang

$ clang --version
clang version 11.1.0
Target: x86_64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

There is a difference in clang, which I remember to have installed to test
various settings for the compiled code in the package QCA.
This error is about package admisc, which gave the following output:

 $ R CMD INSTALL admisc_0.20-5.tar.gz
* installing to library ‘/Users/dusadrian/Library/R/x86_64/4.1/library’
* installing *source* package ‘admisc’ ...
** using staged installation
** libs
clang -mmacosx-version-min=10.13
-I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
-I/usr/local/include   -fPIC  -g -O1 -c admisc.c -o admisc.o
In file included from admisc.c:1:
/Library/Frameworks/R.framework/Resources/include/R.h:55:11: fatal error:
'stdlib.h' file not found
# include <stdlib.h> /* Not used by R itself, but widely assumed in
packages */
          ^~~~~~~~~~
1 error generated.
make: *** [admisc.o] Error 1
ERROR: compilation failed for package ‘admisc’
* removing ‘/Users/dusadrian/Library/R/x86_64/4.1/library/admisc’
* restoring previous ‘/Users/dusadrian/Library/R/x86_64/4.1/library/admisc’


In the meantime I've tried various things (like copying stdlib.h from
somewhere else in /usr/local/include/, but to no avail since it now
complains about

* installing to library ‘/Users/dusadrian/Library/R/x86_64/4.1/library’
* installing *source* package ‘admisc’ ...
** using staged installation
** libs
clang -mmacosx-version-min=10.13
-I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
-I/usr/local/include   -fPIC  -g -O1 -c admisc.c -o admisc.o
In file included from admisc.c:1:
In file included from
/Library/Frameworks/R.framework/Resources/include/R.h:55:
In file included from /usr/local/include/stdlib.h:64:
In file included from /usr/local/include/_types.h:27:
/usr/local/include/sys/_types.h:33:10: fatal error: 'machine/_types.h' file
not found
#include <machine/_types.h>
         ^~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [admisc.o] Error 1
ERROR: compilation failed for package ‘admisc’
* removing ‘/Users/dusadrian/Library/R/x86_64/4.1/library/admisc’
* restoring previous ‘/Users/dusadrian/Library/R/x86_64/4.1/library/admisc’


I have tried both:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

as well as downloading the CLT from developer.apple.com and installing from
the corresponding .dmg file, same issue.

It looks like it misses the headers, for some reason.
Best,
Adrian


On Thu, 2 Dec 2021 at 22:57, Simon Urbanek <simon.urbanek using r-project.org>
wrote:

>
> Adrian,
>
> please check your tools. The error looks like you may be mixing different
> compilers. So, first check that you are using Xcode tools (command line
> tools or Xcode itself doesn't matter) and not Homebrew or other non-Apple
> compilers as they need additional configuration. For example:
>
> $ xcode-select -p
> /Applications/Xcode.app/Contents/Developer
>
> $ xcrun --show-sdk-path
>
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
>
> $ which clang
> /usr/bin/clang
>
> $ clang --version
> Apple clang version 12.0.5 (clang-1205.0.22.11)
> Target: arm64-apple-darwin20.6.0
> Thread model: posix
> InstalledDir:
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>
>
> If in doubt, you can always use
> sudo xcode-select --install
> to make sure you have the tools.
>
> Second, make sure you don't have old overrides in ~/.R such as Makeconf or
> similar. Remove ~/.R if needed.
>
> Finally, if you still have issues, please post the full output since you
> didn't give us any details whatsoever so we can only guess.
>
> Cheers,
> Simon
>
>
>
> > On Dec 3, 2021, at 12:22 AM, Adrian Dușa <dusa.adrian using gmail.com> wrote:
> >
> > Dear All,
> >
> > I am not sure when this started, presumably after upgrading my OS to
> > Monterey 12.0.1
> > With packages needing compilation, under a Terminal I get this error:
> >
> > /Library/Frameworks/R.framework/Resources/include/R.h:55:11: fatal error:
> > 'stdlib.h' file not found
> > # include <stdlib.h> /* Not used by R itself, but widely assumed in
> > packages */
> >          ^~~~~~~~~~
> > 1 error generated.
> >
> > I've searched over the Internet, the most common problem is the absence
> of
> > the Command Line Tools, but I do have those installed.
> >
> > An old topic mentioned installing:
> >
> /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.
> > pkg
> >
> > However the /Library/Developer/CommandLineTools/ directory does not hold
> a
> > "Packages" subdirectory.
> >
> > Does anyone else have this problem?
> >
> > Thanks very much in advance for any hint,
> > Adrian
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-SIG-Mac mailing list
> > R-SIG-Mac using r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>

	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list