1

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.

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

1 Answer 1

2

You seemed to have Xcode Command Line Tool installed first. Then, after Xcode was installed, the SDK path was not updated. See the actual path with the command xcode-select -p. If it points to /Library/Developer/CommandLineTools, then this should fix that issue

xcode-select --switch /Applications/Xcode.app/Contents/Developer
Sign up to request clarification or add additional context in comments.

2 Comments

Ok thanks! I was able to solve the issue. I did not actually have Xcode installed on my mac even though I thought I did. I had issues downloading Xcode from the app store, but I was able to follow this tutorial freecodecamp.org/news/how-to-download-and-install-xcode and download it directly from apple’s developer website. After that, your suggestions worked (I just needed to add sudo before xcode-select --switch)
That is fascinating. Thank you for the valuable information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.