Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
clang-7:错误:macOS Big-Sur的链接器命令失败,退出代码为1_R_Macos_Clang_Macos Big Sur - Fatal编程技术网

clang-7:错误:macOS Big-Sur的链接器命令失败,退出代码为1

clang-7:错误:macOS Big-Sur的链接器命令失败,退出代码为1,r,macos,clang,macos-big-sur,R,Macos,Clang,Macos Big Sur,自从Big Sur以来,在macOS中安装需要编译的R软件包已经失败了。这里就是这样一个例子 > install.packages('nlme') There is a binary version available but the source version is later: binary source needs_compilation nlme 3.1-150 3.1-151 TRUE Do you want to install

自从Big Sur以来,在macOS中安装需要编译的R软件包已经失败了。这里就是这样一个例子

> install.packages('nlme')

  There is a binary version available but the source version is later:
      binary  source needs_compilation
nlme 3.1-150 3.1-151              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘nlme’

trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-151.tar.gz'
Content type 'application/x-gzip' length 805592 bytes (786 KB)
==================================================
downloaded 786 KB

* installing *source* package ‘nlme’ ...
** package ‘nlme’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
"gfortran-4.8" -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c chol.f -o chol.o
gfortran-4.8: warning: couldn’t understand kern.osversion ‘20.1.0
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c corStruct.c -o corStruct.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c gnls.c -o gnls.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c init.c -o init.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c matrix.c -o matrix.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c nlOptimizer.c -o nlOptimizer.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c nlme.c -o nlme.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c nlmefit.c -o nlmefit.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c pdMat.c -o pdMat.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c pythag.c -o pythag.o
"gfortran-4.8" -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c rs.f -o rs.o
gfortran-4.8: warning: couldn’t understand kern.osversion ‘20.1.0
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o nlme.so chol.o corStruct.o gnls.o init.o matrix.o nlOptimizer.o nlme.o nlmefit.o pdMat.o pythag.o rs.o  -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: framework not found CoreFoundation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nlme.so] Error 1
ERROR: compilation failed for package ‘nlme’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/nlme’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/nlme’
Warning in install.packages :
  installation of package ‘nlme’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/_3/b8whcf8d1bb8w_lr2rrscb5m0000gp/T/RtmpWCjwfs/downloaded_packages’


我已尝试重新安装xcode和命令行工具,并完成了Brew update+升级。任何建议都值得赞赏。

这是一个挑战,但以下是我在MacOS Big Sur上从源代码处编译R包时使用的步骤:

  • 重新安装xcode命令行工具
  • (如果说软件更新是“最新的”,就不要相信——他撒谎——
    brew博士说我的版本实际上是旧的)

  • 通过自制()安装gcc和llvm,或者,如果已经安装了gcc/llvm,请跳到下一步
  • 如果您已经通过自制安装了gcc&llvm:
  • 将一些头链接到/usr/local/include
  • 编辑您的
    ~/.R/Makevars
    文件(如果您的
    ~/.R/
    目录中没有名为
    Makevars
    的文件,请创建该文件),并仅包括以下行:
  • 在R/Rstudio中从源代码编译包

  • 刚刚发现了这个(被忽略的)问题,它看起来与许多其他人在相同的问题上绊倒有关。谢谢@IRTFM。虽然很有趣!与R-MAC-sig邮件列表通信可能更好。我也遇到了同样的问题。我试过
    r-macos-rtools
    ,但安装在Big Sur上不起作用。下面是一些关于如何修复安装的信息,尽管我无法:谢谢Jared,我得到了
    $git-C”/usr/local/Homebrew/Library/Taps/Homebrew/Homebrew core“fetch--unshall致命:--unshall在一个完整的存储库上没有意义
    知道为什么吗?Brew修复了,您的工作流修复了此安装。非常感谢:)经过所有步骤并重新启动后,我得到了
    ld:frameworknotfoundcorefoundation
    。为R/Mac安装全新的gfortran对我很有用:@speleo,就是这样!从那个链接安装gfortran为我解决了这个问题。我有点犹豫,因为回购协议只是由一位研究人员提出的,但它让我的R再次发挥作用,非常感谢!实际上,安装gfortran链接还有另一个建议。也就是说,要使用brew随gcc提供的gfortran版本,但我认为这需要与上面提供的不同的makevars行。请参阅此链接:
    sudo rm -rf /Library/Developer/CommandLineTools
    sudo xcode-select --install
    
    # WARNING: This can take several hours
    brew install gcc
    brew install llvm
    
    brew cleanup
    brew update
    brew upgrade
    brew reinstall gcc
    brew reinstall llvm
    
    sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/
    
    # I believe you can safely ignore warnings like this:
    #ln: /usr/local/include//tcl.h: File exists
    #ln: /usr/local/include//tclDecls.h: File exists
    #ln: /usr/local/include//tclPlatDecls.h: File exists
    #ln: /usr/local/include//tclTomMath.h: File exists
    #ln: /usr/local/include//tclTomMathDecls.h: File exists
    #ln: /usr/local/include//tk.h: File exists
    #ln: /usr/local/include//tkDecls.h: File exists
    #ln: /usr/local/include//tkPlatDecls.h: File exists
    
    FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin19/10.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
    CXX1X=/usr/local/gfortran/bin/g++
    CXX98=/usr/local/gfortran/bin/g++
    CXX11=/usr/local/gfortran/bin/g++
    CXX14=/usr/local/gfortran/bin/g++
    CXX17=/usr/local/gfortran/bin/g++
    
    LLVM_LOC = /usr/local/opt/llvm
    CC=/usr/local/gfortran/bin/gcc -fopenmp
    CXX=/usr/local/gfortran/bin/g++ -fopenmp
    CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
    CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
    LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib
    CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
    
    # Compile the nlme package from source
    install.packages("nlme", type = "source")
    
    # To check whether openmp is enabled, compile data.table:
    install.packages("data.table", type = "source")