1

我正在拼命地在 MacOS Big Sur 11.3 上安装pngR

不幸的是,我对 libz.1.dylib 有疑问:安装似乎找不到它。

但是,我已经从/opt/local/lib/libz.1.dylibto/usr/lib和正确设置的/usr/local/lib目录复制DYLD_LIBRARY_PATH到它们。

这里的安装输出:

> install.packages('png')
Installing package into ‘/usr/local/lib/R/4.1/site-library’
(as ‘lib’ is unspecified)

trying URL 'https://cran.irsn.fr/src/contrib/png_0.1-7.tar.gz'
Content type 'application/x-gzip' length 24990 bytes (24 KB)
==================================================
downloaded 24 KB

* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc-9 -I"/usr/local/Cellar/r/4.1.1/lib/R/include" -DNDEBUG   -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include   `libpng-config --cflags` -fPIC  -mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib -c read.c -o read.o

...

gcc-9 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/4.1.1/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/xz/lib -L/usr/local/lib -o png.so read.o write.o -L/opt/intel/oneapi/intelpython/latest/lib -lpng16 -lz -L/usr/local/Cellar/r/4.1.1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
installing to /usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘png’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so':
  dlopen(/usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so, 6): Library not loaded: @rpath/libz.1.dylib
  Referenced from: /usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/4.1/site-library/png’

The downloaded source packages are in
    ‘/private/tmp/Rtmp9boK6h/downloaded_packages’
Warning message:
In install.packages("png") :
  installation of package ‘png’ had non-zero exit status

我的文件~/.R/Makevars是:

VER=-9
CC=gcc$(VER)
CXX=g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib
FLIBS=-L/usr/local/Cellar/gcc@9/9.4.0/lib/gcc/9 -L/opt/local/lib
PKG_LIBS=$(PNG_LIBS) `libpng-config --static --ldflags`
PKG_CFLAGS=$(PNG_CFLAGS) `libpng-config --cflags`

我怎么能绕过这个问题?

4

0 回答 0