I’m trying to install an R package (specifically tess3r) using devtools. I keep running into this ‘iterator’ file not found error. I am using R version 4.3.1 (I know it’s not the latest version, I’ve just been lazy about updating and packages seem to work fine) and am running it on macos.
I’ve tried looking at posts where people have run into similar issues, and for the most part it seems to be an issue with xcode for macos. The solution that always seems to work is simply “just update xcode” and everything seems to work after that. I tried updating both my macos to the latest sequoia 15.7.2 and xcode to the latest version, and I am still getting the same error. Here is the R output for reference:
* installing *source* package ‘tess3r’ ...
** using staged installation
** libs
using C++ compiler: ‘Apple clang version 17.0.0 (clang-1700.4.4.1)’
using SDK: ‘MacOSX26.1.sdk’
clang++ -arch x86_64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/RcppEigen/include' -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/RcppEigen/include/RcppEigen.h:25:
/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/RcppEigen/include/RcppEigenForward.h:25:10: fatal error: 'iterator' file not found
25 | #include <iterator>
| ^~~~~~~~~~
1 error generated.
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘tess3r’
* removing ‘/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/tess3r’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/5g/bpbtlbnn6n9_ptfrqwyy_wkh0000gn/T//RtmpKGQ9y5/filebe51f8b8c73/tess3r_1.1.0.tar.gz’ had non-zero exit status
Any help would be appreciated. I have a feeling that the issue has something to do with C++, but I have no idea.