NKI-CCB / DISCOVER

DISCOVER co-occurrence and mutual exclusivity analysis for cancer genomics data
Apache License 2.0
27 stars 6 forks source link

Error while compiling: VOLATILE attribute at (1) cannot be specified in a PURE procedure #9

Closed hcraT closed 5 years ago

hcraT commented 5 years ago

Hi, first of all thanks for the package.

I'm trying to install the package from R. When I try to install the package I get the error reported here:

gfortran -ffree-line-length-none -fopenmp -fpic  -g -O2  -c  logspace.f90 -o logspace.o
logspace.f90:12:22:

     real(dp), volatile :: z
                      1
Error: VOLATILE attribute at (1) cannot be specified in a PURE procedure
logspace.f90:14:5:

     z = 1.0d0 + x
     1
Error: Symbol ‘z’ at (1) has no IMPLICIT type
make: *** [/usr/lib64/R/etc/Makeconf:195: logspace.o] Error 1
ERROR: compilation failed for package ‘discover’

The version of R is 3.6.0 and the fortran compiler is gfortran version 8.3.0.

I was able to get around the problem by adding an impure qualifier (as suggested by the compiler) to the function log1p like this:

elemental impure function log1p(x) result (y)

However I don't know fortran and so I'm not able to judge if this is the proper way to fix the problem.

scanisius commented 5 years ago

Thanks for reporting this. The compilation error you get seems to have been introduced in gfortran 8, which is why we did not run into it before. The fix you suggest looks like to right way to do it. I will release an updated version of DISCOVER including this fix, but in the meantime, you should be fine using your own patched version.