Why won’t RStudio on my MacOS install packages through GCC?

I have been trying to install the “kernlab” package as I am trying to learn machine learning and need it for Support Vector Machine models. I have GCC-13 downloaded through Homebrew, and it is stored in /opt/homebrew/opt (which I know is a non-typical location for it to download to). I have also made my own Makevars file aligning with Rodrigo Zepeda’s blog (https://rodzepeda.medium.com/fixing-macos-catalinas-mess-when-trying-to-compile-almost-any-r-package-d94a063d64eb). I do have MacOS Sonoma 14.4.1 (the newest version), RStudio/2024.04.0+735 and gcc-13. However, when I go to install the package, I get this error:

`
> install.packages("kernlab")
Warning in install.packages :
  unable to access index for repository http://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'http://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Package which is only available in source form,
  and may need compilation of C/C++/Fortran:
  ‘kernlab’
Do you want to attempt to install these from sources? (Yes/no/cancel) Y
installing the source package ‘kernlab’

trying URL 'http://cran.rstudio.com/src/contrib/kernlab_0.9-32.tar.gz'
Content type 'application/x-gzip' length 1215773 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

* installing *source* package ‘kernlab’ ...
** package ‘kernlab’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/opt/homebrew/opt/llvm/bin/clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/homebrew/opt/icu4c/include -I/opt/homebrew/opt/libxml2/include -I/opt/homebrew/opt/[email protected]/include -I/opt/homebrew/opt/libpng/include/ -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/llvm/include -I/opt/homebrew/opt/openblas/include -I/opt/homebrew/opt/lapack/include -I/opt/homebrew/opt/tcl-tk/include -I/opt/homebrew/opt/udunits/include/ -I/opt/homebrew/opt/expat/include -I/opt/homebrew/opt/krb5/include -I/opt/homebrew/opt/libpq/include -I/opt/homebrew/opt/qt@5/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c brweight.cpp -o brweight.o
In file included from brweight.cpp:41:
In file included from ./brweight.h:42:
In file included from ./errorcode.h:42:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/iostream:43:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/ios:223:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__locale:15:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__memory/shared_ptr.h:24:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__memory/allocation_guard.h:15:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__memory/allocator_traits.h:14:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__memory/construct_at.h:23:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/new:364:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/cstdlib:87:
/opt/homebrew/opt/llvm/bin/../include/c++/v1/stdlib.h:145:30: error: unknown type name 'ldiv_t'
  145 | inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); }
      |                              ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/stdlib.h:145:82: error: no member named 'ldiv' in the global namespace
  145 | inline _LIBCPP_HIDE_FROM_ABI ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); }
      |                                                                                ~~^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/stdlib.h:147:30: error: unknown type name 'lldiv_t'
  147 | inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x, long long __y) _NOEXCEPT { return ::lldiv(__x, __y); }
      |                              ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/stdlib.h:147:93: error: no member named 'lldiv' in the global namespace
  147 | inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x, long long __y) _NOEXCEPT { return ::lldiv(__x, __y); }
      |                                                                                           ~~^
In file included from brweight.cpp:41:
In file included from ./brweight.h:42:
In file included from ./errorcode.h:42:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/iostream:43:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/ios:223:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__locale:15:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__memory/shared_ptr.h:33:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__memory/unique_ptr.h:17:
/opt/homebrew/opt/llvm/bin/../include/c++/v1/__functional/hash.h:40:8: error: reference to unresolved using declaration
   40 |   std::memcpy(&__r, __p, sizeof(__r));
      |        ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/cstring:80:1: note: using declaration annotated with 'using_if_exists' here
   80 | using ::memcpy _LIBCPP_USING_IF_EXISTS;
      | ^
In file included from brweight.cpp:41:
In file included from ./brweight.h:42:
In file included from ./errorcode.h:42:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/iostream:43:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/ios:223:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__locale:16:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__mutex/once_flag.h:21:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/tuple:272:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/compare:145:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__compare/compare_partial_order_fallback.h:13:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__compare/partial_order.h:14:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__compare/weak_order.h:14:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/__compare/strong_order.h:20:
In file included from /opt/homebrew/opt/llvm/bin/../include/c++/v1/cmath:319:
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:392:31: error: use of undeclared identifier 'FP_NAN'
  392 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                               ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:392:39: error: use of undeclared identifier 'FP_INFINITE'
  392 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                       ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:392:52: error: use of undeclared identifier 'FP_NORMAL'
  392 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                                    ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:392:63: error: use of undeclared identifier 'FP_SUBNORMAL'
  392 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                                               ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:392:77: error: use of undeclared identifier 'FP_ZERO'
  392 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                                                             ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:397:31: error: use of undeclared identifier 'FP_NAN'
  397 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                               ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:397:39: error: use of undeclared identifier 'FP_INFINITE'
  397 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                       ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:397:52: error: use of undeclared identifier 'FP_NORMAL'
  397 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                                    ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:397:63: error: use of undeclared identifier 'FP_SUBNORMAL'
  397 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                                               ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:397:77: error: use of undeclared identifier 'FP_ZERO'
  397 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                                                             ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:402:31: error: use of undeclared identifier 'FP_NAN'
  402 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                               ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:402:39: error: use of undeclared identifier 'FP_INFINITE'
  402 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                       ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:402:52: error: use of undeclared identifier 'FP_NORMAL'
  402 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                                    ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/math.h:402:63: error: use of undeclared identifier 'FP_SUBNORMAL'
  402 |   return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
      |                                                               ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [brweight.o] Error 1
ERROR: compilation failed for package ‘kernlab’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/kernlab’
Warning in install.packages :
  installation of package ‘kernlab’ had non-zero exit status`

So far I have not been able to find any information on how to fix this.

So far, I have uninstalled and reinstalled gcc using Homebrew. I also tried to install gcc without Homebrew but it wasn’t very successful for me as it resulted in even more errors and more confusion over the files in Terminal. When I reinstalled gcc and followed along a second time with Rodrigo’s forum, I went back to the same errors I was having (as above).

It is my first time asking a question in an online forum, so if there is anything I have missed please don’t hesitate to let me know. If you need more information that is fine too. I just really want to get this solved!

New contributor

Hayley Irving is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật