stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.02k stars 264 forks source link

2.26.2: compile face error `register` #1064

Closed starsareintherose closed 1 year ago

starsareintherose commented 1 year ago

Summary:

Compile face error

matUtils.cpp:114:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  114 |     for (register int i = 0 ; i < myN ; i++)
      |                       ^
matUtils.cpp:115:27: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  115 |         for (register int j = i ; j < myldz ; j++)
      |                           ^
matUtils.cpp:118:20: error: too few arguments to function ‘void dspev_(const char*, const char*, const int*, double*, double*, double*, const int*, double*, int*, size_t, size_t)’
  118 |     F77_NAME(dspev)("V", "U", &myN, myAP, myW, myZ, &myldz, myWork, &myInfo) ;
      |                    ^
In file included from /usr/include/R/R.h:78,
                 from matUtils.h:6,
                 from matUtils.cpp:2:
/usr/include/R/R_ext/Lapack.h:1050:10: note: declared here
 1050 | F77_NAME(dspev)(const char* jobz, const char* uplo, const int* n,
      |          ^~~~~
/usr/include/R/R_ext/RS.h:77:25: note: in definition of macro ‘F77_CALL’
   77 | # define F77_CALL(x)    x ## _
      |                         ^
/usr/include/R/R_ext/Lapack.h:1050:1: note: in expansion of macro ‘F77_NAME’
 1050 | F77_NAME(dspev)(const char* jobz, const char* uplo, const int* n,
      | ^~~~~~~~
matUtils.cpp:125:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  125 |     for (register int i = 0 ; i < myNCol ; i++)
      |                       ^

Description:

Reproducible Steps:

Current Output:

Full log here

* installing *source* package ‘STAN’ ...
** using staged installation
** libs
using C++ compiler: ‘g++ (GCC) 12.2.1 20230201’
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c Bernoulli.cpp -o Bernoulli.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c EmissionFactory.cpp -o EmissionFactory.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c EmissionFunction.cpp -o EmissionFunction.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c HMM.cpp -o HMM.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c InitialProbability.cpp -o InitialProbability.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c JointlyIndependent.cpp -o JointlyIndependent.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c MemoryAllocation.cpp -o MemoryAllocation.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c Multinomial.cpp -o Multinomial.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c MultivariateGaussian.cpp -o MultivariateGaussian.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c NegativeBinomial.cpp -o NegativeBinomial.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c ParamContainerEmissions.cpp -o ParamContainerEmissions.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c Poisson.cpp -o Poisson.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c PoissonLogNormal.cpp -o PoissonLogNormal.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c RAccessUtils.cpp -o RAccessUtils.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c RWrapper.cpp -o RWrapper.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c TransitionMatrix.cpp -o TransitionMatrix.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG   -I/usr/local/include   -D_RDLL_ -fopenmp  -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects  -c matUtils.cpp -o matUtils.o
matUtils.cpp: In function ‘double matrixDet(double**, int)’:
matUtils.cpp:114:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  114 |     for (register int i = 0 ; i < myN ; i++)
      |                       ^
matUtils.cpp:115:27: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  115 |         for (register int j = i ; j < myldz ; j++)
      |                           ^
matUtils.cpp:118:20: error: too few arguments to function ‘void dspev_(const char*, const char*, const int*, double*, double*, double*, const int*, double*, int*, size_t, size_t)’
  118 |     F77_NAME(dspev)("V", "U", &myN, myAP, myW, myZ, &myldz, myWork, &myInfo) ;
      |                    ^
In file included from /usr/include/R/R.h:78,
                 from matUtils.h:6,
                 from matUtils.cpp:2:
/usr/include/R/R_ext/Lapack.h:1050:10: note: declared here
 1050 | F77_NAME(dspev)(const char* jobz, const char* uplo, const int* n,
      |          ^~~~~
/usr/include/R/R_ext/RS.h:77:25: note: in definition of macro ‘F77_CALL’
   77 | # define F77_CALL(x)    x ## _
      |                         ^
/usr/include/R/R_ext/Lapack.h:1050:1: note: in expansion of macro ‘F77_NAME’
 1050 | F77_NAME(dspev)(const char* jobz, const char* uplo, const int* n,
      | ^~~~~~~~
matUtils.cpp:125:23: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
  125 |     for (register int i = 0 ; i < myNCol ; i++)
      |                       ^
make: *** [/usr/lib64/R/etc/Makeconf:200: matUtils.o] Error 1
make: *** Waiting for unfinished jobs....
ERROR: compilation failed for package ‘STAN’
* removing ‘/build/r-stan/src/STAN’
* restoring previous ‘/build/r-stan/src/STAN’

Expected Output:

Could pass with GCC 12.2.1

RStan Version:

2.26.2

R Version:

4.3.0

Operating System:

ArchLinux

andrjohns commented 1 year ago

The package error is for r-stan, not rstan, see the AUR page for the correct package/repo to open an issue against: https://aur.archlinux.org/packages/r-stan

starsareintherose commented 1 year ago

sorry for that