mllg / base64url

Fast and url-safe base64 encoder and decoder for R
11 stars 3 forks source link

Installation error #2

Open dipterix opened 3 years ago

dipterix commented 3 years ago

Hi @mllg , I encounter an installation error on RedHat R 4.0.4

It seems the compiler is complaining about initial declarations in the for loop. Is it possible that R 4.0 uses newer standards , or my gcc version is too low?

Error message (install from source)

* installing *source* package ‘base64url’ ...
** package ‘base64url’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/opt2/software/R/4.0.4/lib64/R/include" -DNDEBUG   -I/opt2/software/gcc/7.2.0/include   -fpic  -g -O2  -c base32.c -o base32.o
base32.c: In function ‘b32e’:
base32.c:257:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (R_xlen_t i = 0; i < n; i++) {
     ^
base32.c:257:5: note: use option -std=c99 or -std=gnu99 to compile your code
base32.c: In function ‘b32d’:
base32.c:293:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (R_xlen_t i = 0; i < n; i++) {
     ^
make: *** [base32.o] Error 1
ERROR: compilation failed for package ‘base64url’

Session info

R version 4.0.4 (2021-02-15)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS:   /usr/lib64/libblas.so.3.4.2
LAPACK: /opt2/software/R/4.0.4/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               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    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.0.4 tools_4.0.4    packrat_0.5.0 
dipterix commented 3 years ago

After changing to

SEXP b64d(SEXP strings) {
    ...

    R_xlen_t i = 0;
    for (; i < n; i++) {
    ...

I was able to compile locally.

mllg commented 3 years ago

What is the output of gcc --version?

dipterix commented 3 years ago

@mllg Sorry for the late reply, here you go!

(base) bash-4.2$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.