Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installation failure on MacOS Mojave #260

Open
colearendt opened this issue Mar 8, 2020 · 15 comments
Open

installation failure on MacOS Mojave #260

colearendt opened this issue Mar 8, 2020 · 15 comments

Comments

@colearendt
Copy link

colearendt commented Mar 8, 2020

Trying to install both the latest version from CRAN as well as the development version, I am getting an installation failure error:

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:42,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:29,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23,
                 from src/unix/darwin-proctitle.c:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope
  193 |  char bytes[kAuthorizationExternalFormLength];
      |       ^~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from src/unix/darwin-proctitle.c:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token
  391 | typedef void (^CGPathApplyBlock)(const CGPathElement * element);
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:393:53: error: unknown type name 'CGPathApplyBlock'
  393 | CG_EXTERN void CGPathApplyWithBlock(CGPathRef path, CGPathApplyBlock CF_NOESCAPE block)
      |                                                     ^~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:14,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h:15,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h:16,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from src/unix/darwin-proctitle.c:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h:103:15: error: expected identifier or '(' before '^' token
  103 | typedef bool (^CGPDFArrayApplierBlock)(size_t index,
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h:113:5: error: unknown type name 'CGPDFArrayApplierBlock'
  113 |     CGPDFArrayApplierBlock cg_nullable block, void * __nullable info)
      |     ^~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h:15,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h:16,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from src/unix/darwin-proctitle.c:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:116:15: error: expected identifier or '(' before '^' token
  116 | typedef bool (^CGPDFDictionaryApplierBlock)(const char * key,
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:126:5: error: unknown type name 'CGPDFDictionaryApplierBlock'; did you mean 'CGPDFDictionaryApplierFunction'?
  126 |     CGPDFDictionaryApplierBlock cg_nullable block, void * __nullable info)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     CGPDFDictionaryApplierFunction
make[1]: *** [src/unix/libuv_la-darwin-proctitle.lo] Error 1
make: *** [libuv/.libs/libuv.a] Error 2
ERROR: compilation failed for package ‘httpuv’
* removing ‘/Users/carendt/Library/R/3.4/library/httpuv’
* restoring previous ‘/Users/carendt/Library/R/3.4/library/httpuv’
Warning in install.packages :
  installation of package ‘httpuv’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/57/dxvpk1d97z3dvlxxp22d0t9m0000gn/T/RtmpP75rqj/downloaded_packages’

brew install libuv seems to have had no effect, although I'm not sure if I expected it to 😄 Unsure of where to go from here.

@wch
Copy link
Collaborator

wch commented Mar 9, 2020

Do you have a weird installation of R -- that is, something other than the .pkg file from https://cran.r-project.org/bin/macosx/ ?

Are you able to install the fs package? It also includes libuv.

httpuv includes its own copy of libuv, so I wouldn't expect brew install libuv to have an effect.

@colearendt
Copy link
Author

Interesting! I am on an older version of R (3.4.4), but it came from CRAN.

Compilation of fs failed as well 😞 Is this an effect of a weird system issue? Any ideas where to dig in?

@jcheng5
Copy link
Member

jcheng5 commented Mar 9, 2020

@colearendt What do gcc -v and g++ -v output?

@colearendt
Copy link
Author

colearendt commented Mar 9, 2020

Apologies for the delay: gcc -v

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

** Updated to include g++ -v

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@zlskidmore
Copy link

If it helps I had a similar issue, not sure which combination of items fixed it but I resolved it by:

  1. explicitly setting the compiler to clang in ~/.R/Makevars
  2. updating homebrew
  3. re-compiling Rcpp via install.packages("Rcpp", repos="https://RcppCore.github.io/drat")

system:
Mac OS 10.15.3
R-Dev 4.0.0

Note: with the new Rcpp I also had to recompile a couple of other packages, but if that's needed it should be obvious you'll see something like "unable to load shared object"

@wch
Copy link
Collaborator

wch commented Mar 25, 2020

I can confirm that I get the same error with the both the CRAN and development versions of httpuv (622c76a) and with Rcpp 1.0.4 on macOS 10.15.3 and R 3.6.1.

On my Mac, these two commands in sequence produce the error:

install.packages("Rcpp")
install.packages("httpuv", type = "source")

It appears to have been fixed by RcppCore/Rcpp#1047. So installing a newer development version of Rcpp seems to fix things.

I'm not sure why the httpuv binary package builds successfully on the CRAN Mac build machine. (Ignore the debian error in the screenshot below.)

image

My current workaround is to instal Rcpp from the RcppCore drat repo, as @zlskidmore described, but using a source package, because that seems to be necessary for my platform:

install.packages("Rcpp", repos="https://RcppCore.github.io/drat", type = "source")

install.packages("httpuv")
# OR
remotes::install_github("rstudio/httpuv")

@colearendt
Copy link
Author

colearendt commented May 3, 2020

Still having failures, even with the dev version of Rcpp. More or less the same stack 😞 :

  CC       src/unix/libuv_la-darwin-proctitle.lo
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/AuthSession.h:32,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:42,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:29,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:45,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23,
                 from src/unix/darwin-proctitle.c:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Authorization.h:193:7: error: variably modified 'bytes' at file scope
  193 |  char bytes[kAuthorizationExternalFormLength];
      |       ^~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:21,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from src/unix/darwin-proctitle.c:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:391:15: error: expected identifier or '(' before '^' token
  391 | typedef void (^CGPathApplyBlock)(const CGPathElement * element);
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPath.h:393:53: error: unknown type name 'CGPathApplyBlock'
  393 | CG_EXTERN void CGPathApplyWithBlock(CGPathRef path, CGPathApplyBlock CF_NOESCAPE block)
      |                                                     ^~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:14,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h:15,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h:16,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from src/unix/darwin-proctitle.c:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h:103:15: error: expected identifier or '(' before '^' token
  103 | typedef bool (^CGPDFArrayApplierBlock)(size_t index,
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFArray.h:113:5: error: unknown type name 'CGPDFArrayApplierBlock'
  113 |     CGPDFArrayApplierBlock cg_nullable block, void * __nullable info)
      |     ^~~~~~~~~~~~~~~~~~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFPage.h:15,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDocument.h:16,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGContext.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBitmapContext.h:9,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:11,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from src/unix/darwin-proctitle.c:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:116:15: error: expected identifier or '(' before '^' token
  116 | typedef bool (^CGPDFDictionaryApplierBlock)(const char * key,
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:126:5: error: unknown type name 'CGPDFDictionaryApplierBlock'; did you mean 'CGPDFDictionaryApplierFunction'?
  126 |     CGPDFDictionaryApplierBlock cg_nullable block, void * __nullable info)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     CGPDFDictionaryApplierFunction
make[1]: *** [src/unix/libuv_la-darwin-proctitle.lo] Error 1
make: *** [libuv/.libs/libuv.a] Error 2
ERROR: compilation failed for package ‘httpuv’
* removing ‘/Users/carendt/Library/R/3.4/library/httpuv’
* restoring previous ‘/Users/carendt/Library/R/3.4/library/httpuv’
Warning in install.packages :
  installation of package ‘httpuv’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/57/dxvpk1d97z3dvlxxp22d0t9m0000gn/T/Rtmpb73kkc/downloaded_packages’

This seems to fail on both CRAN and dev httpuv

@wch
Copy link
Collaborator

wch commented May 4, 2020

@colearendt Do you know what compiler you're using? I found some things around the internet that reference the same error when using gcc instead of clang.

You can check with:

`R CMD config CC` -v

@colearendt
Copy link
Author

Yeah, gcc is what it looks like I'm using. I have to admit most of this is greek to me - is there a standard way to switch toolchains?

✗ `R CMD config CC` -v
Using built-in specs.
COLLECT_GCC=gcc-9
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/9.2.0_3/libexec/gcc/x86_64-apple-darwin18/9.2.0/lto-wrapper
Target: x86_64-apple-darwin18
Configured with: ../configure --build=x86_64-apple-darwin18 --prefix=/usr/local/Cellar/gcc/9.2.0_3 --libdir=/usr/local/Cellar/gcc/9.2.0_3/lib/gcc/9 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-9 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 9.2.0_3' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
Thread model: posix
gcc version 9.2.0 (Homebrew GCC 9.2.0_3)

@wch
Copy link
Collaborator

wch commented May 6, 2020

It looks like you installed it with Homebrew. Maybe just tell Homebrew to uninstall that version of GCC? Do you know why you installed it in the first place?

@colearendt
Copy link
Author

colearendt commented May 6, 2020

I don't, unfortunately 😅 IIRC brew was a huge boon when I had broken compilation issues early in my mac adoption process. I am a bit reluctant to brew uninstall b/c the last time I messed w/ brew to do low level things like this, I royally destroyed my system python install haha 😛

If that's the only way, I can definitely give it a shot though! What is the "standard" user setup on a mac? I would expect brew installed stuff to be among the more common setups, but maybe that's my ignorance.

@wch
Copy link
Collaborator

wch commented May 7, 2020

I just use the XCode command line tools. I think this will ensure that they're installed, but I'm not 100% sure.

xcode-select --install

@jankowtf
Copy link

jankowtf commented Oct 13, 2021

I'm getting the same libuv error.

This is the relevant output of the build process:

[...]

                  from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35,
                 from src/unix/darwin-proctitle.c:34:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:116:15: error: expected identifier or ‘(’ before ‘^’ token
  116 | typedef bool (^CGPDFDictionaryApplierBlock)(const char * key,
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGPDFDictionary.h:126:5: error: unknown type name ‘CGPDFDictionaryApplierBlock’; did you mean ‘CGPDFDictionaryApplierFunction’?
  126 |     CGPDFDictionaryApplierBlock cg_nullable block, void * __nullable info)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |     CGPDFDictionaryApplierFunction
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h:23,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:39,
                 from src/unix/darwin-proctitle.c:34:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTFontManager.h:379:34: error: expected ‘)’ before ‘^’ token
  379 |         bool                    (^ _Nullable registrationHandler)(CFArrayRef errors, bool done) ) CT_AVAILABLE(ios(13.0)) API_UNAVAILABLE(macos, watchos, tvos);
      |                                  ^
      |                                  )
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/ImageIO.framework/Headers/ImageIO.h:20,
                 from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:47,
                 from src/unix/darwin-proctitle.c:34:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/ImageIO.framework/Headers/CGImageAnimation.h:42:15: error: expected identifier or ‘(’ before ‘^’ token
   42 | typedef void (^CGImageSourceAnimationBlock)(size_t index, CGImageRef image, bool* stop);
      |               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/ImageIO.framework/Headers/CGImageAnimation.h:50:107: error: unknown type name ‘CGImageSourceAnimationBlock’
   50 | IMAGEIO_EXTERN OSStatus CGAnimateImageAtURLWithBlock(CFURLRef url, CFDictionaryRef _iio_Nullable options, CGImageSourceAnimationBlock block) IMAGEIO_AVAILABLE_STARTING(10.15, 13.0);
      |                                                                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/ImageIO.framework/Headers/CGImageAnimation.h:58:108: error: unknown type name ‘CGImageSourceAnimationBlock’
   58 | IMAGEIO_EXTERN OSStatus CGAnimateImageDataWithBlock(CFDataRef data, CFDictionaryRef _iio_Nullable options, CGImageSourceAnimationBlock block) IMAGEIO_AVAILABLE_STARTING(10.15, 13.0);
      |                                                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [src/unix/libuv_la-darwin-proctitle.lo] Error 1
make: *** [libuv/.libs/libuv.a] Error 2
ERROR: compilation failed for package ‘httpuv’

As I'm assuming that the choice of gcc, gfortran etc. is absolutely crucial here:

I just had to learn/solve the hard way how to compile packages on macOS ARM and this post details the troubleshooting that eventually succeeded for compiling igraph.

My general setup

  • Big Sur 11.6
  • Homebrew 3.2.14
  • But gfortran was NOT installed via brew install gcc but instead as instructed on https://mac.r-project.org/tools/ (this is the particular ARM version I'm using)
  • libuv installed via brew install --HEAD libuv as outlined here. However, I had not clue which flag I had to set for ARM and/or if this is even relevant ("Make sure that you specify the architecture you wish to build for in the "ARCHS" flag. You can specify more than one by delimiting with a space (e.g. "x86_64 i386").")
  • Xcode 13
  • R 4.1.1

Session info

R version 4.1.1 (2021-08-10)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.1 tools_4.1.1    yaml_2.2.1     config_0.3.1   renv_0.14.0   

My current ~/.R/Makevars

After lots of trial and error (see attached troubleshooting version) this seems to work for igraph:

CC = /usr/local/gfortran/bin/gcc                                       # '[...]/bin/gcc-11' didn't exist on my machine
CXX = /usr/local/gfortran/bin/g++                                    # '[...]/bin/g++-11' didn't exist on my machine
FC = /usr/local/gfortran/bin/gfortran                               # '[...]/gfortran-11' didn't exist on my machine
F77 = /usr/local/gfortran/bin/gfortran                             # '[...]/gfortran-11' didn't exist on my machine
FLIBS = -L//usr/local/gfortran/lib/gcc11 -lgfortran -lm  # 'ld: library not found for -lquadmath'

@jcheng5
Copy link
Member

jcheng5 commented Oct 13, 2021

I'm out of my depth here and don't have a macOS ARM machine to test with, but... did you add /usr/local/gfortran/bin to the PATH, and if so, did you add it to the beginning or the end? And, is your R 4.1.1 the CRAN binary distribution?

@jankowtf
Copy link

jankowtf commented Oct 14, 2021

@jcheng5 thanks for taking the time

Re: gfortran

This is the current state of my ~/.zshrc file (apologies for the rather wild content, I'm still trying to find my way around macOS coming from Linux and thus lots of trial and error and commenting out involved 😬)

PATH=/usr/bin:/bin:/usr/sbin:/sbin
export PATH

# [LEGACY?] Add custom, local installations to PATH
#PATH=/usr/local/bin:/usr/local/sbin:"$PATH"

# [LEGACY?] Add MacPorts to PATH
#PATH=/opt/local/bin:/opt/local/sbin:"$PATH"

# Add Homebrew
eval "$(/opt/homebrew/bin/brew shellenv)"

# [NEEDED?] Added because of https://docs.python-guide.org/starting/install3/osx/ 
# (not really sure why)
#export PATH="/usr/local/opt/python/libexec/bin:"$PATH"

# Java
#export PATH="/opt/homebrew/opt/openjdk/bin:"$PATH"

# gfortran
#export PATH=$PATH:/usr/local/gfortran/bin
#PATH=/opt/homebrew/bin:"$PATH"
export PATH=/usr/local/gfortran/bin:"$PATH"

# Using aliases
alias python=/opt/homebrew/bin/python3
alias pip=/opt/homebrew/bin/pip3

#alias gfortran-11=/opt/homebrew/bin/gfortran-11

# Docker
export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0

# R
PATH=/Library/Frameworks/R.framework/Resources:"$PATH"

Re: R binary

I installed R via the ARM (nightly build) binary from https://mac.r-project.org/#nightly (this specific pkg file: R-4.1-branch, 4.1.1 Patched (2021/09/05, r80862)). So definitely not installed via brew install r let alone having it compiled myself 🙂

Next thing I tried

Running R CMD install --build httpuv doesn't even get me to the state where an config.log file is written, apparently 🙈

jankothyson@macbook Downloads % R CMD install --build httpuv
* installing to library ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library’
* installing *source* package ‘httpuv’ ...
** package ‘httpuv’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -Ilibuv/include -pthread -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/later/include' -I/opt/R/arm64/include   -DSTRICT_R_HEADERS -fPIC  -falign-functions=64 -Wall -g -O2  -c RcppExports-legacy.cpp -o RcppExports-legacy.o
In file included from RcppExports-legacy.cpp:23:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:66:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:321:9: error: no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:322:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:9: error: no member named 'isfinite' in the global namespace
using ::isfinite;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:9: error: no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:9: error: no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:326:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:327:9: error: no member named 'isgreater' in the global namespace
using ::isgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:328:9: error: no member named 'isgreaterequal' in the global namespace
using ::isgreaterequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:329:9: error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:330:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:331:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:332:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:333:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:339:9: error: no member named 'abs' in the global namespace; did you mean 'fabs'?
using ::abs;
      ~~^
/usr/local/include/math.h:417:15: note: 'fabs' declared here
extern double fabs(double);
              ^
In file included from RcppExports-legacy.cpp:23:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp/r/headers.h:66:
In file included from /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:644:26: error: no template named 'numeric_limits'
    bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:644:60: error: no template named 'numeric_limits'
    bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
                                                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:645:18: error: no template named 'numeric_limits'
    int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:645:50: error: no template named 'numeric_limits'
    int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
                                                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:650:17: error: no template named 'numeric_limits'
  static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
^[[A20 errors generated.
make: *** [RcppExports-legacy.o] Error 1
ERROR: compilation failed for package ‘httpuv’

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants