Search
Question: Issue when import genomic features from the file :Error in parseURI("") : cannot parse URI (issue resolved)
0
gravatar for JunLVI
6 months ago by
JunLVI40
Japan
JunLVI40 wrote:

(For people who met similar issue and seek resolution, you could directly just check the end of this post.) 

Hi, I was trying to do a RNA-seq analysis following the DESeq2 workflow. 

I did that not long time ago, without any big issue, now I shift my server, somehow the previous pipeline no longer work. 

Specifically, when I try to use "GenomicFeatures" to get read counts, I met an error:

library("GenomicFeatures")
(txdb <- makeTxDbFromGFF(gtffile, format="gtf", circ_seqs=character()))
#  Import genomic features from the file as a GRanges object ... Error in parseURI("") : cannot parse URI 

I could perform this step on my Mac, ( the reason I did not use Mac to do all the counting? I tried, but the read counting was not finished after  72hrs, so I assumed the counting was too heavy, shift my effort to do the counting on the cluster). 

but Mac could import genomic features make me reason that something is missing in my cluster system. 

Error in parseURI("") : cannot parse URI (rtracklayer package)seemed to have similar issue, and the issue solved by updating libxml2 to 2.9.1.

I tried, but it did not work out for me. 

I downloaded "libxml2-2-2.9.1-2.1.noarch.rpm"  (I am using CentOS5)

http://rpm.pbone.net/index.php3/stat/4/idpl/23647960/dir/centos_5/com/libxml2-2-2.9.1-2.1.noarch.rpm.html

rpm2cpio libxml2-2-2.9.1-2.1.noarch.rpm|cpio -i -d
export LD_LIBRARY_PATH=/host/myusername/Programme/curl-7.52.1/lib/:/host/myusername/Programme/libxml2-2-2-9-1/usr/lib/

echo $LD_LIBRARY_PATH # check the lib path setting 

/host/myusername/Programme/curl-7.52.1/lib/:/host/myusername/Programme/libxml2-2-2-9-1/usr/lib/

source .bashrc 

still met the same issue when using the GenomicFeature packages. 

 

Anyway since I could use the package on my Mac, I guess the problem is due to the fact something is missing in my system.

Further update:

I tried the workflow of DESeq2  using the example files in the "airway" package, 

having the same issue:

> library("airway")​

...

> library("GenomicFeatures")

> gtffile <- file.path(dir,"Homo_sapiens.GRCh37.75_subset.gtf")

> gtffile

[1] "/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/airway/extdata/Homo_sapiens.GRCh37.75_subset.gtf"

> txdb <- makeTxDbFromGFF(gtffile, format="gtf", circ_seqs=character())

Import genomic features from the file as a GRanges object ... Error in parseURI("") : cannot parse URI

 

On my Mac, things look Ok:

> library("GenomicFeatures")
> gtffile <- file.path(dir,"Homo_sapiens.GRCh37.75_subset.gtf")
> txdb <- makeTxDbFromGFF(gtffile, format="gtf", circ_seqs=character())
Import genomic features from the file as a GRanges object ... OK
Prepare the 'metadata' data frame ... OK
Make the TxDb object ... OK

Another update: 

it seemed that R-3.3.* requires a more current "libxml2.so.2" to work properly,

when I used R-3.2.5, the "libxml2.so.2" in my system seemed to work. 

 

> library("XML")

> XML::parseURI("")

$scheme

[1] ""


$authority

[1] ""


$server

[1] ""


$user

[1] ""


$path

[1] ""


$query

[1] ""


$fragment

[1] ""


$port

[1] NA


attr(,"class")

[1] "URI"

> path = unclass(getLoadedDLLs()[["XML"]])$path

> path

[1] "/host/somewhere/Jun/Programme/R-3.2.5/lib64/R/library/XML/libs/XML.so"

> system2("ldd",args=path)

    linux-vdso.so.1 =>  (0x00007fffe67ff000)

    libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002b59e8cc5000)

Any suggestion? TKS!

> sessionInfo()

R version 3.3.1 (2016-06-21)

Platform: x86_64-pc-linux-gnu (64-bit)


locale:

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              

 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    

 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   

 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 

 [9] LC_ADDRESS=C               LC_TELEPHONE=C            

[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       


attached base packages:

[1] parallel  stats4    stats     graphics  grDevices utils     datasets 

[8] methods   base     


other attached packages:

 [1] GenomicFeatures_1.24.5     AnnotationDbi_1.34.4      

 [3] Rsamtools_1.24.0           Biostrings_2.40.2         

 [5] XVector_0.12.1             DESeq2_1.12.4             

 [7] SummarizedExperiment_1.2.3 Biobase_2.32.0            

 [9] GenomicRanges_1.24.3       GenomeInfoDb_1.8.7        

[11] IRanges_2.6.1              S4Vectors_0.10.3          

[13] BiocGenerics_0.18.0       


loaded via a namespace (and not attached):

 [1] genefilter_1.54.2       locfit_1.5-9.1          splines_3.3.1          

 [4] lattice_0.20-34         colorspace_1.3-2        htmltools_0.3.5        

 [7] rtracklayer_1.32.2      base64enc_0.1-3         survival_2.40-1        

[10] XML_3.98-1.5            foreign_0.8-67          DBI_0.5-1              

[13] BiocParallel_1.6.6      RColorBrewer_1.1-2      plyr_1.8.4             

[16] stringr_1.2.0           zlibbioc_1.18.0         munsell_0.4.3          

[19] gtable_0.2.0            htmlwidgets_0.8         memoise_1.0.0          

[22] latticeExtra_0.6-28     knitr_1.15.1            biomaRt_2.28.0         

[25] geneplotter_1.50.0      htmlTable_1.9           Rcpp_0.12.9            

[28] acepack_1.4.1           xtable_1.8-2            backports_1.0.5        

[31] scales_0.4.1            checkmate_1.8.2         Hmisc_4.0-2            

[34] annotate_1.50.1         gridExtra_2.2.1         ggplot2_2.2.1          

[37] digest_0.6.12           stringi_1.1.2           grid_3.3.1             

[40] tools_3.3.1             bitops_1.0-6            magrittr_1.5           

[43] lazyeval_0.2.0          RCurl_1.95-4.8          tibble_1.2             

[46] RSQLite_1.1-2           Formula_1.2-1           cluster_2.0.5          

[49] Matrix_1.2-8            data.table_1.10.4       assertthat_0.1         

[52] rpart_4.1-10            GenomicAlignments_1.8.4 nnet_7.3-12

For people who has similar issue: 

in your R session 
> XML::parseURI("")

if you see:

>  Error in XML::parseURI("") : cannot parse URI 

You are having the same issue as mine: R (maybe R > 3.3.*) required a more current "libxml2"  to install "XML", 

the administrator is unlikely to update the system "libxml2" for you, because a lot of programs are compiled with it, new library might behave different in parsing. So a feasible approach is to compile a more current version of "libxml2" in your own directory. 

Then here is what you would do: 

Download the recent libxml2 http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html

following the instruction of the link above. 
Two points for installation:

1.

./configure --prefix=$HOME/Programme --disable-static --with-history --with-zlib=/somewhere/Jun/Programme/zlib-1.2.11 && make

 

you have to specify zlib (--with), also means that you have to have zlib installed. I had to add "--with" to make the configure work.

2. 

the instruction mentioned that you have to call " make install" as root user, no, you do not have to. 

3. set the PATH for your installed "libxml2". 

4. reinstall your R packages.

This is largely based on the suggestions from Mike and Martin, for details you could check their answers and my replies. 

ADD COMMENTlink modified 6 months ago • written 6 months ago by JunLVI40
2
gravatar for Mike Smith
6 months ago by
Mike Smith2.0k
EMBL Heidelberg / de.NBI
Mike Smith2.0k wrote:

Thanks for updating your post with your final set of steps to get a working package.

I've also written up my instructions in a slightly more concise form if anyone stumbles across this in the future at http://www.msmith.de/2017/03/06/using-your-own-version-of-libxml2-in-r/

ADD COMMENTlink modified 6 months ago • written 6 months ago by Mike Smith2.0k
1
gravatar for Mike Smith
6 months ago by
Mike Smith2.0k
EMBL Heidelberg / de.NBI
Mike Smith2.0k wrote:

I'm not particularly familiar with CentOS and RPMs, but with Ubuntu it's always the devel version of the package that provides headers etc. Perhaps you need this version: http://rpm.pbone.net/index.php3/stat/4/idpl/23647961/dir/centos_5/com/libxml2-devel-2.9.1-2.1.noarch.rpm.html

ADD COMMENTlink modified 6 months ago • written 6 months ago by Mike Smith2.0k

@Mike Smith, Thank for your kind suggestion.

Yes, I tried to add the "http://rpm.pbone.net/index.php3/stat/4/idpl/23647961/dir/centos_5/com/libxml2-devel-2.9.1-2.1.noarch.rpm.html"

 

[myname@host ~]$ echo $CPATH 
/u32/myname/Programme/zlib-1.2.11/include/:/u32/myname/Programme/bzip2-1.0.6/include/:/u32/myname/Programme/xz-5.2.3/include/:/u32/myname/Programme/libxml2-devel-2.9.1-2.1/usr/include/
[myname@host ~]$ echo $LD_LIBRARY_PATH 
/u32/myname/Programme/libxml2-devel-2.9.1-2.1/usr/lib/:/u32/myname/Programme/curl-7.52.1/lib/:/u32/myname/Programme/libtool_CentOS6_64/usr/lib64/:/misc/u32/myname/directory_for_rpm/usr/lib64:/u32/myname/Programme/gcc-6.1.0/lib/:/u32/myname/Programme/gcc-6.1.0/lib64/:/u32/myname/Programme/pcre-8.40/lib/:/u32/myname/Programme/xz-5.2.3/lib/:/u32/myname/Programme/zlib-1.2.11/include/:/u32/myname/Programme/zlib-1.2.11/lib/:/u32/myname/Programme/bzip2-1.0.6/lib/:/u32/myname/Programme/bzip2-1.0.6/include/:/u32/myname/Programme/gcc-6.1.0/lib/:/u32/myname/Programme/gcc-6.1.0/lib64/
[myname@host ~]$ echo $PATH 
/u32/myname/Programme/gcc-6.1.0/bin/:/u32/myname/Programme/curl-7.52.1/bin/:/u32/myname/Programme/bzip2-1.0.6/bin/:/u32/myname/Programme/libxml2-devel-2.9.1-2.1/usr/bin/:/u32/myname/.anaconda/bin/:/u32/myname/Programme/R-3.3.1/bin/:/opt/pgi/linux86-64/2010/bin:/u32/myname/Tool/tabix/:/u32/myname/Tool/hisat2-2.0.4/:/u32/myname/Tool/gffcompare/:/u32/myname/Tool/stringtie-1.3.0.Linux_x86_64/:/u32/myname/Tool/:/u32/myname/Tool/PeakSplitter_Cpp/PeakSplitter_Linux64/:/u32/myname/.R325/bin:/u32/myname/Tool/ngsplot/bin:/u32/myname/.anaconda/bin:/u32/myname/Tool/bowtie2-2.2.4/:/u32/myname/bin:/u32/myname/.local/bin:/u32/myname/Tool/:/u32/myname/Tool/Homer//bin/:/u32/myname/Tool/bowtie-1.1.2/:/u32/myname/Tool/userApps/bin/:/u32/myname/Programme/gcc-6.1.0/bin/:/u32/myname/Programme/curl-7.52.1/bin/:/u32/myname/Programme/bzip2-1.0.6/bin/:/u32/myname/Programme/libxml2-devel-2.9.1-2.1/usr/bin/:/u32/myname/.anaconda/bin/:/u32/myname/Programme/R-3.3.1/bin/:/opt/pgi/linux86-64/2010/bin:/usr/lib64/qt-3.3/bin:/opt/protein/bin:/home/appl/openmpi-1.3.1/bin:/opt22/lsf83_exp/8.3/linux2.6-glibc2.3-x86_64/etc:/opt22/lsf83_exp/8.3/linux2.6-glibc2.3-x86_64/bin:/usr/local/bin:/bin:/usr/bin:/opt/dell/srvadmin/bin​

I also deleted the binary files of R and recompiled

but still got the error:

> library("GenomicFeatures")

Loading required package: AnnotationDbi

> (txdb <- makeTxDbFromGFF(gtffile, format="gtf", circ_seqs=character()))

Import genomic features from the file as a GRanges object ... Error in parseURI("") : cannot parse URI

Any suggestion is highly appreciated. 

ADD REPLYlink written 6 months ago by JunLVI40
1
gravatar for Hervé Pagès
6 months ago by
Hervé Pagès ♦♦ 12k
United States
Hervé Pagès ♦♦ 12k wrote:

Hi,

You seem to be using Bioconductor 3.3 which is not supported anymore. Please update your installation to use the current version of Bioconductor (BioC 3.4). Then install rtracklayer with biocLite("rtracklayer"). This will automatically install dependencies XML and RCurl. Pay special attention to the output during installation of these 2 deps and show it to us in case the problem persists.

Thanks,

H.

ADD COMMENTlink written 6 months ago by Hervé Pagès ♦♦ 12k

@Hervé Pagès, thanks very much for your suggestion. 

I tried updating the Bioconductor to the current version. the "rtracklayer" was automatically updated as a dependency of DESeq2. Nonetheless, I installed rtracklayer with command, but the problem did persist, any further suggestion? 

 biocLite("rtracklayer")

> library("GenomicFeatures")

> (txdb <- makeTxDbFromGFF(gtffile, format="gtf", circ_seqs=character()))

Import genomic features from the file as a GRanges object ... Error in parseURI("") : cannot parse URI

For output in details ( the full output is too long, I left out some parts, if further information is needed, please let me know. 

 >          biocLite("BiocUpgrade")
Upgrade all packages to Bioconductor version 3.4? [y/n]: y
trying URL 'http://bioconductor.org/packages/3.4/bioc/src/contrib/BiocInstaller_1.24.0.tar.gz'
Content type 'application/x-gzip' length 17756 bytes (17 KB)
==================================================
downloaded 17 KB

* installing *source* package ‘BiocInstaller’ ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Bioconductor version 3.4 (BiocInstaller 1.24.0), ?biocLite for help
* DONE (BiocInstaller)

...

... 
 installing *source* package ‘rtracklayer’ ...
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for OPENSSL... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -I/u32/myname/Programme/R-3.3.1/lib64/R/include -DNDEBUG -D_FILE_OFFSET_BITS=64 -I//u32/myname/Programme/zlib-1.2.11/include -I//u32/myname/Programme/bzip2-1.0.6/include -I//u32/myname/Programme/xz-5.2.3/include -I//u32/myname/Programme/pcre-8.40/include -I//u32/myname/Programme/curl-7.52.1/include -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/S4Vectors/include" -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/IRanges/include" -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/XVector/include"   -fpic  -g -O2  -c S4Vectors_stubs.c -o S4Vectors_stubs.o

...
gcc -I/u32/myname/Programme/R-3.3.1/lib64/R/include -DNDEBUG -D_FILE_OFFSET_BITS=64 -I//u32/myname/Programme/zlib-1.2.11/include -I//u32/myname/Programme/bzip2-1.0.6/include -I//u32/myname/Programme/xz-5.2.3/include -I//u32/myname/Programme/pcre-8.40/include -I//u32/myname/Programme/curl-7.52.1/include -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/S4Vectors/include" -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/IRanges/include" -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/XVector/include"   -fpic  -g -O2  -c ucsc/dnautil.c -o ucsc/dnautil.o
ucsc/dnautil.c: In function ‘reverseComplementSlashSeparated’:
ucsc/dnautil.c:496:9: warning: implicit declaration of function ‘isAllNt’ [-Wimplicit-function-declaration]
     if (isAllNt(allele, alLen))
         ^~~~~~~
gcc -I/u32/myname/Programme/R-3.3.1/lib64/R/include -DNDEBUG -D_FILE_OFFSET_BITS=64 -I//u32/myname/Programme/zlib-1.2.11/include -I//u32/myname/Programme/bzip2-1.0.6/include -I//u32/myname/Programme/xz-5.2.3/include -I//u32/myname/Programme/pcre-8.40/include -I//u32/myname/Programme/curl-7.52.1/include -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/S4Vectors/include" -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/IRanges/include" -I"/misc/u32/myname/Programme/R-3.3.1/lib64/R/library/XVector/include"   -fpic  -g -O2  -c ucsc/errAbort.c -o ucsc/errAbort.o

...
gcc -shared -L/u32/myname/Programme/R-3.3.1/lib64/R/lib -L//u32/myname/Programme/zlib-1.2.11/lib -L//u32/myname/Programme/bzip2-1.0.6/lib -L//u32/myname/Programme/xz-5.2.3/lib -L//u32/myname/Programme/pcre-8.40/lib -L//u32/myname/Programme/curl-7.52.1/lib -o rtracklayer.so S4Vectors_stubs.o IRanges_stubs.o XVector_stubs.o R_init_rtracklayer.o readGFF.o bigWig.o chain_io.o twoBit.o handlers.o utils.o ucsc/bPlusTree.o ucsc/bbiRead.o ucsc/bbiWrite.o ucsc/bwgCreate.o ucsc/bwgQuery.o ucsc/cirTree.o ucsc/common.o ucsc/dnaseq.o ucsc/dnautil.o ucsc/errAbort.o ucsc/hash.o ucsc/linefile.o ucsc/localmem.o ucsc/sqlNum.o ucsc/zlibFace.o ucsc/dystring.o ucsc/hmmstats.o ucsc/obscure.o ucsc/pipeline.o ucsc/rangeTree.o ucsc/rbTree.o ucsc/memalloc.o ucsc/dlist.o ucsc/udc.o ucsc/net.o ucsc/bits.o ucsc/twoBit.o ucsc/_cheapcgi.o ucsc/internet.o ucsc/https.o ucsc/base64.o ucsc/verbose.o ucsc/os.o ucsc/wildcmp.o ucsc/_portimpl.o -lz -pthread -L/u32/myname/Programme/R-3.3.1/lib64/R/lib -lR
installing to /misc/u32/myname/Programme/R-3.3.1/lib64/R/library/rtracklayer/libs
...
* DONE (rtracklayer)
ADD REPLYlink written 6 months ago by JunLVI40

Maybe try to re-install RCurl and XML:

biocLite("RCurl")
biocLite("XML")

If that doesn't solve the problem then it might help to show us the output of these 2 commands.

H.

ADD REPLYlink written 6 months ago by Hervé Pagès ♦♦ 12k

@ Hervé Pagès

Thank you for your suggestion. Yes, I tried to re-install RCurl and XML, but the issue persisted. 

Here is output of those two installation ( installations were done  without no overt errors, but some warnings during the process of installation)

>     biocLite("RCurl")

Using Bioconductor 3.4 (BiocInstaller 1.24.0), R 3.3.1 (2016-06-21).

...

base64.c: In function ‘R_base64_decode’:
base64.c:23:10: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
     text = CHAR(STRING_ELT(r_text, 0));
          ^
In file included from /u32/myname/Programme/curl-7.52.1/include/curl/curl.h:2515:0,
                 from Rcurl.h:4,
                 from curl.c:1:
curl.c: In function ‘getCurlInfoElement’:

...


/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:56:9: warning: call to ‘_curl_easy_setopt_err_write_callback’ declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option
         _curl_easy_setopt_err_write_callback();                               \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:56:9: note: in definition of macro ‘curl_easy_setopt’
         _curl_easy_setopt_err_write_callback();                               \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:56:9: warning: call to ‘_curl_easy_setopt_err_write_callback’ declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option
         _curl_easy_setopt_err_write_callback();                               \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:56:9: note: in definition of macro ‘curl_easy_setopt’
         _curl_easy_setopt_err_write_callback();                               \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:74:9: warning: call to ‘_curl_easy_setopt_err_debug_cb’ declared with attribute warning: curl_easy_setopt expects a curl_debug_callback argument for this option
         _curl_easy_setopt_err_debug_cb();                                     \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
curl.c:179:14: note: in expansion of macro ‘curl_easy_setopt’
    status =  curl_easy_setopt(obj, opt, &R_curl_debug_callback);
              ^~~~~~~~~~~~~~~~
/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:56:9: warning: call to ‘_curl_easy_setopt_err_write_callback’ declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option
         _curl_easy_setopt_err_write_callback();                               \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:56:9: note: in definition of macro ‘curl_easy_setopt’
         _curl_easy_setopt_err_write_callback();                               \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:71:9: warning: call to ‘_curl_easy_setopt_err_progress_cb’ declared with attribute warning: curl_easy_setopt expects a curl_progress_callback argument for this option
         _curl_easy_setopt_err_progress_cb();                                  \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/u32/myname/Programme/curl-7.52.1/include/curl/typecheck-gcc.h:71:9: note: in definition of macro ‘curl_easy_setopt’
         _curl_easy_setopt_err_progress_cb();                                  \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
myUTF8.c: In function ‘StringValue’:
myUTF8.c:284:26: warning: passing argument 1 of ‘Rf_mkCharLenCE’ from incompatible pointer type [-Wincompatible-pointer-types]
     yylval = mkCharLenCE(wcs, wcnt, CE_UTF8); /* include terminator */
                          ^~~
In file included from /u32/myname/Programme/R-3.3.1/lib64/R/include/Rdefines.h:36:0,
                 from myUTF8.c:3:
/u32/myname/Programme/R-3.3.1/lib64/R/include/Rinternals.h:901:6: note: expected ‘const char *’ but argument is of type ‘ucs_t * {aka int *}’
 SEXP Rf_mkCharLenCE(const char *, int, cetype_t);
      ^~~~~~~~~~~~~~
installing to /misc/u32/myname/Programme/R-3.3.1/lib64/R/library/RCurl/libs

...

** testing if installed package can be loaded

* DONE (RCurl)
ADD REPLYlink modified 6 months ago • written 6 months ago by JunLVI40

The full output is just too long even after leaving out some parts, so I put it here as two replies.

> biocLite("XML")
BioC_mirror: http://bioconductor.org
Using Bioconductor 3.4 (BiocInstaller 1.24.0), R 3.3.1 (2016-06-21).
Installing package(s) ‘XML’
trying URL 'http://cran.rstudio.com/src/contrib/XML_3.98-1.5.tar.gz'
Content type 'application/x-gzip' length 1599213 bytes (1.5 MB)
==================================================
downloaded 1.5 MB
...
NodeGC.c: In function ‘clearNodeMemoryManagement’:
NodeGC.c:385:96: warning: comparison between pointer and integer
  int isOurs = (a = node->_private != &R_XML_NoMemoryMgmt) && (b = ((int *)(node->_private))[1] == (int *) &R_XML_MemoryMgrMarker);

XMLTree.c: In function ‘R_xmlSearchNs’:
XMLTree.c:1695:39: warning: comparison of distinct pointer types lacks a cast
     xmlDocPtr doc = (xmlDocPtr) r_doc == NULL_USER_OBJECT ? NULL : R_ExternalPtrAddr(r_doc);

** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘source’ from package ‘base’ in package ‘XML’
in method for ‘xmlAttrsToDataFrame’ with signature ‘"AsIs"’: no definition for class “AsIs”
in method for ‘readKeyValueDB’ with signature ‘"AsIs"’: no definition for class “AsIs”
in method for ‘readSolrDoc’ with signature ‘"AsIs"’: no definition for class “AsIs”

installing to /host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/XML/libs

** R

** inst

** preparing package for lazy loading

Creating a generic function for ‘source’ from package ‘base’ in package ‘XML’

in method for ‘xmlAttrsToDataFrame’ with signature ‘"AsIs"’: no definition for class “AsIs”

in method for ‘readKeyValueDB’ with signature ‘"AsIs"’: no definition for class “AsIs”

in method for ‘readSolrDoc’ with signature ‘"AsIs"’: no definition for class “AsIs”

** help

*** installing help indices

** building package indices

** testing if installed package can be loaded

* DONE (XML)

The original error when trying to use "GenomicFeatures":

> library("GenomicFeatures")

Loading required package: AnnotationDbi

> (txdb <- makeTxDbFromGFF(gtffile, format="gtf", circ_seqs=character()))

Import genomic features from the file as a GRanges object ... Error in parseURI("") : cannot parse URI

 

ADD REPLYlink modified 6 months ago • written 6 months ago by JunLVI40
1
gravatar for Martin Morgan
6 months ago by
Martin Morgan ♦♦ 20k
United States
Martin Morgan ♦♦ 20k wrote:

Simplify your problem, which I believe is just, in a brand-new R session,

XML::parseURI("")

The version of the libxml library found / in use by the XML package is

> libxmlVersion()
$major
[1] "2"

$minor
[1] "09"

$patch
[1] "03"

If this is not a recent version (I would guess that 2.9.1 is 'recent'), then the task is to install the recent version in a way that R will find it. It may help to know the path to the XML2 shared object in use

> path = unclass(getLoadedDLLs()[["XML"]])$path
> path
[1] "/home/mtmorgan/R/x86_64-pc-linux-gnu-library/3.4-Bioc-3.5/XML/libs/XML.so"

And retrieve information about the version of the libxml2 library you're linking to

> system2("ldd",args=path)
    linux-vdso.so.1 =>  (0x00007ffcaf0c6000)
    libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fd36f656000)
...

Getting the correct version of the XML library is really specific to your end; if possible use your OS package manager to install libxml2 (yum install libxml2-devel ?)

When installing the XML package, the useful information is at the top; for me I have the following output, annotated...

> BiocInstaller::biocLite("XML")
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.5 (BiocInstaller 1.25.3), R Under development (unstable)
  (2017-02-16 r72193).
Installing package(s) ‘XML’
trying URL 'https://cran.rstudio.com/src/contrib/XML_3.98-1.5.tar.gz'

3.98-1.5 is the current version of XML, good!

Content type 'application/x-gzip' length 1599213 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking for xml2-config... /usr/bin/xml2-config

Using xml2-config to configure XML; your system may be different

USE_XML2 = yes
SED_EXTENDED_ARG: -E
Minor 9, Patch 3 for 2.9.3

Perfect, the version of the library found during compilation; I don't know whether this will always be reported

Located parser file -I/usr/include/libxml2/parser.h
Checking for 1.8:  -I/usr/include/libxml2
Using libxml2.*
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... yes
checking for xmlHashSize in -lxml2... yes
Using built-in xmlHashSize
Checking DTD parsing (presence of externalSubset)...
checking for xmlHashSize in -lxml2... yes
Found xmlHashSize
checking for xmlOutputBufferCreateBuffer in -lxml2... yes
have xmlOutputBufferCreateBuffer()
checking for xmlDocDumpFormatMemoryEnc in -lxml2... yes
checking libxml/xmlversion.h usability... yes
checking libxml/xmlversion.h presence... yes
checking for libxml/xmlversion.h... yes
Expat:  FALSE
Checking for return type of xmlHashScan element routine.
No return value for xmlHashScan
xmlNs has a context field
Checking for cetype_t enumeration
Using recent version of R with cetype_t enumeration type for encoding
checking for xmlsec1-config... no
nodegc default 
xml-debug default 
Version has XML_WITH_ZLIB
Version has xmlHasFeature()

****************************************
Configuration information:

Libxml settings

libxml include directory: -I/usr/include/libxml2

The path to the discovered library

libxml library directory: -lxml2 -lz  -lxml2
libxml 2:                 -DLIBXML2=1
ADD COMMENTlink modified 6 months ago • written 6 months ago by Martin Morgan ♦♦ 20k

@Martin Morgan. Hi Martin, Thank you very much for your insightful suggestion. 

> path = unclass(getLoadedDLLs()[["XML"]])$path
> path
[1] "/host/home/Jun/Programme/R-3.3.1/lib64/R/library/XML/libs/XML.so"
> system2("ldd",args=path)
                linux-vdso.so.1 =>  (0x00007fff2a9e8000)
                libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002aefc088a000)  # XML is using a common "libxml2.so.2" not the one I installed.
                libz.so.1 => //home/Jun/Programme/zlib-1.2.11/lib/libz.so.1 (0x00002aefc0bc8000)
                libm.so.6 => /lib64/libm.so.6 (0x00002aefc0de5000)
                libdl.so.2 => /lib64/libdl.so.2 (0x00002aefc1068000)
                libxmlsec1.so.1 => /usr/lib64/libxmlsec1.so.1 (0x00002aefc126c000)
                libxslt.so.1 => /usr/lib64/libxslt.so.1 (0x00002aefc14d0000)
                librt.so.1 => /lib64/librt.so.1 (0x00002aefc1705000)
                libR.so => /home/Jun/Programme/R-3.3.1/lib64/R/lib/libR.so (0x00002aefc190e000)
                libc.so.6 => /lib64/libc.so.6 (0x00002aefc1f55000)
                /lib64/ld-linux-x86-64.so.2 (0x0000003cad400000)
                libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aefc22ae000)
                libRblas.so => /home/Jun/Programme/R-3.3.1/lib64/R/lib/libRblas.so (0x00002aefc24cb000)
                libgfortran.so.1 => /usr/lib64/libgfortran.so.1 (0x00002aefc26f6000)
                libreadline.so.5 => /usr/lib64/libreadline.so.5 (0x00002aefc298d000)
                libncurses.so.5 => /usr/lib64/libncurses.so.5 (0x00002aefc2bcb000)
                libpcre.so.1 => //home/Jun/Programme/pcre-8.40/lib/libpcre.so.1 (0x00002aefc2e28000)
                liblzma.so.5 => //home/Jun/Programme/xz-5.2.3/lib/liblzma.so.5 (0x00002aefc304f000)
                libgomp.so.1 => /home/Jun/Programme/gcc-6.1.0/lib64/libgomp.so.1 (0x00002aefc3277000)

 

but somehow I managed to put my own libxml2.so.2 in the
LD_LIBRARY_PATH:

 

/somewhere/Jun/Programme/pcre-8.40/lib/:/somewhere/Jun/Programme/xz-5.2.3/lib/:/somewhere/Jun/Programme/zlib-1.2.11/include/:/somewhere/Jun/Programme/zlib-1.2.11/lib/:/somewhere/Jun/Programme/bzip2-1.0.6/lib/:/somewhere/Jun/Programme/bzip2-1.0.6/include/:/somewhere/Jun/Programme/gcc-6.1.0/lib/:/somewhere/Jun/Programme/gcc-6.1.0/lib64/:/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/lib/:/somewhere/Jun/Programme/curl-7.52.1/lib/:/somewhere/Jun/Programme/libtool_CentOS6_64/usr/lib64/:/home/appl/openmpi-1.3.1/lib:/opt22/lsf83_exp/8.3/linux2.6-glibc2.3-x86_64/lib:/opt/ups/lib

Somehow R could not find the libxml2.so.2 installed in my directory

so I guess I need the trick to let R find my ibxml2.so.2

Then I noticed that

libpcre.so.1 => //home/Jun/Programme/pcre-8.40/lib/libpcre.so.1 (0x00002aefc2e28000)
liblzma.so.5 => //home/Jun/Programme/xz-5.2.3/lib/liblzma.so.5 (0x00002aefc304f000)
libgomp.so.1 => /home/Jun/Programme/gcc-6.1.0/lib64/libgomp.so.1 (0x00002aefc3277000)

“pcre”, “lzma” are the lib I specified when I  configured my R I was about to install,

./configure --prefix=$HOME/Programme/R-3.3.1 --enable-R-shlib LDFLAGS="-L/$HOME/Programme/zlib-1.2.11/lib -L/$HOME/Programme/bzip2-1.0.6/lib -L/$HOME/Programme/xz-5.2.3/lib -L/$HOME/Programme/pcre-8.40/lib -L/$HOME/Programme/curl-7.52.1/lib " CPPFLAGS="-I/$HOME/Programme/zlib-1.2.11/include -I/$HOME/Programme/bzip2-1.0.6/include -I/$HOME/Programme/xz-5.2.3/include -I/$HOME/Programme/pcre-8.40/include -I/$HOME/Programme/curl-7.52.1/include"

 

ADD REPLYlink modified 6 months ago • written 6 months ago by JunLVI40

(This is too long for one comment...)

so I speculated that I could coerce R use my libxml2 by configuration (maybe I have done that with the “–enable” to “libpcre.so.1”), so I re configuration (re compile) R:

./configure --prefix=$HOME/Programme/R-3.3.1 --enable-R-shlib LDFLAGS="-L/$HOME/Programme/zlib-1.2.11/lib -L/$HOME/Programme/bzip2-1.0.6/lib -L/$HOME/Programme/xz-5.2.3/lib -L/$HOME/Programme/pcre-8.40/lib -L/$HOME/Programme/curl-7.52.1/lib -L/$HOME/Programme/libxml2-devel-2.9.1-2.1/usr/lib" CPPFLAGS="-I/$HOME/Programme/zlib-1.2.11/include -I/$HOME/Programme/bzip2-1.0.6/include -I/$HOME/Programme/xz-5.2.3/include -I/$HOME/Programme/pcre-8.40/include -I/$HOME/Programme/curl-7.52.1/include -I/$HOME/Programme/libxml2-devel-2.9.1-2.1/usr/include"

echo $LD_LIBRARY_PATH # also check whether I put libxml-devel in PATH
/somewhere/Jun/Programme/pcre-8.40/lib/:/somewhere/Jun/Programme/xz-5.2.3/lib/:/somewhere/Jun/Programme/zlib-1.2.11/include/:/somewhere/Jun/Programme/zlib-1.2.11/lib/:/somewhere/Jun/Programme/bzip2-1.0.6/lib/:/somewhere/Jun/Programme/bzip2-1.0.6/include/:/somewhere/Jun/Programme/gcc-6.1.0/lib/:/somewhere/Jun/Programme/gcc-6.1.0/lib64/:/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/lib/:/somewhere/Jun/Programme/curl-7.52.1/lib/:/somewhere/Jun/Programme/libtool_CentOS6_64/usr/lib64/:/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/include/:/somewhere/Jun/Programme/pcre-8.40/lib/:/somewhere/Jun/Programme/xz-5.2.3/lib/:/somewhere/Jun/Programme/zlib-1.2.11/include/:/somewhere/Jun/Programme/zlib-1.2.11/lib/:/somewhere/Jun/Programme/bzip2-1.0.6/lib/:/somewhere/Jun/Programme/bzip2-1.0.6/include/:/somewhere/Jun/Programme/gcc-6.1.0/lib/:/somewhere/Jun/Programme/gcc-6.1.0/lib64/:/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/lib/:/somewhere/Jun/Programme/curl-7.52.1/lib/:/somewhere/Jun/Programme/libtool_CentOS6_64/usr/lib64/:/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/include/:/home/appl/openmpi-1.3.1/lib:/opt22/lsf83_exp/8.3/linux2.6-glibc2.3-x86_64/lib:/opt/ups/lib​

Unfortunately, I did not resolve the issue:

> library("XML")

> XML::parseURI("")

Error in XML::parseURI("") : cannot parse URI 

> libxmlVersion()

$major

[1] "2"


$minor

[1] "06"


$patch

[1] "26"


> path = unclass(getLoadedDLLs()[["XML"]])$path

> path


> library("XML")
> XML::parseURI("")
Error in XML::parseURI("") : cannot parse URI 
> libxmlVersion()
$major
[1] "2"

$minor
[1] "06"

$patch
[1] "26"

> path = unclass(getLoadedDLLs()[["XML"]])$path
> path
[1] "/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/XML/libs/XML.so"
> system2("ldd",args=path)
    linux-vdso.so.1 =>  (0x00007fff4a9b7000)
    libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002aea7f7d7000)
    libz.so.1 => //somewhere/Jun/Programme/zlib-1.2.11/lib/libz.so.1 (0x00002aea7fb15000)
    libm.so.6 => /lib64/libm.so.6 (0x00002aea7fd32000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00002aea7ffb5000)
    libxmlsec1.so.1 => /usr/lib64/libxmlsec1.so.1 (0x00002aea801b9000)
    libxslt.so.1 => /usr/lib64/libxslt.so.1 (0x00002aea8041d000)
    librt.so.1 => /lib64/librt.so.1 (0x00002aea80652000)
    libR.so => /somewhere/Jun/Programme/R-3.3.1/lib64/R/lib/libR.so (0x00002aea8085b000)
    libc.so.6 => /lib64/libc.so.6 (0x00002aea80ea2000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003cad400000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002aea811fb000)
    libRblas.so => /somewhere/Jun/Programme/R-3.3.1/lib64/R/lib/libRblas.so (0x00002aea81418000)
    libgfortran.so.1 => /usr/lib64/libgfortran.so.1 (0x00002aea81643000)
    libreadline.so.5 => /usr/lib64/libreadline.so.5 (0x00002aea818da000)
    libncurses.so.5 => /usr/lib64/libncurses.so.5 (0x00002aea81b18000)
    libpcre.so.1 => //somewhere/Jun/Programme/pcre-8.40/lib/libpcre.so.1 (0x00002aea81d75000)
    liblzma.so.5 => //somewhere/Jun/Programme/xz-5.2.3/lib/liblzma.so.5 (0x00002aea81f9c000)
    libgomp.so.1 => /somewhere/Jun/Programme/gcc-6.1.0/lib64/libgomp.so.1 (0x00002aea821c4000)ƒ

Somehow it still did not work, but at least I felt that I am closer to solve the issue, and confirmed that you are right: R could not find the libdl.so.2 in my directory.
I wonder you might have ideas when the new information mentioned above, if you do, please let me know.

Thanks very much.
 Jun

ADD REPLYlink written 6 months ago by JunLVI40
1

I think the XML package is using the information returned by xml-config to identify the library, and it is finding the system xml-config. I downloaded the XML source code

> download.packages("XML", "/tmp", repos=BiocInstaller::biocinstallRepos())
trying URL 'https://cran.rstudio.com/src/contrib/XML_3.98-1.5.tar.gz'
Content type 'application/x-gzip' length 1599213 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

     [,1]  [,2]                      
[1,] "XML" "/tmp/XML_3.98-1.5.tar.gz"

then at the system level unpacked and asked about configure options

/tmp$ tar xzf ~/Downloads/XML_3.98-1.5.tar.gz
/tmp$ cd XML
/tmp/XML$ ./configure --help
...
 --with-xml-config    the name of the xml-config program to use.

I think you can then install as

/tmp/XML$ R CMD INSTALL --configure-args="--with-xml-config=/path/to/your/xml-config" .

or from within R

biocLite("XML",
    configure.args='--with-xml-config="/path/to/your/xml-config"'
)

(the configure.args argument comes from ?install.packages).

ADD REPLYlink modified 6 months ago • written 6 months ago by Martin Morgan ♦♦ 20k

@Marin Morgan, Thanks.  I tried to follow your suggestion. I guess that I managed to define xml-config. Somehow R automatically tried to get parser file from system libxml2 and performed the configuration using system libxml, despite the fact I xml-config was defined.

I am trying to figure out how to solve that, if some ideas strike you, please kindly let me know. 

biocLite("XML",configure.args='--with-xml-config="/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/bin/xml2-config"')

BioC_mirror: http://bioconductor.org
Using Bioconductor 3.4 (BiocInstaller 1.24.0), R 3.3.1 (2016-06-21).
Installing package(s) ‘XML’
trying URL 'http://cran.rstudio.com/src/contrib/XML_3.98-1.5.tar.gz'
Content type 'application/x-gzip' length 1599213 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
User defined xml-config: /somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/bin/xml2-config, XML Version: 2, XML2: yes
USE_XML2 = yes
SED_EXTENDED_ARG: -r
Minor 9, Patch 1 for 2.9.1
Located parser file -I/usr/include/libxml2/parser.h
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... yes
checking for xmlHashSize in -lxml2... yes
Using built-in xmlHashSize
Checking DTD parsing (presence of externalSubset)...
checking for xmlHashSize in -lxml2... yes
Found xmlHashSize
checking for xmlOutputBufferCreateBuffer in -lxml2... yes
have xmlOutputBufferCreateBuffer()
checking for xmlDocDumpFormatMemoryEnc in -lxml2... yes
checking libxml/xmlversion.h usability... yes
checking libxml/xmlversion.h presence... yes
checking for libxml/xmlversion.h... yes
Expat:  FALSE
Checking for return type of xmlHashScan element routine.
No return value for xmlHashScan
xmlNs has a context field
Checking for cetype_t enumeration
Using recent version of R with cetype_t enumeration type for encoding
checking for xmlsec1-config... /usr/bin/xmlsec1-config
nodegc default
xml-debug default
No XML_WITH_ZLIB enumeration value.
Version has xmlHasFeature()

****************************************
Configuration information:

Libxml settings

libxml include directory: -I/usr/include/libxml2
libxml library directory: -lxml2 -lz -lm -ldl -lz  -lxml2
libxml 2:                 -DLIBXML2=1

Compilation flags:         -DLIBXML -I/usr/include/libxml2 -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DNO_CHECKED_ENTITY_FIELD=1 -DDUMP_WITH_ENCODING=1 -DUSE_XML_VERSION_H=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1 -DNO_XML_HASH_SCANNER_RETURN=1 -DLIBXML_NAMESPACE_HAS_CONTEXT=1 -DHAVE_R_CETYPE_T=1 -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_XKMS=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -I/somewhere/Jun/.anaconda/include -I/somewhere/Jun/.anaconda/include/libxml2 -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1 -DXMLSEC_CRYPTO=\"openssl\" -DHAVE_XML_HAS_FEATURE=1 -DUSE_R=1 -D_R_=1  -DHAVE_VALIDITY=1 -DXML_REF_COUNT_NODES=1 -DHAVE_LIBXML_SEC=1
Link flags:               -lxml2 -lz -lm -ldl -lz  -lxml2 -L/usr/lib64 -L/somewhere/Jun/.anaconda/lib -lxmlsec1 -lxslt -lxml2 -lz -ldl -lm -lrt
ADD REPLYlink written 6 months ago by JunLVI40

What do you get when you run xml2-config outside of R?  It looks like your config still ends up pointing at the system libraries, which isn't what happens on my machine.  What's the output of these two commands?

/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/bin/xml2-config --libs

and 

/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/bin/xml2-config --cflags

For me both of these point to locations where I've unpacked my own version of libxml2, so something like:

-I/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/include/libxml2

which I can see matches what's printed when I install the library in R.

ADD REPLYlink modified 6 months ago • written 6 months ago by Mike Smith2.0k

Hi Mike, thanks very much for your suggestion:

which xml2-config
~/Programme/libxml2-devel-2.9.1-2.1/usr/bin/xml2-config  # xml2-config is the one I installed

xml2-config --cflags
-I/usr/include/libxml2 

xml2-config --libs
-lxml2 -lz -lm -ldl  # the xml2-config points at the system libraries. 

less xml2-config  # check the inside of the xml2-config which I installed. 

#! /bin/sh

prefix=/usr
exec_prefix=/usr
includedir=/usr/include
libdir=/usr/lib
...

it looks as if the configure file points at system files.  Should I modify it into something like: 

#! /bin/sh

prefix=/usr
exec_prefix=/usr
includedir=/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/include
libdir=/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/lib
...
ADD REPLYlink modified 6 months ago • written 6 months ago by JunLVI40

I guess you could try editing it by hand, but I would be worried about typing something incorrectly and messing it up even more.  

My approach would be to build and install libxml2 from source, rather than unpacking the RPM.  You seem comfortable building R, and you've got a much newer GCC than CentOS has so I guess you built that too, so it shouldn't be very hard.

You can get the source and installation instructions here: http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html Just remember to change --prefix=/usr to something like --prefix=$HOME/Programme/ as this specifies where it should be installed to.

ADD REPLYlink modified 6 months ago • written 6 months ago by Mike Smith2.0k

Hi Mike. I guess  that I managed to install the libxml2, but something remains missing.If you have any idea, eager to know. TKS!

 

./configure --prefix=$HOME/Programme --disable-static --with-history --with-zlib=/somewhere/Jun/Programme/zlib-1.2.11 && make
make install #  http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html the link you refer to instruct to call "make install" as root user, I am not, call "make install" anyway...
...
make[5]: Leaving directory `/host/somewhere/Jun/Tool/libxml2-2.9.4/python/tests'
make[4]: Leaving directory `/host/somewhere/Jun/Tool/libxml2-2.9.4/python/tests'
make[3]: Leaving directory `/host/somewhere/Jun/Tool/libxml2-2.9.4/python'
make[2]: Leaving directory `/host/somewhere/Jun/Tool/libxml2-2.9.4/python'
make[1]: Leaving directory `/host/somewhere/Jun/Tool/libxml2-2.9.4'
...

 which xml2-config
~/Programme/bin/xml2-config
xml2-config --cflags
-I/somewhere/Jun/Programme/include/libxml2
xml2-config --libs
-L/somewhere/Jun/Programme/lib -lxml2 -lz -lm -ldl

Usage: xml2-config [OPTION]

Known values for OPTION are:

  --prefix=DIR        change libxml prefix [default /somewhere/Jun/Programme]
  --exec-prefix=DIR    change libxml exec prefix [default /somewhere/Jun/Programme]
  --libs        print library linking information
  --cflags        print pre-processor and compiler flags
  --modules        module support enabled
  --help        display this help and exit
  --version        output version information

Bioconductor version 3.4 (BiocInstaller 1.24.0), ?biocLite for help
> biocLite("XML",configure.args='--with-xml-config="/somewhere/Jun/Programme/bin/xml2-config"')
BioC_mirror: http://bioconductor.org
Using Bioconductor 3.4 (BiocInstaller 1.24.0), R 3.3.1 (2016-06-21).
Installing package(s) ‘XML’
trying URL 'http://cran.rstudio.com/src/contrib/XML_3.98-1.5.tar.gz'
Content type 'application/x-gzip' length 1599213 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
User defined xml-config: /somewhere/Jun/Programme/bin/xml2-config, XML Version: 2, XML2: yes
USE_XML2 = yes
SED_EXTENDED_ARG: -r
Minor 9, Patch 4 for 2.9.4
Located parser file -I/somewhere/Jun/Programme/include/libxml2/parser.h
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... no
checking for xmlParseFile in -lxml... no
configure: error: "libxml not found"
ERROR: configuration failed for package ‘XML’
* removing ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/XML’
* restoring previous ‘/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/XML’

The downloaded source packages are in
    ‘/tmp/RtmpnNZWNF/downloaded_packages’
Warning message:
In install.packages(pkgs = doing, lib = lib, ...) :
  installation of package ‘XML’ had non-zero exit status
....  

someone seems to have similar issue, solved by

 

 

brew link libxml2 --force
#I tried:
[Jun@host ~]$ brew link libxml2 --force
-bash: brew: command not found

I am not familiar with brew command, maybe not included in CentOS. 

ADD REPLYlink written 6 months ago by JunLVI40
# I tweaked the xml2-config into something like: 

#! /bin/sh

prefix=/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr
exec_prefix=/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr
includedir=/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/include
libdir=/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/lib

# now  config points to the libraries, like yours
[Jun@host ~]$ xml2-config --cflags
-I/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/include/libxml2
[Jun@host ~]$ xml2-config --libs
-L/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/lib -lxml2 -lz -lm -ldl

# install "XML" specifying the config files
> biocLite("XML",configure.args='--with-xml-config="/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/bin/xml2-config"')
BioC_mirror: http://bioconductor.org
Using Bioconductor 3.4 (BiocInstaller 1.24.0), R 3.3.1 (2016-06-21).
Installing package(s) ‘XML’
trying URL 'http://cran.rstudio.com/src/contrib/XML_3.98-1.5.tar.gz'
Content type 'application/x-gzip' length 1599213 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
User defined xml-config: /somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/bin/xml2-config, XML Version: 2, XML2: yes
USE_XML2 = yes
SED_EXTENDED_ARG: -r
Minor 9, Patch 1 for 2.9.1
Located parser file -I/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/include/libxml2/parser.h
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... yes
checking for xmlHashSize in -lxml2... yes
Using built-in xmlHashSize
Checking DTD parsing (presence of externalSubset)...
checking for xmlHashSize in -lxml2... yes
Found xmlHashSize
checking for xmlOutputBufferCreateBuffer in -lxml2... yes
have xmlOutputBufferCreateBuffer()
checking for xmlDocDumpFormatMemoryEnc in -lxml2... yes
checking libxml/xmlversion.h usability... yes
checking libxml/xmlversion.h presence... yes
checking for libxml/xmlversion.h... yes
Expat:  FALSE
Checking for return type of xmlHashScan element routine.
No return value for xmlHashScan
xmlNs has a context field
Checking for cetype_t enumeration
Using recent version of R with cetype_t enumeration type for encoding
checking for xmlsec1-config... /usr/bin/xmlsec1-config
nodegc default
xml-debug default
Version has XML_WITH_ZLIB
Version has xmlHasFeature()

****************************************
Configuration information:

Libxml settings

libxml include directory: -I/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/include/libxml2
libxml library directory: -L/somewhere/Jun/Programme/libxml2-devel-2.9.1-2.1/usr/lib -lxml2 -lz -lm -ldl -lz  -lxml2
libxml 2:                 -DLIBXML2=1

# Things look pretty good so far.
# Issue persisted... 

> library("XML")
> XML::parseURI("")
Error in XML::parseURI("") : cannot parse URI
> libxmlVersion()
$major
[1] "2"

$minor
[1] "09"

$patch
[1] "01"

> path = unclass(getLoadedDLLs()[["XML"]])$path
> path
[1] "/misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/XML/libs/XML.so"
> system2("ldd",args=path)
    linux-vdso.so.1 =>  (0x00007fffb7bfd000)
    libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00002af5900c0000)
...

somehow XML still links to the system "libxml2.so.2".
but I think now I am really close to resolve the issue. Any idea is appreciated. 

Just noticed your new suggestion. Yes, working on it. 

ADD REPLYlink modified 6 months ago • written 6 months ago by JunLVI40
1

I'm running out of ideas now, since I've managed to get this working on a CentOS 5 machine, which I think is in a pretty similar state to yours.  It fails with the system libxml2, but I can get it to work with one that I compiled myself.

I don't know why the version where you have compile libxml2 produces checking for xmlParseFile in -lxml2... no That makes me think the compilation didn't complete successfully.

For the attempt where you edited the xml2-config script manually, you probably want to look at the output immediately after where you cut off i.e. the lines with 'Compilation flags:..' down to 'Link flags:...' This will at least confirm that you aren't also including the system library during package installation. Your LD_LIBRARY_PATH etc are probably very messy at the moment, and the order of the entries matters, so there might still be something odd going on there.

Since I have managed to get this working, I will upload my complete shell script for getting to this stage some time tomorrow and let you know.

ADD REPLYlink modified 6 months ago • written 6 months ago by Mike Smith2.0k
1

@Mike Smith. Hi Mike, thank you very much.Thanks to you and Martin,  I guess that I am set now. 

Despite the fact that I had the error print out during installation,

when I checked today (it is always good to check again the next day...) 

 

> library("XML")
> XML::parseURI("")
$scheme
[1] ""

$authority
[1] ""

$server
[1] ""

$user
[1] ""

$path
[1] ""

$query
[1] ""

$fragment
[1] ""

$port
[1] NA

attr(,"class")
[1] "URI"
> libxmlVersion()
$major
[1] "2"

$minor
[1] "09"

$patch
[1] "01"

things look pretty much Ok...

> path = unclass(getLoadedDLLs()[["XML"]])$path
> path
[1] "/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/XML/libs/XML.so"
> system2("ldd",args=path)
    linux-vdso.so.1 =>  (0x00007fffa45fd000)
    libxml2.so.2 => /somewhere/Jun/Programme/lib/libxml2.so.2 (0x00002b92f5fdb000) # "XML" seemed to recognize the one I installed. 
    libz.so.1 => //somewhere/Jun/Programme/zlib-1.2.11/lib/libz.so.1 (0x00002b92f6356000)
    libm.so.6 => /lib64/libm.so.6 (0x00002b92f65af000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00002b92f6832000)
    libxmlsec1.so.1 => /usr/lib64/libxmlsec1.so.1 (0x00002b92f6a36000)
    libxslt.so.1 => /usr/lib64/libxslt.so.1 (0x00002b92f6c9a000)
    librt.so.1 => /lib64/librt.so.1 (0x00002b92f6ecf000)
    libR.so => /somewhere/Jun/Programme/R-3.3.1/lib64/R/lib/libR.so (0x00002b92f70d8000)
    libc.so.6 => /lib64/libc.so.6 (0x00002b92f771f000)
    /lib64/ld-linux-x86-64.so.2 (0x00000039be200000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b92f7a78000)
    libRblas.so => /somewhere/Jun/Programme/R-3.3.1/lib64/R/lib/libRblas.so (0x00002b92f7c95000)
    libgfortran.so.1 => /usr/lib64/libgfortran.so.1 (0x00002b92f7ec0000)
    libreadline.so.5 => /usr/lib64/libreadline.so.5 (0x00002b92f8157000)
    libncurses.so.5 => /usr/lib64/libncurses.so.5 (0x00002b92f8395000)
    libpcre.so.1 => //somewhere/Jun/Programme/pcre-8.40/lib/libpcre.so.1 (0x00002b92f85f2000)
    liblzma.so.5 => //somewhere/Jun/Programme/xz-5.2.3/lib/liblzma.so.5 (0x00002b92f8819000)
    libgomp.so.1 => /somewhere/Jun/Programme/gcc-6.1.0/lib64/libgomp.so.1 (0x00002b92f8a41000)

#Most importantly, I could use "makeTxDbFromGFF()" function now:

> (txdb <- makeTxDbFromGFF(gtffile, format="gtf", circ_seqs=character()))
Import genomic features from the file as a GRanges object ... OK
Prepare the 'metadata' data frame ... OK
Make the TxDb object ... OK

previously, I could not make it work: 

(txdb <- makeTxDbFromGFF(gtffile, format="gtf", circ_seqs=character()))
#  Import genomic features from the file as a GRanges object ... Error in parseURI("") : cannot parse URI 

So I guess that I am set now.  The key is really what you suggested, instead of using "rpm", and tweaking configuration file manually,  compiling the "libxml2" from the source is a much better approach. Everything is automatically taken care of. 

Yes,  my path is messy, basically I do not know what is the best way to manage the installation (compilation), just assuming put different program  in different directory would make them less likely to interfere with each other, so you noticed something like:

/somewhere/Jun/Programme/libA/lib/
/somewhere/Jun/Programme/libB/lib/
/somewhere/Jun/Programme/libC/lib/

Gradually I will install new libs into 

/somewhere/Jun/Programme/

so that finally I only have:

 

export PATH="$HOME/Programme/bin/:$PATH"

export CPATH="$HOME/Programme/include/:$PATH"

export LD_LIBRARY_PATH="$HOME/Programme/lib/:$PATH"
 

Again, really appreciate your kind suggestions as well as patience.

 

ADD REPLYlink modified 6 months ago • written 6 months ago by JunLVI40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 119 users visited in the last hour