[BioC] Compilation or syntax error in IRanges sort_util.c package

Michael Dondrup mdondrup at cebitec.uni-bielefeld.de
Wed Apr 1 15:36:36 CEST 2009


Dear Michael and BioC,
thank you for the response and can further report attempts to install the Biostrings package using
cc: Sun C 5.9 SunOS_i386 Patch 124868-08 2008/11/25 on Solaris.

  The IRanges packages can now be installed, but the installation of Biostrings fails with many 
messages such as (just the relevant portion, Sorry for the lengthy details).

azteca:~/compile/Biostrings/src> cc -xc99 -I/homes/mdondrup/bin/R-2.8.1//lib/R/include 
-I/opt/SUNWspro/include/ -I/vol/tcl-8.4.13/include -I/vol/local/include -I/vol/graphics/include 
-I/vol/gnu/include  -I"/homes/mdondrup/bin/R-2.8.1/lib/R/library/IRanges/include"   -KPIC  -g -c 
IRanges_stubs.c -o IRanges_stubs.o

"/homes/mdondrup/bin/R-2.8.1/lib/R/library/IRanges/include/_IRanges_stubs.c", line 20: void function 
cannot return value
"/homes/mdondrup/bin/R-2.8.1/lib/R/library/IRanges/include/_IRanges_stubs.c", line 20: warning: 
syntax error:  empty declaration
...
Therefore, the problem is still in IRanges in inst/_IRanges_stubs.c which is not compiled during 
installation, but with the subsequent package.

I've got the impression that this file is auto-generated, therefore I haven't made more changes yet.

  There are in fact two issues.
1. cc does not accept anything after a return in void functions, as with the last probelm
2. cc does not seem to like typecasts with named parameters in type casts such as:
from the preprocessed code:

fun = ( void ( * ) ( const int * x , int x_nelt , int * order ) ) R_GetCCallable ( "IRanges" , "_" 
"get_int_array_order" ) ;

instead it can be like

fun = ( void ( * ) ( const int * , int , int *  ) R_GetCCallable ( "IRanges" , "_" 
"get_int_array_order" ) ;

This code is generated by the DEFINE_CCALLABLE_STUB in _IRanges_stubs.c

To make this more portable I tried to define two makros instead as:

#define DEFINE_CCALLABLE_STUB(retT, stubname, Types, Targs, args)	\
   retT stubname Targs							\
   {									\
     static retT (*fun)Targs = NULL;					\
     if (fun == NULL)							\
       fun = (retT (*)Types) R_GetCCallable("IRanges", "_" #stubname);	\
     return fun args;							\
   }

#define DEFINE_CCALLABLE_VOID_STUB(retT, stubname, Types, Targs, args)	\
   retT stubname Targs							\
   {									\
     static retT (*fun)Targs = NULL;					\
     if (fun == NULL)							\
       fun = (retT (*)Types) R_GetCCallable("IRanges", "_" #stubname);	\
     fun args;								\
     return;								\
   }

These could create fuction bodies for void functions and others. Second, these macros have the 
additonal 'Types' argument and the function stub definition is then like:

  /*
  * Stubs for callables defined in sort_utils.c
  */

DEFINE_CCALLABLE_VOID_STUB(void, sort_int_array,
	(int *, int),
	(int *x, int x_nelt),
	(     x,     x_nelt)
);
....
DEFINE_CCALLABLE_STUB(IntAE, new_IntAE,
	(int , int , int),
	(int buflength, int nelt, int val),
	(    buflength,     nelt,     val)
);

Processor output then looks like:

void sort_int_array ( int * x , int x_nelt ) {
   static void ( * fun ) ( int * x , int x_nelt ) = 0 ;
   if ( fun == 0 )
     fun = ( void ( * ) ( int * , int ) ) R_GetCCallable ( "IRanges" , "_" "sort_int_array" ) ;
   return ;
} ;

which does not cause an error. Could this be changed in the code generation, otherwise I can change 
the declarations with a perl script.

Best
Michael

Michael Lawrence wrote:
> 
> 
> On Tue, Mar 31, 2009 at 2:21 AM, Michael Dondrup 
> <mdondrup at cebitec.uni-bielefeld.de 
> <mailto:mdondrup at cebitec.uni-bielefeld.de>> wrote:
> 
>     Dear list,
> 
>     I'm trying to install Bioconductor on Solaris using the SunWPro-12
>     compilers.
>     cc: Sun C 5.9 SunOS_i386 Patch 124868-08 2008/11/25
> 
> 
>      > biocLite('IRanges')
>     Running biocinstall version 2.3.10 with R version 2.8.1
>     Your version of R requires version 2.3 of Bioconductor.
>     trying URL
>     'http://bioconductor.org/packages/2.3/bioc/src/contrib/IRanges_1.0.14.tar.gz'
>     Content type 'application/x-gzip' length 175687 bytes (171 Kb)
>     [snip]
>     cc -xc99 -I/homes/mdondrup/bin/R-2.8.1//lib/R/include
>      -I/opt/SUNWspro/include/ -I/vol/tcl-8.4.13/include
>     -I/vol/local/include -I/vol/graphics/include -I/vol/gnu/include    
>     -KPIC  -g -c solve_user_SEW.c -o solve_user_SEW.o
>     cc -xc99 -I/homes/mdondrup/bin/R-2.8.1//lib/R/include
>      -I/opt/SUNWspro/include/ -I/vol/tcl-8.4.13/include
>     -I/vol/local/include -I/vol/graphics/include -I/vol/gnu/include    
>     -KPIC  -g -c sort_utils.c -o sort_utils.o
>     "sort_utils.c", line 18: void function cannot return value
>     cc: acomp failed for sort_utils.c
>     make: *** [sort_utils.o] Error 2
>     ERROR: compilation failed for package 'IRanges'
>     ** Removing '/homes/mdondrup/bin/R-2.8.1/lib/R/library/IRanges'
> 
>     The downloaded packages are in
>            /tmp/1101064.1.interactive.q/RtmpML0kk8/downloaded_packages
>     Updating HTML index of packages in '.Library'
>     Warning message:
>     In install.packages(pkgs = pkgs, repos = repos, dependencies =
>     dependencies,  :
>      installation of package 'IRanges' had non-zero exit status
> 
>     Looking into sort_utils.c line 18 shows that this is the error:
>     A void funtion trying to return something.
> 
>     void _sort_int_array(int *x, int x_nelt)
>     {
>            return qsort(x, x_nelt, sizeof(int), cmpintp);
>     }
> 
>     I do not know why this works with gcc 
> 
> 
> Probably because qsort returns void, so it's compatible. Obviously, 
> return is pointless in the case of 'void' though.
>  
> 
>     by the way but for me just removing the "return"
> 
>     void _sort_int_array(int *x, int x_nelt)
>     {
>            qsort(x, x_nelt, sizeof(int), cmpintp);
>     }
> 
>      makes the package compilable. I hope that no return value is ever
>     needed somewhere ....
> 
>     Could you devise a patch to make bioconductor installation possible
>     from the repository?
> 
> 
> Fixed in svn.
> 
> Thanks for the report,
> Michael
>  
> 
> 
> 
>     Thanks
>     Michael
> 
>      > version               _
>     platform       i386-pc-solaris2.10
>     arch           i386
>     os             solaris2.10
>     system         i386, solaris2.10
>     status         Patched
>     major          2
>     minor          8.1
>     year           2009
>     month          03
>     day            18
>     svn rev        48212
>     language       R
>     version.string R version 2.8.1 Patched (2009-03-18 r48212)
>      >
> 
>     _______________________________________________
>     Bioconductor mailing list
>     Bioconductor at stat.math.ethz.ch <mailto:Bioconductor at stat.math.ethz.ch>
>     https://stat.ethz.ch/mailman/listinfo/bioconductor
>     Search the archives:
>     http://news.gmane.org/gmane.science.biology.informatics.conductor
> 
> 


-- 
--
Dr. Michael Dondrup
CeBiTec - http://www.cebitec.uni-bielefeld.de/~mdondrup
Bielefeld University,  D-33594 Bielefeld, Germany
office: V6-147 voice: +49 521 106-4827 fax: -6419



More information about the Bioconductor mailing list