无法在MacOS M1 Monterey上安装Stringi R软件包
我无法在我的MacBook Pro(运行Macos Monterey)上安装R软件包Stringi
,并使用新的M1& ARM64建筑。关于类似问题的帖子有很多帖子,但是我收到的错误消息是我以前从未见过的。
当我在rstudio中运行install.packages(“ stringi”)
时,我会收到以下错误消息:
stri_brkiter.cpp:60:9: error: use of undeclared identifier
'isNull'
if (isNull(opts_brkiter)) {
^
我猜我在这里有某种编译器不匹配 - 不应该有'未宣布标识符的错误来自cran包。不过,我不确定如何解决该问题,而且我无法在线找到其他人收到类似消息的示例。我已经在网上看到了很多类似错误的,但是这些错误的修复程序并没有帮助我解决此isnull()
错误。
Note :上面的线只是消息输出的误差部分。有关完整的错误文本,请参见下文。
> install.packages("stringi")
Installing package into ‘/Users/<username>/r_libs’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need
compilation of C/C++/Fortran: ‘stringi’
Do you want to attempt to install these from sources? (Yes/no/cancel) yes
installing the source package ‘stringi’
Content type 'application/x-gzip' length 7578882 bytes (7.2 MB)
==================================================
downloaded 7.2 MB
* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /Library/Frameworks/R.framework/Resources
checking for R... /Library/Frameworks/R.framework/Resources/bin/R
checking for endianness... little
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... no
checking for cat... /bin/cat
checking for local ICUDT_DIR... icu69/data
checking for gcc... clang -arch arm64
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang -arch arm64 accepts -g... yes
checking for clang -arch arm64 option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -arch arm64 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking elf.h usability... no
checking elf.h presence... no
checking for elf.h... no
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -arch arm64 -std=gnu++11 accepts -g... yes
checking whether the C++ compiler supports the long long type... yes
checking whether the compiler implements namespaces... yes
checking whether the compiler supports Standard Template Library... yes
checking whether std::map is available... yes
checking for pkg-config... /opt/homebrew/bin/pkg-config
checking with pkg-config for the system ICU4C... 70.1
checking for ICU4C >= 55... yes
checking for additional required CPPFLAGS, LDFLAGS, and LIBS... done
checking whether an ICU4C-based project can be built... yes
checking programmatically for sufficient U_ICU_VERSION_MAJOR_NUM... yes
checking programmatically if U_CHARSET_IS_UTF8 is defined and set... yes
checking the capabilities of the ICU data library (ucnv, uloc, utrans)... yes
checking the capabilities of the ICU data library (ucol)... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/uconfig_local.h
config.status: creating src/install.libs.R
*** stringi configure summary:
ICU_FOUND=1
STRINGI_CXXSTD=CXX_STD=CXX11
STRINGI_CFLAGS= -fPIC
STRINGI_CPPFLAGS=-I. -I/opt/homebrew/Cellar/icu4c/70.1/include -UDEBUG -DNDEBUG
STRINGI_CXXFLAGS= -fPIC
STRINGI_LDFLAGS=-L/opt/homebrew/Cellar/icu4c/70.1/lib
STRINGI_LIBS=-licui18n -licuuc -licudata
*** Compiler settings used:
CC=clang -arch arm64
LD=clang++ -arch arm64 -std=gnu++14
CFLAGS=-falign-functions=64 -Wall -g -O2 -fPIC
CPPFLAGS=-I/opt/R/arm64/include -UDEBUG -DNDEBUG
CXX=clang++ -arch arm64 -std=gnu++11
CXXFLAGS=-falign-functions=64 -Wall -g -O2 -fPIC
LDFLAGS=
LIBS=
** libs
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -I/opt/homebrew/Cellar/icu4c/70.1/include -UDEBUG -DNDEBUG -I/opt/R/arm64/include -fPIC -fPIC -falign-functions=64 -Wall -g -O2 -c stri_brkiter.cpp -o stri_brkiter.o
stri_brkiter.cpp:60:9: error: use of undeclared identifier
'isNull'
if (isNull(opts_brkiter)) {
^
stri_brkiter.cpp:130:9: error: use of undeclared identifier
'isNull'
if (isNull(opts_brkiter)) {
^
stri_brkiter.cpp:171:9: error: use of undeclared identifier
'isNull'
if (isNull(opts_brkiter)) {
^
3 errors generated.
make: *** [stri_brkiter.o] Error 1
ERROR: compilation failed for package ‘stringi’
* removing ‘/Users/<username>/r_libs/stringi’
* restoring previous ‘/Users/<username>/r_libs/stringi’
The downloaded source packages are in
‘/private/var/folders/qc/whkk090506v2qjy698yf25m80000gq/T/RtmpvLUDID/downloaded_packages’
Warning message:
In install.packages("stringi") :
installation of package ‘stringi’ had non-zero exit status
我已经尝试在R Studio和命令行中安装Stringi
,因此一些建议的帖子可能更有效,但是我通过这两种方法都会收到相同的错误。
最初,编译器无法找到ICU4C库(这也阻止了我安装stringi
),但是我能够通过运行<来指向pkg-config
。代码> brew link ICU4C -force ,然后解决了。
我尝试过的其他命令(DID 不是修复了它):
install.packages('stringi', configure.args='--disable-cxx11')
install.packages("stringi", configure.args = "--with-extra-cxxflags='--std=c++11'")
完全删除我的makevars
文件无法解决问题。
我已经检查了许多有关So&amp;的主要/流行的问题。 github(包括 this , this , https://stackoverflow.com/questions/48866862/cannot-install-stringi-stringi-since-since-command-line-line-tools-tools-undate"> this , this 等)。我认为我已经达到了对这些东西的理解的边缘。
我公认的非专家假设是,这与我下载的编译器,我完成的M1架构解决方法和/或我的makevars文件有关以前(较旧的)MacBook之前没有任何问题。
系统信息:
- OS: Mac OS Monterey(V 12.2)w/a apple m1 max芯片
- r: r版本4.2.0
- rstudio: rstudio版本1.4.1717
- Xcode :Xcode版本13.3.1
- 已安装
GCC
/GFORTRAN
gcc 和其他库,并使用homebrew
&amp;将下载位置添加到$路径
我的makevars
文件:
CC=/opt/homebrew/bin/gcc-11
CXX=/opt/homebrew/bin/g++-11
FC=/opt/homebrew/bin/gfortran-11
F77=/opt/homebrew/bin/gfortran-11
FLIBS=-L/opt/homebrew/opt/gfortran/lib -lgfortran -lquadmath -lm
CFLAGS=-I/opt/homebrew/include
CXXFLAGS=-O3 -Wall -pipe -Wno-unused -pedantic
CXX11FLAGS=-O3 -Wall -pipe -Wno-unused -pedantic
这个错误看起来对任何人是否熟悉,还是有人对我可以做的修复可以做什么?我已经尝试了很多解决方法,所以我很抱歉,如果我遗漏了任何东西,请告诉我是否有其他信息有用!
谢谢!
I have been unable to install the R package stringi
on my Macbook Pro (running MacOS Monterey) with the new M1 & arm64 architecture. There are a number of posts on SO describing similar problems, but the error message I'm receiving is something I haven't seen before.
When I run install.packages("stringi")
in RStudio, I receive the following error message:
stri_brkiter.cpp:60:9: error: use of undeclared identifier
'isNull'
if (isNull(opts_brkiter)) {
^
I'm guessing there is some kind of compiler mismatch going on here - there shouldn't be 'undeclared identifier' errors coming from a CRAN package. I'm not sure how to fix the problem, though, and I wasn't able to find any examples online of others getting a similar message. I've seen a lot of similar errors online, but the fixes for those haven't helped me get around this isNull()
error.
Note: The lines above are just the error portion of the message output. See below for full error text.
> install.packages("stringi")
Installing package into ‘/Users/<username>/r_libs’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need
compilation of C/C++/Fortran: ‘stringi’
Do you want to attempt to install these from sources? (Yes/no/cancel) yes
installing the source package ‘stringi’
Content type 'application/x-gzip' length 7578882 bytes (7.2 MB)
==================================================
downloaded 7.2 MB
* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** using staged installation
checking for R_HOME... /Library/Frameworks/R.framework/Resources
checking for R... /Library/Frameworks/R.framework/Resources/bin/R
checking for endianness... little
checking for R >= 3.1.0 for C++11 use... yes
checking for R < 3.4.0 for CXX1X flag use... no
checking for cat... /bin/cat
checking for local ICUDT_DIR... icu69/data
checking for gcc... clang -arch arm64
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang -arch arm64 accepts -g... yes
checking for clang -arch arm64 option to accept ISO C89... none needed
checking how to run the C preprocessor... clang -arch arm64 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking elf.h usability... no
checking elf.h presence... no
checking for elf.h... no
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -arch arm64 -std=gnu++11 accepts -g... yes
checking whether the C++ compiler supports the long long type... yes
checking whether the compiler implements namespaces... yes
checking whether the compiler supports Standard Template Library... yes
checking whether std::map is available... yes
checking for pkg-config... /opt/homebrew/bin/pkg-config
checking with pkg-config for the system ICU4C... 70.1
checking for ICU4C >= 55... yes
checking for additional required CPPFLAGS, LDFLAGS, and LIBS... done
checking whether an ICU4C-based project can be built... yes
checking programmatically for sufficient U_ICU_VERSION_MAJOR_NUM... yes
checking programmatically if U_CHARSET_IS_UTF8 is defined and set... yes
checking the capabilities of the ICU data library (ucnv, uloc, utrans)... yes
checking the capabilities of the ICU data library (ucol)... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/uconfig_local.h
config.status: creating src/install.libs.R
*** stringi configure summary:
ICU_FOUND=1
STRINGI_CXXSTD=CXX_STD=CXX11
STRINGI_CFLAGS= -fPIC
STRINGI_CPPFLAGS=-I. -I/opt/homebrew/Cellar/icu4c/70.1/include -UDEBUG -DNDEBUG
STRINGI_CXXFLAGS= -fPIC
STRINGI_LDFLAGS=-L/opt/homebrew/Cellar/icu4c/70.1/lib
STRINGI_LIBS=-licui18n -licuuc -licudata
*** Compiler settings used:
CC=clang -arch arm64
LD=clang++ -arch arm64 -std=gnu++14
CFLAGS=-falign-functions=64 -Wall -g -O2 -fPIC
CPPFLAGS=-I/opt/R/arm64/include -UDEBUG -DNDEBUG
CXX=clang++ -arch arm64 -std=gnu++11
CXXFLAGS=-falign-functions=64 -Wall -g -O2 -fPIC
LDFLAGS=
LIBS=
** libs
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -I/opt/homebrew/Cellar/icu4c/70.1/include -UDEBUG -DNDEBUG -I/opt/R/arm64/include -fPIC -fPIC -falign-functions=64 -Wall -g -O2 -c stri_brkiter.cpp -o stri_brkiter.o
stri_brkiter.cpp:60:9: error: use of undeclared identifier
'isNull'
if (isNull(opts_brkiter)) {
^
stri_brkiter.cpp:130:9: error: use of undeclared identifier
'isNull'
if (isNull(opts_brkiter)) {
^
stri_brkiter.cpp:171:9: error: use of undeclared identifier
'isNull'
if (isNull(opts_brkiter)) {
^
3 errors generated.
make: *** [stri_brkiter.o] Error 1
ERROR: compilation failed for package ‘stringi’
* removing ‘/Users/<username>/r_libs/stringi’
* restoring previous ‘/Users/<username>/r_libs/stringi’
The downloaded source packages are in
‘/private/var/folders/qc/whkk090506v2qjy698yf25m80000gq/T/RtmpvLUDID/downloaded_packages’
Warning message:
In install.packages("stringi") :
installation of package ‘stringi’ had non-zero exit status
I've tried installing stringi
both in R Studio and on the command line, which some SO posts suggested may be more effective, but I receive the same errors via both methods.
Initially, the compiler was unable to find the ICU4C library (which also prevented me from installing stringi
), but I was able to point pkg-config
to the library by running brew link icu4c --force
and that resolved it.
Other commands I've tried (that did NOT fix it):
install.packages('stringi', configure.args='--disable-cxx11')
install.packages("stringi", configure.args = "--with-extra-cxxflags='--std=c++11'")
Fully removing my Makevars
file didn't resolve the issue.
I've checked many of the major/popular related questions on SO & Github (including this, this, this, this, this etc). I think I've reached the edge of my understanding of this stuff, though.
My admittedly non-expert assumption is that this has to do with the compilers I've downloaded, the M1 architecture workarounds I've done, and/or my Makevars file, as I've installed stringi
on previous (older) Macbooks before without any issue.
System info:
- OS: Mac OS Monterey (v 12.2) w/ an Apple M1 Max chip
- R: R version 4.2.0
- RStudio: RStudio version 1.4.1717
- Xcode: Xcode version 13.3.1
- Installed
gcc
/gfortran
and other libraries usingHomebrew
& added download location to $PATH
My Makevars
file:
This file was built based on advice from here, here, here, and here.
CC=/opt/homebrew/bin/gcc-11
CXX=/opt/homebrew/bin/g++-11
FC=/opt/homebrew/bin/gfortran-11
F77=/opt/homebrew/bin/gfortran-11
FLIBS=-L/opt/homebrew/opt/gfortran/lib -lgfortran -lquadmath -lm
CFLAGS=-I/opt/homebrew/include
CXXFLAGS=-O3 -Wall -pipe -Wno-unused -pedantic
CXX11FLAGS=-O3 -Wall -pipe -Wno-unused -pedantic
Does this error look familiar to anyone, or does anyone have suggestions of what I could do next to fix this? I've tried a lot of workarounds so I apologize if I've left anything out, please let me know if any other information could be useful!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于那些返回相同问题的人,似乎
stringi
无法在r v.4.2。*(请参阅在这里和在这里)。降级至R v.4.1.1足以在我的计算机上解决此问题,并在下面的会话信息上进行修复。降级之前:
降级后:
For those returning with this same problem, it seems
stringi
fails to build specifically under R v.4.2.* (see here and here). Downgrading to R v.4.1.1 was sufficient to fix this on my machine, with session info below.Prior to downgrade:
After downgrade:
除非您绝对需要编译源版本,否则目前有一个二进制ARM版本。 (显然,将来的人们需要更改版本号)
我想知道在您尝试过的那一刻,在这方面,rstudio的默认存储库是否不完整?
Unless you absolutely need to have source compiled version, there is a binary arm version at the moment. (Obviously people in the future will need to change the version numbers)
I'm wondering if the default repository for Rstudio was not complete in this regard at the point you tried this?