背景 我试图在输入'R'后通过命令install.packages()在macOS终端中安装软件包“ zip”:
R
install.packages("zip")
我还输入了相同的命令以在Rstudio控制台中安装相同的软件包,根本没有出现任何问题(这意味着该软件包附带的功能是有效的(仅在Rstudio中))。
问题 简而言之,未安装软件包“ zip”。终端中出现以下错误消息(非常长):
* installing *source* package ‘zip’ ...
** package ‘zip’ successfully unpacked and MD5 sums checked
** libs
x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/hephaeschuen/anaconda3/include -fdebug-prefix-map==/usr/local/src/conda/- -fdebug-prefix-map==/usr/local/src/conda-prefix miniz.c zip.c tools/cmdzip.c -o tools/cmdzip
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture x86_64:
"___assert_rtn", referenced from:
_tdefl_compress in miniz-444461.o
_tinfl_decompress in miniz-444461.o
_tdefl_flush_block in miniz-444461.o
_tdefl_compress_buffer in miniz-444461.o
_tdefl_compress_mem_to_output in miniz-444461.o
_tdefl_write_image_to_png_file_in_memory_ex in miniz-444461.o
_mz_zip_reader_read_central_dir in miniz-444461.o
...
"___bzero", referenced from:
_tdefl_init in miniz-444461.o
_tdefl_compress in miniz-444461.o
_tinfl_decompress in miniz-444461.o
_tdefl_flush_block in miniz-444461.o
_mz_zip_reader_init in miniz-444461.o
_mz_zip_reader_init_mem in miniz-444461.o
_mz_zip_reader_init_file_v2 in miniz-444461.o
...
"___error", referenced from:
_zip_error in zip-fff898.o
_zip_mkdirp in zip-fff898.o
_zip_unzip in zip-fff898.o
"___memcpy_chk", referenced from:
_tdefl_compress_block in miniz-444461.o
"___memset_chk", referenced from:
_mz_zip_writer_add_mem_ex_v2 in miniz-444461.o
_mz_zip_writer_add_cfile in miniz-444461.o
_mz_zip_writer_add_from_zip_reader in miniz-444461.o
"___stack_chk_fail", referenced from:
_mz_deflate in miniz-444461.o
_mz_compress2 in miniz-444461.o
_mz_inflate in miniz-444461.o
_tinfl_decompress in miniz-444461.o
_mz_uncompress in miniz-444461.o
_tdefl_compress_buffer in miniz-444461.o
_tdefl_compress_mem_to_output in miniz-444461.o
...
"___stack_chk_guard", referenced from:
_mz_deflate in miniz-444461.o
_mz_compress2 in miniz-444461.o
_mz_inflate in miniz-444461.o
_tinfl_decompress in miniz-444461.o
_mz_uncompress in miniz-444461.o
_tdefl_compress_buffer in miniz-444461.o
_tdefl_compress_mem_to_output in miniz-444461.o
...
"___stderrp", referenced from:
_cmd_zip_error_handler in cmdzip-d70c7b.o
_main in cmdzip-d70c7b.o
"___vsnprintf_chk", referenced from:
_zip_error in zip-fff898.o
"_calloc", referenced from:
_main in cmdzip-d70c7b.o
"_chmod", referenced from:
_zip_unzip in zip-fff898.o
"_exit", referenced from:
_cmd_zip_error_handler in cmdzip-d70c7b.o
"_fclose", referenced from:
_mz_zip_reader_end_internal in miniz-444461.o
_mz_zip_reader_init_file_v2 in miniz-444461.o
_mz_zip_reader_extract_to_file in miniz-444461.o
_mz_zip_writer_end_internal in miniz-444461.o
_mz_zip_writer_add_file in miniz-444461.o
"_fflush", referenced from:
_mz_zip_writer_finalize_archive in miniz-444461.o
"_fopen", referenced from:
_mz_zip_reader_init_file_v2 in miniz-444461.o
_mz_zip_reader_extract_to_file in miniz-444461.o
_mz_zip_writer_init_file_v2 in miniz-444461.o
_mz_zip_writer_add_file in miniz-444461.o
_mz_zip_add_mem_to_archive_file_in_place_v2 in miniz-444461.o
"_fprintf", referenced from:
_cmd_zip_error_handler in cmdzip-d70c7b.o
_main in cmdzip-d70c7b.o
"_fread", referenced from:
_mz_zip_file_read_func in miniz-444461.o
_mz_zip_writer_add_cfile in miniz-444461.o
"_free", referenced from:
_mz_free in miniz-444461.o
_miniz_def_free_func in miniz-444461.o
_tdefl_compress_mem_to_output in miniz-444461.o
_tdefl_write_image_to_png_file_in_memory_ex in miniz-444461.o
_tdefl_compressor_free in miniz-444461.o
_tinfl_decompress_mem_to_heap in miniz-444461.o
_tinfl_decompress_mem_to_callback in miniz-444461.o
...
(maybe you meant: _tinfl_decompressor_free, _tdefl_compressor_free , _mz_zip_reader_extract_iter_free , _miniz_def_free_func , _mz_free )
"_freopen", referenced from:
_mz_zip_writer_init_from_reader_v2 in miniz-444461.o
"_fseeko", referenced from:
_mz_zip_reader_init_file_v2 in miniz-444461.o
_mz_zip_file_read_func in miniz-444461.o
_mz_zip_reader_init_cfile in miniz-444461.o
_mz_zip_file_write_func in miniz-444461.o
_mz_zip_writer_add_file in miniz-444461.o
"_ftello", referenced from:
_mz_zip_reader_init_file_v2 in miniz-444461.o
_mz_zip_file_read_func in miniz-444461.o
_mz_zip_reader_init_cfile in miniz-444461.o
_mz_zip_file_write_func in miniz-444461.o
_mz_zip_writer_init_cfile in miniz-444461.o
_mz_zip_writer_add_file in miniz-444461.o
"_fwrite", referenced from:
_mz_zip_file_write_callback in miniz-444461.o
_mz_zip_file_write_func in miniz-444461.o
"_localtime", referenced from:
_mz_zip_writer_add_mem_ex_v2 in miniz-444461.o
_mz_zip_writer_add_cfile in miniz-444461.o
"_malloc", referenced from:
_miniz_def_alloc_func in miniz-444461.o
_mz_compress2 in miniz-444461.o
_mz_uncompress in miniz-444461.o
_tdefl_compress_mem_to_output in miniz-444461.o
_tdefl_write_image_to_png_file_in_memory_ex in miniz-444461.o
_tdefl_compressor_alloc in miniz-444461.o
_tinfl_decompress_mem_to_callback in miniz-444461.o
...
"_memcmp", referenced from:
_mz_zip_reader_locate_file_v2 in miniz-444461.o
_mz_zip_validate_file in miniz-444461.o
"_memcpy", referenced from:
_tdefl_compress in miniz-444461.o
_mz_inflate in miniz-444461.o
_tinfl_decompress in miniz-444461.o
_tdefl_flush_block in miniz-444461.o
_tdefl_output_buffer_putter in miniz-444461.o
_mz_zip_mem_read_func in miniz-444461.o
_mz_zip_reader_extract_iter_read in miniz-444461.o
...
"_memset", referenced from:
_tinfl_decompress in miniz-444461.o
_tdefl_compress_block in miniz-444461.o
"_mkdir", referenced from:
_zip_mkdirp in zip-fff898.o
_zip_unzip in zip-fff898.o
(maybe you meant: _zip_mkdirp)
"_mktime", referenced from:
_mz_zip_file_stat_internal in miniz-444461.o
"_open", referenced from:
_main in cmdzip-d70c7b.o
"_read", referenced from:
_main in cmdzip-d70c7b.o
(maybe you meant: _mz_zip_reader_get_filename, _mz_zip_writer_init_from_reader , _mz_zip_writer_init_from_reader_v2 , _mz_zip_reader_get_num_files , _mz_zip_reader_extract_to_cfile , _mz_zip_reader_extract_file_iter_new , _mz_zip_reader_extract_iter_new , _mz_zip_reader_extract_file_to_callback , _mz_zip_reader_extract_to_heap , _mz_zip_reader_extract_file_to_mem_no_alloc , _mz_zip_reader_file_stat , _mz_zip_reader_locate_file_v2 , _mz_zip_reader_is_file_a_directory , _mz_zip_reader_extract_file_to_heap , _mz_zip_reader_init_file , _mz_zip_reader_is_file_encrypted , _mz_zip_reader_init_cfile , _mz_zip_reader_extract_to_mem , _mz_zip_reader_init_file_v2 , _mz_zip_reader_extract_to_mem_no_alloc , _mz_zip_reader_init_mem , _mz_zip_reader_extract_iter_read , _mz_zip_reader_init , _mz_zip_reader_locate_file , _mz_zip_reader_extract_iter_free , _mz_zip_reader_extract_file_to_file , _mz_zip_reader_extract_file_to_mem , _mz_zip_reader_is_file_supported , _mz_zip_reader_extract_file_to_cfile , _mz_zip_writer_add_from_zip_reader , _mz_zip_reader_end , _mz_zip_read_archive_data , _mz_zip_reader_extract_to_file , _mz_zip_reader_extract_to_callback )
"_realloc", referenced from:
_miniz_def_realloc_func in miniz-444461.o
_tdefl_output_buffer_putter in miniz-444461.o
_tdefl_write_image_to_png_file_in_memory_ex in miniz-444461.o
_tinfl_decompress_mem_to_heap in miniz-444461.o
_zip_str_file_path in zip-fff898.o
(maybe you meant: _miniz_def_realloc_func)
"_remove", referenced from:
_mz_zip_add_mem_to_archive_file_in_place_v2 in miniz-444461.o
"_stat$INODE64", referenced from:
_mz_zip_writer_add_file in miniz-444461.o
_mz_zip_add_mem_to_archive_file_in_place_v2 in miniz-444461.o
_zip_set_permissions in zip-fff898.o
_zip_file_exists in zip-fff898.o
_zip_unzip in zip-fff898.o
"_strcpy", referenced from:
_zip_str_file_path in zip-fff898.o
"_strlen", referenced from:
_mz_zip_reader_locate_file_v2 in miniz-444461.o
_mz_zip_validate_file in miniz-444461.o
_mz_zip_writer_add_mem_ex_v2 in miniz-444461.o
_mz_zip_writer_add_cfile in miniz-444461.o
_zip_str_file_path in zip-fff898.o
"_strrchr", referenced from:
_zip_str_file_path in zip-fff898.o
"_time", referenced from:
_mz_zip_writer_add_mem_ex_v2 in miniz-444461.o
"_utime", referenced from:
_mz_zip_reader_extract_to_file in miniz-444461.o
"_utimes", referenced from:
_zip_set_mtime in zip-fff898.o
_zip_unzip in zip-fff898.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makevars:9: tools/cmdzip] Error 1
ERROR: compilation failed for package ‘zip’
* removing ‘/Users/hephaeschuen/anaconda3/lib/R/library/zip’
* restoring previous ‘/Users/hephaeschuen/anaconda3/lib/R/library/zip’
我想我需要对发生的事情进行认真的澄清: 1.为什么该软件包可以在Rstudio中成功安装并正常运行,而在终端级别却根本没有安装? 2.上面的错误信息表明什么? 3.如何成功安装“ zip”?