RobinHankin / gsl

an R wrapper for the Gnu Scientific Library
15 stars 9 forks source link

Compilation errors (current master: e04d8b6) #6

Closed bokov closed 1 year ago

bokov commented 5 years ago

Got the following errors with GitHub version (after getting a similar looking page of errors with CRAN version):

> devtools::install_github('RobinHankin/gsl')
Downloading GitHub repo RobinHankin/gsl@master
from URL https://api.github.com/repos/RobinHankin/gsl/zipball/master
Installing gsl
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD  \
  INSTALL '/tmp/RtmpUFZufY/devtools7bae68f83578/RobinHankin-gsl-e04d8b6'  \
  --library='/home/a/R/x86_64-pc-linux-gnu-library/3.4' --install-tests 

* installing *source* package ‘gsl’ ...
checking for gsl-config... /usr/bin/gsl-config
checking if GSL version >= 2.1... checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
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
yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c airy.c -o airy.o
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c bessel.c -o bessel.o
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c clausen.c -o clausen.o
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c coulomb.c -o coulomb.o
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c coupling.c -o coupling.o
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c dawson.c -o dawson.o
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c debye.c -o debye.o
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c dilog.c -o dilog.o
gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I.     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c ellint.c -o ellint.o
ellint.c: In function ‘ellint_D_e’:
ellint.c:82:65: warning: passing argument 4 of ‘gsl_sf_ellint_D_e’ makes integer from pointer without a cast [-Wint-conversion]
     status[i] = gsl_sf_ellint_D_e(phi[i], k[i], sf_mode[*mode], &result) ;
                                                                 ^
In file included from ellint.c:1:0:
/usr/include/gsl/gsl_sf_ellint.h:84:5: note: expected ‘gsl_mode_t {aka unsigned int}’ but argument is of type ‘gsl_sf_result * {aka struct gsl_sf_result_struct *}’
 int gsl_sf_ellint_D_e(double phi, double k, double n, gsl_mode_t mode, gsl_sf_result * result);
     ^
ellint.c:82:17: error: too few arguments to function ‘gsl_sf_ellint_D_e’
     status[i] = gsl_sf_ellint_D_e(phi[i], k[i], sf_mode[*mode], &result) ;
                 ^
In file included from ellint.c:1:0:
/usr/include/gsl/gsl_sf_ellint.h:84:5: note: declared here
 int gsl_sf_ellint_D_e(double phi, double k, double n, gsl_mode_t mode, gsl_sf_result * result);
     ^
make: *** [ellint.o] Error 1
ERROR: compilation failed for package ‘gsl’
* removing ‘/home/a/R/x86_64-pc-linux-gnu-library/3.4/gsl’
Installation failed: Command failed (1)

I am using gcc-5.5 and Ubuntu.

RobinHankin commented 5 years ago

upgrade your version of GSL and everything should work. hankin.robin@gmail.com hankin.robin@gmail.com

hankin.robin@gmail.com

hankin.robin@gmail.com

On Thu, Sep 12, 2019 at 8:51 AM Alex F. Bokov, Ph.D. < notifications@github.com> wrote:

Got the following errors with GitHub version (after getting a similar looking page of errors with CRAN version):

devtools::install_github('RobinHankin/gsl')

Downloading GitHub repo RobinHankin/gsl@master

from URL https://api.github.com/repos/RobinHankin/gsl/zipball/master

Installing gsl

'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD \

INSTALL '/tmp/RtmpUFZufY/devtools7bae68f83578/RobinHankin-gsl-e04d8b6' \

--library='/home/a/R/x86_64-pc-linux-gnu-library/3.4' --install-tests

  • installing source package ‘gsl’ ...

checking for gsl-config... /usr/bin/gsl-config

checking if GSL version >= 2.1... checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

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

yes

configure: creating ./config.status

config.status: creating src/Makevars

** libs

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c airy.c -o airy.o

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c bessel.c -o bessel.o

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c clausen.c -o clausen.o

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c coulomb.c -o coulomb.o

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c coupling.c -o coupling.o

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c dawson.c -o dawson.o

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c debye.c -o debye.o

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c dilog.c -o dilog.o

gcc-5 -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include -I. -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ellint.c -o ellint.o

ellint.c: In function ‘ellint_D_e’:

ellint.c:82:65: warning: passing argument 4 of ‘gsl_sf_ellint_D_e’ makes integer from pointer without a cast [-Wint-conversion]

 status[i] = gsl_sf_ellint_D_e(phi[i], k[i], sf_mode[*mode], &result) ;

                                                             ^

In file included from ellint.c:1:0:

/usr/include/gsl/gsl_sf_ellint.h:84:5: note: expected ‘gsl_mode_t {aka unsigned int}’ but argument is of type ‘gsl_sf_result {aka struct gsl_sf_result_struct }’

int gsl_sf_ellint_D_e(double phi, double k, double n, gsl_mode_t mode, gsl_sf_result * result);

 ^

ellint.c:82:17: error: too few arguments to function ‘gsl_sf_ellint_D_e’

 status[i] = gsl_sf_ellint_D_e(phi[i], k[i], sf_mode[*mode], &result) ;

             ^

In file included from ellint.c:1:0:

/usr/include/gsl/gsl_sf_ellint.h:84:5: note: declared here

int gsl_sf_ellint_D_e(double phi, double k, double n, gsl_mode_t mode, gsl_sf_result * result);

 ^

make: *** [ellint.o] Error 1

ERROR: compilation failed for package ‘gsl’

  • removing ‘/home/a/R/x86_64-pc-linux-gnu-library/3.4/gsl’

Installation failed: Command failed (1)

I am using gcc-5.5 and Ubuntu.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RobinHankin/gsl/issues/6?email_source=notifications&email_token=ADFFZUWZZNN3QLPWUDABCDLQJFK4VA5CNFSM4IVYX4MKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HK2LI6A, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFFZUWCHKVSP6LRQJA7HSDQJFK4VANCNFSM4IVYX4MA .

HenrikBengtsson commented 5 years ago

Hi, maybe I've already said it elsewhere. So, this is a common problem for anyone on RHEL/CentOS (common in the academic/HPC world) where the distro is stuck on GSL 1.x. I can imagine lots of people are puzzled by these errors. Myself, I keep revisiting 'gsl' related package installation issues when I try to help people installing downstream R packages on various compute cluster.

Would it be possible to have configure to detect this and give a more informative error message than:

checking if GSL version >= 2.1... checking for gcc... gcc
checking whether the C compiler works... yes
...

Something like:

checking if GSL version >= 2.1... no
ERROR: Detected GSL 1.15-13 but requires GSL 2.1 or newer

At least that would make it clear what's going on.

RobinHankin commented 5 years ago

Hello Henrik, this is a perfectly reasonable request. I'll create an issue for it.

GerardTromp commented 3 years ago

Following up on the comment. Would it be possible to include a configure argument that either uses the pkg-config, or allows specifying a path to the include and to the libraries?

Some other packages have options such as --with-foo-config=, --with-foo-include=, and --with-foo-lib= where the value is the relevant path.

Currently, I have to unpack the package and hardcode the path to gsl-config for an alternative installation (to get around the problem of OS distributions stuck at earlier versions).

I just noticed that the configure include a check for an environment variable, but that is not indicated in the configure --help

HenrikBengtsson commented 3 years ago

@GerardTromp, I effectively(*) use:

export PATH="/path/to/gsl-2.6/bin:$PATH"
export MANPATH="/path/to/gsl-2.6/share/man:$MANPATH"
export LD_LIBRARY_PATH="/path/to/gsl-2.6/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/path/to/gsl-2.6/lib/pkgconfig:$PKG_CONFIG_PATH"

That is sufficient from install.packages("gsl") to work out of the box. It could even be that all you need is PKG_CONFIG_PATH - I haven't tried.

(*) I'm on Linux and use environment modules (Lmod; https://lmod.readthedocs.io/en/latest/) to do this for me/users; the above is applied when we do module load gsl.