2015-11-11 49 views
1

我想在R中安裝devtools包,並且需要安裝其依賴xml2,但我收到以下錯誤消息。在小牛上安裝xml2包時出錯

> install.packages("xml2") 
Installing package into ‘/Users/xlong3/Library/R/3.2/library’ 
(as ‘lib’ is unspecified) 
trying URL 'https://cran.rstudio.com/src/contrib/xml2_0.1.2.tar.gz' 
Content type 'application/x-gzip' length 74808 bytes (73 KB) 
================================================== 
downloaded 73 KB 

* installing *source* package ‘xml2’ ... 
** package ‘xml2’ successfully unpacked and MD5 sums checked 
Found pkg-config cflags and libs! 
Using PKG_CFLAGS=-I/Users/xlong3/anaconda/include/libxml2 
Using PKG_LIBS=-L/Users/xlong3/anaconda/lib -lxml2 -lz -liconv -lm 
** libs 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c connection.cpp -o connection.o 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_doc.cpp -o xml2_doc.o 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_init.cpp -o xml2_init.o 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_namespace.cpp -o xml2_namespace.o 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_node.cpp -o xml2_node.o 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_url.cpp -o xml2_url.o 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml2_xpath.cpp -o xml2_xpath.o 
clang++ -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/Users/xlong3/anaconda/include/libxml2 -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I"/Users/xlong3/Library/R/3.2/library/Rcpp/include" -I"/usr/local/lib/R/3.2/site-library/BH/include" -fPIC -g -O2 -c xml_push.cpp -o xml_push.o 
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -o xml2.so RcppExports.o connection.o xml2_doc.o xml2_init.o xml2_namespace.o xml2_node.o xml2_url.o xml2_xpath.o xml_push.o -L/Users/xlong3/anaconda/lib -lxml2 -lz -liconv -lm -F/usr/local/Cellar/r/3.2.2_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation 
installing to /Users/xlong3/Library/R/3.2/library/xml2/libs 
** R 
** inst 
** preparing package for lazy loading 
** help 
*** installing help indices 
** building package indices 
** testing if installed package can be loaded 
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
    unable to load shared object '/Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so': 
    dlopen(/Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so, 6): Library not loaded: libxml2.2.dylib 
    Referenced from: /Users/xlong3/Library/R/3.2/library/xml2/libs/xml2.so 
    Reason: image not found 
Error: loading failed 
Execution halted 
ERROR: loading failed 
* removing ‘/Users/xlong3/Library/R/3.2/library/xml2’ 

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




> version 
       _       
platform  x86_64-apple-darwin13.4.0 
arch   x86_64      
os    darwin13.4.0     
system   x86_64, darwin13.4.0            
version.string R version 3.2.2 (2015-08-14) 
nickname  Fire Safety 
+1

雖然'configure'發現'libxml2'其他東西是錯誤的。這可能是一個'PATH'問題​​,但你有一個有趣的設置。既然你使用R的自制軟件爲什麼你不使用自制軟件'libxml2'?我會從Homebrew安裝'libxml2',從'PATH'中移除Anaconda,然後重新嘗試構建。 – hrbrmstr

+0

是的,我做了家釀libxml2:brew安裝libxml2 警告:libxml2-2.9.2已經安裝,它不工作。 –

+0

可能是這種情況,但它在'/ Users/xlong3/anaconda/include/libxml2'中找到它,所以你的設置非常混亂。 – hrbrmstr

回答

0

我不知道我應該如何從以下情況出發:

pkg-config --libs --cflags libxml2 

包的libxml2沒有在pkg配置搜索路徑中找到。 也許你應該添加的目錄包含`libxml2.pc」 到PKG_CONFIG_PATH環境變量 無包 'libxml2的' 發現

釀造LS的libxml2

/usr/local/Cellar/libxml2/2.9.2/bin/xml2-config 
/usr/local/Cellar/libxml2/2.9.2/bin/xmlcatalog 
/usr/local/Cellar/libxml2/2.9.2/bin/xmllint 
/usr/local/Cellar/libxml2/2.9.2/include/libxml2/ (47 files) 
/usr/local/Cellar/libxml2/2.9.2/lib/libxml2.2.dylib 
/usr/local/Cellar/libxml2/2.9.2/lib/cmake/libxml2/libxml2-config.cmake 
/usr/local/Cellar/libxml2/2.9.2/lib/pkgconfig/libxml-2.0.pc 
/usr/local/Cellar/libxml2/2.9.2/lib/ (3 other files) 
/usr/local/Cellar/libxml2/2.9.2/share/aclocal/libxml.m4 
/usr/local/Cellar/libxml2/2.9.2/share/doc/ (153 files) 
/usr/local/Cellar/libxml2/2.9.2/share/gtk-doc/ (55 files) 
/usr/local/Cellar/libxml2/2.9.2/share/man/ (4 files)