Can't compile C program on a Mac after upgrade to Mojave

前端 未结 15 911
陌清茗
陌清茗 2020-11-22 06:58

I have used the gcc command on the terminal to compile C programs but all of a sudden, after an update to my Mac\'s OS (to macOS 10.14 Mojave, and XCode 10.0), I started rec

15条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 07:34

    I tried almost all the posted solutions and nothing worked for me. I use Mojave OS (10.14.6) and what finally worked for me (after removing and re-installing Xcode and CLTs and SDK headers):

    1. Install Clang v8 from https://cran.r-project.org/bin/macosx/tools/
    2. Modify the following lines from ~/.R/Makevars file
    CC=/usr/local/opt/llvm/bin/clang -fopenmp
    CXX=/usr/local/opt/llvm/bin/clang++
    

    with

    CC=/usr/local/clang8/bin/clang -fopenmp
    CXX=/usr/local/clang8/bin/clang++
    

    Now R packages that rely on C compilers install successfully

提交回复
热议问题