Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"xml2" install error in centos 6 #164

Closed
mrzung46 opened this issue Jan 10, 2017 · 8 comments
Closed

"xml2" install error in centos 6 #164

mrzung46 opened this issue Jan 10, 2017 · 8 comments

Comments

@mrzung46
Copy link

@mrzung46 mrzung46 commented Jan 10, 2017

hi, I'm trying to install "xml2" in my server but there is unsolvable error.
the output when I entered install.packages("xml") code is like below.

* installing *source* packagexml2...
** packagexml2successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/libxml2
Using PKG_LIBS=-lxml2 -lz -lm
** libs
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c RcppExports.cpp -o RcppExports.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c connection.cpp -o connection.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_doc.cpp -o xml2_doc.o
xml2_doc.cpp: In functionRcpp::IntegerVector xml_parse_options()’:
xml2_doc.cpp:129:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < size; ++i) {
                     ^
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_init.cpp -o xml2_init.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_namespace.cpp -o xml2_namespace.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_node.cpp -o xml2_node.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/usr/lib64/R/library/Rcpp/include" -I"/usr/lib64/R/library/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_output.cpp -o xml2_output.o
xml2_output.cpp: In functionRcpp::IntegerVector xml_save_options()’:
xml2_output.cpp:45:38: error:XML_SAVE_WSNONSIGwas not declared in this scope
       Rcpp::_["format_whitespace"] = XML_SAVE_WSNONSIG);
                                      ^
xml2_output.cpp: In functionint xml_write_callback(Rconnection, const char*, int)’:
xml2_output.cpp:61:67: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if ((write_size = R_WriteConnection(con, (void *) buffer, len)) != len) {
                                                                   ^
make: *** [xml2_output.o] Error 1
ERROR: compilation failed for packagexml2* removing/usr/lib64/R/library/xml2The downloaded source packages are in/tmp/RtmpOGlR0j/downloaded_packagesUpdating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("xml2") :
  installation of packagexml2had non-zero exit status

And my R version is

R.version
               _                           
platform       x86_64-redhat-linux-gnu     
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          3.1                         
year           2016                        
month          06                          
day            21                          
svn rev        70800                       
language       R                           
version.string R version 3.3.1 (2016-06-21)
nickname       Bug in Your Hair  

Can I get any help from you to solve this problem?
This is very important to me.
Thx,

@jimhester jimhester closed this in d36883c Jan 11, 2017
@jimhester
Copy link
Member

@jimhester jimhester commented Jan 17, 2017

Can you verify that this fixed the installation issues on centos 6 by running devtools::install_github("hadley/xml2")? Thanks!

@acoburn
Copy link

@acoburn acoburn commented Jan 18, 2017

I encountered a similar issue with the xml2 library on CentOS 6, and I can confirm that installing the package using devtools worked.

@lohithbb
Copy link

@lohithbb lohithbb commented Jan 23, 2017

I had this issue as well. But my version of R is 3.3.2.
I'm posting to verify that jimhester (Thank you!) solution does fix the problem. Also, just clarifying the dependency with the Rcpp package (there were issues with the compilers on the server due to build and release protocols).

I tried:

install.packages("xml2")

stdOut:

* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/libxml2
Using PKG_LIBS=-lxml2 -lz -lm
** libs
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c RcppExports.cpp -o RcppExports.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c connection.cpp -o connection.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_doc.cpp -o xml2_doc.o
xml2_doc.cpp: In function ‘Rcpp::IntegerVector xml_parse_options()’:
xml2_doc.cpp:129: warning: comparison between signed and unsigned integer expressions
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_init.cpp -o xml2_init.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_namespace.cpp -o xml2_namespace.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_node.cpp -o xml2_node.o
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/include/libxml2 -I/usr/local/include -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/Rcpp/include" -I"/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/BH/include"   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c xml2_output.cpp -o xml2_output.o
xml2_output.cpp: In function ‘Rcpp::IntegerVector xml_save_options()’:
xml2_output.cpp:45: error: ‘XML_SAVE_WSNONSIG’ was not declared in this scope
xml2_output.cpp: In function ‘int xml_write_callback(Rconn*, const char*, int)’:
xml2_output.cpp:61: warning: comparison between signed and unsigned integer expressions
make: *** [xml2_output.o] Error 1
ERROR: compilation failed for package ‘xml2’
* removing ‘/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/xml2’
* restoring previous ‘/home/rstudioserver/R/x86_64-redhat-linux-gnu-library/3.3/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status

My version:

> version
platform       x86_64-redhat-linux-gnu     
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          3.2                         
year           2016                        
month          10                          
day            31                          
svn rev        71607                       
language       R                           
version.string R version 3.3.2 (2016-10-31)
nickname       Sincere Pumpkin Patch   

In addition to running: devtools::install_github("hadley/xml2"), I had to reinstall Rcpp package (in addition to devtools) to get this work.

TLDR: try reinstalling Rcpp and devtools first, if it still does not work, then run: devtools::install_github("hadley/xml2")

@fangmn
Copy link

@fangmn fangmn commented Dec 4, 2018

@lohithbb

u can try

sudo apt-get install libcurl4-openssl-dev libxml2-dev

@lohithbb
Copy link

@lohithbb lohithbb commented Dec 18, 2018

@lohithbb

u can try

sudo apt-get install libcurl4-openssl-dev libxml2-dev

"apt-get" is not the package manager on centos 6 - you have to use yum (or install the packages manually with rpm -iVh. The problem was that this package was not available as part of centos repository and without access to the EPEL repository resolving this dependency was not possible.

You do not encounter this error in Centos 7 as these package dependencies are resolved automatically when R is installed.

My reply proposed a solution which does not require a package manager - it is distro-agnostic. See the TLDR at the bottom.

@sujayyaji
Copy link

@sujayyaji sujayyaji commented Mar 30, 2019

This works. Even I had the same issue. Thank you

@sago1611
Copy link

@sago1611 sago1611 commented May 4, 2019

@lohithbb your solution worked like a charm in my Ubuntu disto.

@elephanie
Copy link

@elephanie elephanie commented Jul 17, 2020

@lohithbb
Thanks for the solution. It works for Ubuntu 18.04 + R 4.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants