[R-SIG-Mac] clang: error: unsupported option '-fopenmp'

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Wed May 15 04:48:19 CEST 2019


Just for completeness - this is in R for Mac FAQ 10.15
https://mac.r-project.org/bin/macosx/RMacOSX-FAQ.html
and in detail in R-admin 6.3.2 
https://mac.r-project.org/man/R-admin.html#macOS-packages

Cheers,
Simon


> On May 7, 2019, at 13:20, Spencer Graves <spencer.graves using prodsyse.com> wrote:
> 
> Adding .Renviron as you described solved the problem.  Thanks. Spencer
> 
> 
> On 2019-05-07 11:18, Balamuta, James Joseph wrote:
>> Greetings and Salutations Spencer,
>> 
>> Modifying the path traditionally was done in `~/.R/Makevars` by setting the implicit variables: `CXX`, `CXX11` , ...
>> I've found a better approach is to modify the `~/.Renviron` file. Since `.Renviron` is a "dot file", macOS will hide it by default.
>> 
>> You can view the .Renviron file within Finder if you enable showing dot files by using the keyboard shortcut: CMD + SHIFT + .
>> 
>> From terminal, the file must be created using:
>> 
>> touch ~/.Renviron
>> vi ~/.Renviron
>> 
>> Inside the file, add a line with:
>> 
>> PATH="/usr/local/clang7/bin:${PATH}"
>> 
>> Once done, leave `vi` by pressing the ESC key and, then, typing ":wq" in the prompt.
>> 
>> Regarding the gfortran uninstall, this is because there were old artifacts lying around on some users systems.
>> It was easier to clean the system and, then, install the toolchain relative to R.
>> 
>> Sincerely,
>> 
>> JJB
>> 
>> 
>> On 5/7/19, 10:24 AM, "Spencer Graves" <spencer.graves using prodsyse.com> wrote:
>> 
>>     Hi, JJB:
>>                      Thanks.  Upon reading more carefully
>>     "https://cran.r-project.org/bin/macosx/tools/", I see that I need
>>     clang7, not the clang8 that I previously installed.  I downloaded and
>>     installed it, but I'm confused about how to modify my path, and I'm
>>     still getting the same error as before without that.  I don't recall
>>     ever modifying a path on a Mac before, and I don't find the
>>     "~/.Renviron" file you mentioned.
>>                      Thanks,
>>            Spencer Graves
>>               p.s.  I'm also a little spooked by your instructions to remove gfortran,
>>     because it might be used by something else.  I don't find
>>     "/usr/local/gfortran" that you mention, but I do find files (not
>>     folders) "/usr/local/bin/gfortran" and "/usr/local/bin/gfortran-4.8".
>>     ??? Thanks again.
>>               On 2019-05-07 08:56, Balamuta, James Joseph wrote:
>>     > Greetings and Salutations All,
>>     >
>>     > For R 3.6.x, you want:
>>     >
>>     > https://cran.r-project.org/bin/macosx/tools/clang-7.0.0.pkg
>>     >
>>     > To let R know about the complier, we need to modify the ~/.Renviron. You may need to create the file by running in Terminal (Applications -> Utilities):
>>     >
>>     > touch ~/.Renviron
>>     >
>>     > Then, inside of ~/.Renviron add:
>>     >
>>     > PATH="/usr/local/clang7/bin:${PATH}"
>>     >
>>     > More details can be found here (disclaimer: I wrote it):
>>     >
>>     > http://thecoatlessprofessor.com/programming/r-compiler-tools-for-rcpp-on-macos/
>>     >
>>     > I'm working on updating a bash-script installer to autodetect and install the appropriate toolchain based on the installed version of R here:
>>     >
>>     > https://github.com/rmacoslib/r-macos-rtools
>>     >
>>     > I'll update the list-serv when I've released a new version for R 3.6.x.
>>     >
>>     > Sincerely,
>>     >
>>     > JJB
>>     >
>>     >
>>     >
>>     > On 5/7/19, 8:34 AM, "R-SIG-Mac on behalf of Spencer Graves" <r-sig-mac-bounces using r-project.org on behalf of spencer.graves using prodsyse.com> wrote:
>>     >
>>     >      Hi, Bryon et al.:
>>     >
>>     >
>>     >             Thanks.  I did that and got virtually the same response ending
>>     >      with "clang: error: unsupported option '-fopenmp'".
>>     >
>>     >
>>     >             Specifically, I started by looking for a "clang" subdirectory
>>     >      under "/usr/local/", which is where clang-8.0.0.pkg from
>>     >      "https://cran.r-project.org/bin/macosx/tools/" installed.  I did not
>>     >      find one.  I then downloaded and installed Clang8, and it appeared in
>>     >      directory "/usr/local/clang8".  I then rebooted and tried "R CMD build
>>     >      bssm" as before with the following results:
>>     >
>>     >
>>     >       > R CMD build bssm
>>     >      * checking for file ‘bssm/DESCRIPTION’ ... OK
>>     >      * preparing ‘bssm’:
>>     >      * checking DESCRIPTION meta-information ... OK
>>     >      * cleaning src
>>     >      * installing the package to build vignettes
>>     >             -----------------------------------
>>     >      * installing *source* package ‘bssm’ ...
>>     >      ** using staged installation
>>     >      ** libs
>>     >      clang++ -std=gnu++11
>>     >      -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
>>     >      -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include"
>>     >      -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include"
>>     >      -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo/include"
>>     >      -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ramcmc/include"
>>     >      -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sitmo/include"
>>     >      -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
>>     >      -I/usr/local/include -fopenmp -fPIC  -Wall -g -O2  -c R_approx.cpp -o
>>     >      R_approx.o
>>     >      clang: error: unsupported option '-fopenmp'
>>     >      make: *** [R_approx.o] Error 1
>>     >      ERROR: compilation failed for package ‘bssm’
>>     >      * removing
>>     >      ‘/private/var/folders/mh/mrm_14nx19g13lsnj9zmvwjr0000gn/T/Rtmp7TLdXk/Rinst6842b1d5fb3/bssm’
>>     >             -----------------------------------
>>     >      ERROR: package installation failed
>>     >
>>     >
>>     >             Suggestions?
>>     >             Thanks,
>>     >             Spencer
>>     >
>>     >
>>     >      On 2019-05-06 18:19, Byron Ellis wrote:
>>     >      > Hi Spencer,
>>     >      >
>>     >      > You'll want to get the compiler tools from
>>     >      > https://cran.r-project.org/bin/macosx/tools/ to build properly.
>>     >      >
>>     >      > Best,
>>     >      > B
>>     >      >
>>     >      >
>>     >      >
>>     >      > On Mon, May 6, 2019 at 4:17 PM Spencer Graves
>>     >      > <spencer.graves using prodsyse.com <mailto:spencer.graves using prodsyse.com>> wrote:
>>     >      >
>>     >      >     Hello, All:
>>     >      >
>>     >      >
>>     >      >            I'm getting "clang: error: unsupported option '-fopenmp'" when
>>     >      >     trying to build "https://github.com/helske/bssm" under macOS 10.14.14
>>     >      >     with R 3.6.0;  see below.
>>     >      >
>>     >      >
>>     >      >            What do you suggest?
>>     >      >
>>     >      >
>>     >      >            Thanks,
>>     >      >            Spencer Graves
>>     >      >
>>     >      >
>>     >      >     p.s.  Helske told me he thought my compiler was out of date. However,
>>     >      >     I've so far been unable to find instructions that are sufficiently
>>     >      >     current to convince me I might not do more harm than good
>>     >      >     following them.
>>     >      >
>>     >      >
>>     >      >     > R CMD build bssm
>>     >      >     * checking for file ‘bssm/DESCRIPTION’ ... OK
>>     >      >     * preparing ‘bssm’:
>>     >      >     * checking DESCRIPTION meta-information ... OK
>>     >      >     * cleaning src
>>     >      >     * installing the package to build vignettes
>>     >      >            -----------------------------------
>>     >      >     * installing *source* package ‘bssm’ ...
>>     >      >     ** using staged installation
>>     >      >     ** libs
>>     >      >     clang++ -std=gnu++11
>>     >      >     -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG
>>     >      >     -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/BH/include"
>>     >      >
>>     >      >     -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include"
>>     >      >
>>     >      >     -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo/include"
>>     >      >
>>     >      >     -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/ramcmc/include"
>>     >      >
>>     >      >     -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/sitmo/include"
>>     >      >
>>     >      >     -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
>>     >      >     -I/usr/local/include -fopenmp -fPIC  -Wall -g -O2  -c R_approx.cpp -o
>>     >      >     R_approx.o
>>     >      >     clang: error: unsupported option '-fopenmp'
>>     >      >     make: *** [R_approx.o] Error 1
>>     >      >     ERROR: compilation failed for package ‘bssm’
>>     >      >     * removing
>>     >      >     ‘/private/var/folders/mh/mrm_14nx19g13lsnj9zmvwjr0000gn/T/RtmppA2gBg/Rinst24427c5cbfeb/bssm’
>>     >      >            -----------------------------------
>>     >      >     ERROR: package installation failed
>>     >      >
>>     >      >     _______________________________________________
>>     >      >     R-SIG-Mac mailing list
>>     >      >     R-SIG-Mac using r-project.org <mailto:R-SIG-Mac using r-project.org>
>>     >      >     https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>     >      >
>>     >      >
>>     >      >
>>     >      > --
>>     >      > Byron Ellis (byron.ellis using gmail.com <mailto:byron.ellis using gmail.com>)
>>     >      > "Oook" -- The Librarian
>>     >
>>     >
>>     >      	[[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
> 



More information about the R-SIG-Mac mailing list