![](/img/trans.png)
[英]Error attempting to install R packages: malformed universal file: slice content is not mach-o or a static library file
[英]sourceCpp error: not mach-o or a static library file '/usr/local/lib/libgfortran.dylib'
我一直是 RcppArmadillo 的用戶,但自從將我的操作系統升級到 Monterey 版本 12.3 后,我一直無法通過 sourceCpp 編譯任何程序。
出現以下錯誤:
ld: malformed universal file: slice content is not mach-o or a static library file '/usr/local/lib/libgfortran.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_2.so] Error 1
從這里的帖子來看,這似乎與 static 和動態鏈接有關,但我真的不知道。
當我升級到 Xcode 13.3 時,我得到了同樣的 ld 錯誤。 我已經恢復到 13.2,並且我的項目構建沒有錯誤。 我將繼續使用 13.2,直到我看到有關導致此問題的原因的更多信息。
重新安裝 RcppArmadillo
-> install.packages("RcppArmadillo", type = "source")
如果出現問題,請嘗試修改您的 makeconf 文件:
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin21/11.2.0 #-L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
這是來自 XCode 13.3 發行說明。 我想這個問題與此更改有關。
新的鏈式修復格式是針對 macOS 11 或更高版本、iOS 13.4 或更高版本、watchOS 7.0 或更高版本以及 tvOS 14.0 或更高版本時的默認鏈接方法。 這種新格式導致二進制文件中的 LINKEDIT 段更小。 當針對較早的操作系統版本時,linker 繼續在 LINKEDIT 中生成傳統的操作碼格式以進行修復、變基和綁定。 (85572905)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.