.net framework 4.0安装_R4.0的源码安装——以mac为例
装了一堆东西回来,已经忘了最初要做的是啥。
太长不看版
其实就是缺什么安装什么。每个人情况可能都不太一样。对于我的mac上,如下:
- configure之前需要安装:
- gcc
- xz
- pcre2
安装方法:brew
brew install gccbrew install xzbrew install pcre2
- make之前需要安装
- JDK:直接下载dmg安装
- Mactex(可选):直接下载dmg安装或者
brew cask install mactex
正文
起因
在R3.6.3下安装"psych"包,发现其依赖包‘mnormt’只支持R4.0以上。
> install.packages("psych")Warning in install.packages : dependency ‘mnormt’ is not available There is a binary version available but the source version is later: binary source needs_compilationpsych 1.9.12.31 2.0.7 FALSEinstalling the source package ‘psych’trying URL 'https://cran.rstudio.com/src/contrib/psych_2.0.7.tar.gz'Content type 'application/x-gzip' length 1743492 bytes (1.7 MB)==================================================downloaded 1.7 MBERROR: dependency ‘mnormt’ is not available for package ‘psych’* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/psych’Warning in install.packages : installation of package ‘psych’ had non-zero exit statusThe downloaded source packages are in ‘/private/var/folders/2m/m8nlj_2521d01sz7vypnvh940000gn/T/RtmpqaVH0v/downloaded_packages’
但是在mac下,安装R的pkg似乎没有办法使得两个版本的R并存。于是开始了我漫长的R4.0源码安装之旅。
从R4.0的下载和安装开始,逐渐走向不归路。
# 进入你常用的软件下载路径。我这里是srccd src# 下载wget https://cran.r-project.org/src/base/R-4/R-4.0.2.tar.gz# 解压tar -zxvf tar -zxvf R-4.0.2.tar.gzcd R-4.0.2# 查看configure的设置参数可以用下边命令# ./configure -h# 正式configure./configure --prefix=$HOME/opt --with-x=no --enable-R-shlib
--enable-R-shlib
:build the shared/dynamic library 'libR' [no],要使底层R共享库对RStudio服务器可用,需要enable-R-shlib选项。--with-x
: use the X Window System
结果报错了:
checking whether we are using the GNU Fortran compiler... nochecking whether accepts -g... noconfigure: error: No Fortran compiler found
安装gfortran
$ brew search gfortranWarning: Error searching on GitHub: curl failed! % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to api.github.com port 443: Connection refusedGNU Fortran is part of the GCC formula: brew install gcc
好的,GNU Fortran is part of the GCC formula,那我就根据提示安装GCC吧。
brew install gcc
再来一次:
./configure --prefix=$HOME/opt --with-x=no --enable-R-shlib# configure: error: "liblzma library and headers are required"
搜索了一下,发现是因为缺少了xz库。好吧,老老实实安装。
brew install xz
也可以到这:http://R.research.att.com/libs/下载安装。
- 解决方法参考了这篇:《Install R with shared library in OSX - liblzma library missing》:https://stackoverflow.com/questions/40222371/install-r-with-shared-library-in-osx-liblzma-library-missing
不气馁,再来一次:
./configure --prefix=$HOME/opt --with-x=no --enable-R-shlib
新的报错
configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support
在CRAN给的R安装指南《R Installation and Administration》章节《Essential-programs-and-libraries》(https://cran.r-project.org/doc/manuals/r-devel/R-admin.html#Essential-programs-and-libraries)里是这么描述的:
Either PCRE1 (version 8.32 or later, formerly known as just PCRE) or PCRE2 is required: PCRE2 is preferred and using PCRE1 requires configure option --with-pcre1. Only the 8-bit library and headers are needed if these are packaged separately. JIT support (optional) is desirable for the best performance. For PCRE2 >= 10.30 (which is desirable as matching has been re-written not to use recursion and the Unicode tables were updated to version 10)./configure --enable-jitsuffices. If building PCRE1 for use with R a suitable configure command might be./configure --enable-utf --enable-unicode-properties --enable-jit --disable-cppThe --enable-jit flag is supported for most common CPUs. (See also the comments for Solaris.)Some packages require the ‘Unicode properties’ which are optional for PCRE1: support for this and JIT can be checked at run-time by calling pcre_config().
PCRE有PCRE1和PCRE2两个版本。更建议使用PCRE2。好的。来装吧:
brew install pcre2
- 附:关于
pcre
和--enable-jit
:《pcrejit man page》(https://www.pcre.org/original/doc/html/pcrejit.html)
再来一次:
./configure --prefix=$HOME/opt --with-x=no --enable-R-shlib
好像可以了。来编译试试:
make
提示需要安装JDK。
到这里https://www.oracle.com/java/technologies/javase-jdk14-downloads.html下载对应版本安装。我下载的是dmg版本:
好了。继续往前
make installmake install-info # To install info and PDF versions of the manualsmake check
make check
: 安装后的检测。会生成一个tests目录。(个人猜测)原理应该是比较R脚本出来的结果跟它理应出来的结果进行比较。
在'reg-packages.R'这一个检测中报错了。
running code in 'array-subset.R' ... OKrunning code in 'reg-tests-1a.R' ... OKrunning code in 'reg-tests-1b.R' ... OKrunning code in 'reg-tests-1c.R' ... OKrunning code in 'reg-tests-1d.R' ... OKrunning code in 'reg-tests-2.R' ... OK comparing 'reg-tests-2.Rout' to './reg-tests-2.Rout.save' ... OKrunning code in 'reg-examples1.R' ... OKrunning code in 'reg-examples2.R' ... OKrunning code in 'reg-packages.R' ...make[3]: *** [reg-packages.Rout] Error 1make[2]: *** [test-Reg] Error 2make[1]: *** [test-all-basics] Error 1make: *** [check] Error 2
于是进入tests目录查看,有一个reg-packages.Rout.fail
的文件。如果成功的则没有.fail的后缀。找到开始报错的地方:
* checking for file '/private/var/folders/2m/m8nlj_2521d01sz7vypnvh940000gn/T/RtmpBZTu1Y/Pkgs/exSexpr/DESCRIPTION' ... OK* preparing 'exSexpr':* checking DESCRIPTION meta-information ... OK* installing the package to process help pages* saving partial Rd database* building the PDF package manualHmm ... looks like a packageCreating pdf output from LaTeX ...Error: R CMD build failed (no tarball) for package exSexprIn addition: Warning message:In system(paste(Rcmd, "build --keep-empty-dirs", shQuote(dir)), : running command ''/Users/wangqingzhong/src/R-4.0.2/bin/R' CMD build --keep-empty-dirs '/private/var/folders/2m/m8nlj_2521d01sz7vypnvh940000gn/T/RtmpBZTu1Y/Pkgs/exSexpr'' had status 1Execution halted
似乎是因为缺少了latex无法生成pdf导致的。
于是安装mactex,安装成功后报错就解除了。
这里插一句,如果按照需要已经安装好了,但还是报同样的错误。可以试试make distclean
后再重新configure
:
make distclean./configure --prefix=$HOME/opt --with-x=no --enable-R-shlib
- make distclean 除了清除可执行文件和目标文件外,把configure所产生的Makefile也清除掉。(参考:《./configure,make,make install的作用》:http://www.linuxidc.com/Linux/2011-02/32211.htm)
mactex的安装
- 方式一:brew(速度太慢,我舍弃了),下边三选一。
#There are three versions of MacTeX.#Full installation: brew cask install mactex#Full installation without bundled applications: brew cask install mactex-no-gui#Minimal installation: brew cask install basictex
- 方式二:安装pkg,安装之后添加环境变量
下载mactex:http://tug.org/cgi-bin/mactex-download/MacTeX.pkg
$ echo 'export PATH=/usr/local/texlive/2020/bin/x86_64-darwin/:$PATH' >> ~/.bash_profile source ~/.bash_profile
/usr/local/texlive/2020/bin/x86_64-darwin/
是你mactex的最后路径。如果不知道可以使用find命令自己查找一下。
重新check:该错误终于修复了。这样看来,对于日常并不需要将tex文件编译成pdf的人来说,其实这个问题可能不修复也没有太大关系。
make check# running code in 'reg-packages.R' ... OK# 也没有再出现新的错误了。
另外,其实缺少mactex这个问题再configure的步骤就已经可以看出来。在没有安装mactex的时候configure会出来两条warning:因为pdf文档需要从tex编译过来。
configure: WARNING: you cannot build PDF versions of the R manualsconfigure: WARNING: you cannot build PDF versions of vignettes and help pages
好了,最后,生成pdf文档(可选)
make pdf# 显示需要pdflatex,但是系统没有。# 但是我输入pdflatex是有的。# 重新configure试试。# make distclean# ./configure --prefix=$HOME/opt --with-x=no --enable-R-shlib# make# make install# make install-info # make check# make pdf
添加环境变量,为了按需开启,而非总覆盖之前的R 3.6,我没有写到bash_profile中。而是随便命名了另一个.bash_czr。需要用R4.0的时候source一下它即可。
touch $HOME/.bash_czrecho 'export PATH=/Users/wangqingzhong/opt/bin:$PATH' >> $HOME/.bash_czr# R包安装路径echo 'export R_LIBS=/Users/wangqingzhong/opt/lib/R/library' >> $HOME/.bash_czrsource $HOME/.bash_czr
关于进入R后有warning:
1: Setting LC_CTYPE failed, using "C"2: Setting LC_COLLATE failed, using "C"3: Setting LC_TIME failed, using "C"4: Setting LC_MESSAGES failed, using "C"5: Setting LC_PAPER failed, using "C"
解决参考的:《Setting locales in terminal resolved the issue for me. Open the terminal and》(https://stackoverflow.com/questions/9689104/installing-r-on-mac-warning-messages-setting-lc-ctype-failed-using-c)
Check if locale settings are missing
> localeLANG=LC_COLLATE="C"LC_CTYPE="UTF-8"LC_MESSAGES="C"LC_MONETARY="C"LC_NUMERIC="C"LC_TIME="C"LC_ALL=
Edit
~/.profile
or~/.bashrc
export LANG=en_US.UTF-8export LC_ALL=en_US.UTF-8
Run
. ~/.profile
or. ~/.bashrc
to read from the file.Open a new terminal window and check that the locales are properly set
> localeLANG="en_US.UTF-8"LC_COLLATE="en_US.UTF-8"LC_CTYPE="en_US.UTF-8"LC_MESSAGES="en_US.UTF-8"LC_MONETARY="en_US.UTF-8"LC_NUMERIC="en_US.UTF-8"LC_TIME="en_US.UTF-8"LC_ALL="en_US.UTF-8"
.net framework 4.0安装_R4.0的源码安装——以mac为例相关推荐
- oel 7.0 安装 mysql 5_OEL7.6源码安装MYSQL5.7的教程
首先官网下载安装包https://dev.mysql.com/downloads/mysql/5.7.html#downloads 然后上传解压至/usr/local目录 [root@localhos ...
- mysql centos 源码安装_CentOS5下MySQL源码安装方式
1.编译环境安装 uname -aLinux ha01 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 i686 i386 GNU/Lin ...
- 三星note4安装linux,Leanote Ubuntu 源码安装
Leanote Ubuntu 源码安装 1 安装golang 2 安装MongoDB 2.1 安装MongoDB 从 Mongodb 官网 获取相应系统的最新版安装链接,笔者以 Ubuntu18.04 ...
- 源码安装mysql主从_mysql源码安装和主从同步配置
mysql源码安装和主从同步配置 mysql介绍: MySQL 是一种关联数据库管理系统,关联数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性.MySQL ...
- linux python3.8源码安装_linux 下从源码安装 Python——小白踩坑记
实验室服务器使用的系统为 Ubuntu 16.04,自带的 python 版本为 Python 2.7.12 和 Python 3.5.2,命令行下使用$ python命令来启动 python 时默认 ...
- mysql 5.7.17 源码安装_mysql5.7.17源码安装
创建用户和目录 groupadd mysql useradd -r -g mysql mysql mkdir -p /data/mysql/standby/data mkdir -p /data/my ...
- 源码安装mysql_CentOS 7中源码安装MySQL 5.7.16 (亲测成功)
最近在CentOS 7中源码安装MySQL 5.7.16,发现MySQL5.7.6+以后的安装方式真的与以前版本的MySQL安装方式大大的不同呀.不自己安装一把,下面这篇文章是通过自己的安装过程总结的 ...
- mysql5.6.28安装_mysql5.6.28源码安装
众所周知,mysql5.5版本之前都是通过./configure进行编译环境检查,mysql5.5之后用的是cmake(包括5.5) 安装前的准备工作: [root@localhost ~]#wget ...
- centos7源码安装mysql8.0_CentOS7下源码安装MySQL 8.x
会选择使用源码安装MySQL,想必对MySQL及其他的安装方式已经有了一定的了解,这里就不对周边信息进行过多赘述了,直接开始吧. 编译MySQL比较消耗内存,如果机器内存较小,可能会在编译期间出现内存 ...
- linux7squid编译安装,CentOS 7.3 源码安装squid 4.12 及安装过程遇到的一些问题
CentOS 7.3 源码安装squid 4.12 及安装过程遇到的一些问题 一.源码安装squid 4.12 1.下载squid-4.12源码包 wget http://www.squid-cach ...
最新文章
- vue cli 4 多环境_Vue 前端uni-app多环境配置部署服务器的问题
- linux剪贴板复制文件原理,linux剪贴板原理
- [LeetCode]--20. Valid Parentheses
- [PAT乙级]1030 完美数列
- P5355-[Ynoi2017]由乃的玉米田【莫队,bitset,根号分治】
- Java应用程序中的消息传递主体
- 微信内打开的网页不能下载APP,微信无法打开浏览器访问指定页面的解决方案...
- Python-Matplotlib可视化(6)——自定义坐标轴让统计图清晰易懂
- 系统分析师和系统架构设计师的主要区别是什么?
- 培根密码加解密(Python)
- SAP固定资产的几个日期
- 为什么管理创新总是发生在汽车行业?
- 用友U9 UFSoft.UBF.Business.Session
- 计算机机房标准pdf,计算机机房建设标准要点.pdf
- mc服务器钓鱼系统,钓鱼 - Minecraft Wiki,最详细的官方我的世界百科
- CVPR 2021 Authors Guidelines 投稿须知 中英文对照翻译
- MATLAB-直方图均衡化
- kingscada 3.7 复杂文本框获取文件,改变文件格式
- 阿里发聚安全5.0 剑指互联网业务安全
- matlab电阻阻器的符号,电阻器电路图形符号
热门文章
- 华为辟谣将发布石墨烯电池手机;梁建章回应携程杀熟;GitLab 12.6 发布 | 极客头条...
- PHP 是生还是死?
- 刷爆抖音,评分9.7!这本Python书太酷了!程序员:太爱!
- Google I/O 2019 行纪 —— Google 要让 AI 消除偏见
- 浪潮云海OS C位出道,融合开放基础设施呼之欲出
- 当我们在谈论单测时我们在谈论什么
- 开发者最讨厌的编程语言:Perl 名列第一,PHP、Objective-C 和 Ruby 都在其中
- 请写一个java程序实现线程连接池功能_请写一个java程序实现线程连接池功能
- mysql 时间2039_Apollo使用MySQL时用关键字作为表名报错
- 微型计算机中 奔三 指,计算机基础知识180题.docx