getspams / spams-R

R interface for SPAMS (SPArse Modeling Software)
https://thoth.inrialpes.fr/people/mairal/spams/
GNU General Public License v3.0
2 stars 2 forks source link

Address recent ISO C++17 changes #5

Closed cjfields closed 1 week ago

cjfields commented 1 year ago

This fork deals with some basic changes related to recent compiler issues. Tested on Mac OS X Ventura (13.4, arm64).

> devtools::install_github('getspams/spams-R')
Downloading GitHub repo getspams/spams-R@HEAD
── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/1q/dqz36cq11lb5ms6247zr6l840000gn/T/Rtmpz2Mra5/remotes9e512eb41cc0/getspams-spams-R-0c812f8/DESCRIPTION’ (469ms)
─  preparing ‘spams’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘spams_2.6.tar.gz’

Installing package into ‘/Users/cjfields/Library/R/arm64/4.3/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘spams’ ...
** using staged installation
** libs
using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using SDK: ‘MacOSX13.3.sdk’
clang++ -arch arm64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/homebrew/include -Xclang -fopenmp -Xclang -fopenmp   -I. -Ispams/linalg -Ispams/prox -Ispams/decomp -Ispams/dictLearn -Ispams/dags    -DUSE_BLAS_LIB -DNDEBUG -O3 -mtune=native -fPIC  -I/opt/homebrew/include -c spams.cpp -o spams.o
In file included from spams.cpp:1301:
./spams.h:35:57: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
template<typename T> void _sort(Vector<T> *v,bool mode) throw(const char *){
                                                        ^~~~~~~~~~~~~~~~~~~
./spams.h:35:57: note: use 'noexcept(false)' instead
template<typename T> void _sort(Vector<T> *v,bool mode) throw(const char *){
                                                        ^~~~~~~~~~~~~~~~~~~
                                                        noexcept(false)
./spams.h:40:61: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
template<typename T> void _AAt(SpMatrix<T> *A,Matrix<T> *B) throw(const char *) {
                                                            ^~~~~~~~~~~~~~~~~~~
./spams.h:40:61: note: use 'noexcept(false)' instead
template<typename T> void _AAt(SpMatrix<T> *A,Matrix<T> *B) throw(const char *) {
                                                            ^~~~~~~~~~~~~~~~~~~
                                                            noexcept(false)
./spams.h:47:76: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
template<typename T> void _XAt(SpMatrix<T> *A,Matrix<T> *X,Matrix<T> *XAt) throw(const char *) {
                                                                           ^~~~~~~~~~~~~~~~~~~
./spams.h:47:76: note: use 'noexcept(false)' instead
template<typename T> void _XAt(SpMatrix<T> *A,Matrix<T> *X,Matrix<T> *XAt) throw(const char *) {
                                                                           ^~~~~~~~~~~~~~~~~~~
                                                                           noexcept(false)
./spams.h:54:29: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
      const T a, const T b) throw(const char *) {
                            ^~~~~~~~~~~~~~~~~~~
./spams.h:54:29: note: use 'noexcept(false)' instead
      const T a, const T b) throw(const char *) {
                            ^~~~~~~~~~~~~~~~~~~
                            noexcept(false)
./spams.h:76:71: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
template<typename T> void _applyBayerPattern(Vector<T> *v,int offset) throw(const char *){
                                                                      ^~~~~~~~~~~~~~~~~~~
./spams.h:76:71: note: use 'noexcept(false)' instead
template<typename T> void _applyBayerPattern(Vector<T> *v,int offset) throw(const char *){
                                                                      ^~~~~~~~~~~~~~~~~~~
                                                                      noexcept(false)
./spams.h:80:116: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
template<typename T> void _conjugateGradient(Matrix<T> *A,Vector<T> *b,Vector<T> *x,const T tol,const int itermax) throw(const char *){
                                                                                                                   ^~~~~~~~~~~~~~~~~~~
./spams.h:80:116: note: use 'noexcept(false)' instead
template<typename T> void _conjugateGradient(Matrix<T> *A,Vector<T> *b,Vector<T> *x,const T tol,const int itermax) throw(const char *){
                                                                                                                   ^~~~~~~~~~~~~~~~~~~
                                                                                                                   noexcept(false)
./spams.h:101:29: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
      const int numThreads) throw(const char *) {
                            ^~~~~~~~~~~~~~~~~~~
./spams.h:101:29: note: use 'noexcept(false)' instead
      const int numThreads) throw(const char *) {
                            ^~~~~~~~~~~~~~~~~~~
                            noexcept(false)
./spams.h:112:1: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
./spams.h:112:1: note: use 'noexcept(false)' instead
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
noexcept(false)
./spams.h:150:1: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
./spams.h:150:1: note: use 'noexcept(false)' instead
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
noexcept(false)
./spams.h:194:1: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
./spams.h:194:1: note: use 'noexcept(false)' instead
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
noexcept(false)
./spams.h:221:1: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
./spams.h:221:1: note: use 'noexcept(false)' instead
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
noexcept(false)
./spams.h:251:196: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
SpMatrix<T> *_omp(Matrix<T> *X,Matrix<T> *D,Matrix<T> **path,bool return_reg_path,bool given_L,Vector<int>*L,bool given_eps,Vector<T>*eps,bool given_Lambda,Vector<T>*Lambda,const int numThreads) throw(const char *){
                                                                                                                                                                                                   ^~~~~~~~~~~~~~~~~~~
./spams.h:251:196: note: use 'noexcept(false)' instead
SpMatrix<T> *_omp(Matrix<T> *X,Matrix<T> *D,Matrix<T> **path,bool return_reg_path,bool given_L,Vector<int>*L,bool given_eps,Vector<T>*eps,bool given_Lambda,Vector<T>*Lambda,const int numThreads) throw(const char *){
                                                                                                                                                                                                   ^~~~~~~~~~~~~~~~~~~
                                                                                                                                                                                                   noexcept(false)
./spams.h:296:216: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
SpMatrix<T> *_ompMask(Matrix<T> *X,Matrix<T> *D,Matrix<bool> *B,Matrix<T> **path,bool return_reg_path,bool given_L,Vector<int>*L,bool given_eps,Vector<T>*eps,bool given_Lambda,Vector<T>*Lambda,const int numThreads) throw(const char *){
                                                                                                                                                                                                                       ^~~~~~~~~~~~~~~~~~~
./spams.h:296:216: note: use 'noexcept(false)' instead
SpMatrix<T> *_ompMask(Matrix<T> *X,Matrix<T> *D,Matrix<bool> *B,Matrix<T> **path,bool return_reg_path,bool given_L,Vector<int>*L,bool given_eps,Vector<T>*eps,bool given_Lambda,Vector<T>*Lambda,const int numThreads) throw(const char *){
                                                                                                                                                                                                                       ^~~~~~~~~~~~~~~~~~~
                                                                                                                                                                                                                       noexcept(false)
./spams.h:345:130: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
SpMatrix<T> *_cd(Matrix<T> *X,Matrix<T> *D,SpMatrix<T>*alpha,T lambda1, constraint_type mode, int itermax, T tol,int numThreads) throw(const char *){
                                                                                                                                 ^~~~~~~~~~~~~~~~~~~
./spams.h:345:130: note: use 'noexcept(false)' instead
SpMatrix<T> *_cd(Matrix<T> *X,Matrix<T> *D,SpMatrix<T>*alpha,T lambda1, constraint_type mode, int itermax, T tol,int numThreads) throw(const char *){
                                                                                                                                 ^~~~~~~~~~~~~~~~~~~
                                                                                                                                 noexcept(false)
./spams.h:363:97: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
SpMatrix<T> *_somp(Matrix<T> *X,Matrix<T> *D,Vector<int> *groups,int LL, T eps, int numThreads) throw(const char *){
                                                                                                ^~~~~~~~~~~~~~~~~~~
./spams.h:363:97: note: use 'noexcept(false)' instead
SpMatrix<T> *_somp(Matrix<T> *X,Matrix<T> *D,Vector<int> *groups,int LL, T eps, int numThreads) throw(const char *){
                                                                                                ^~~~~~~~~~~~~~~~~~~
                                                                                                noexcept(false)
./spams.h:419:144: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
void _l1L2BCD(Matrix<T> *X,Matrix<T> *D,Matrix<T>*alpha0,Vector<int> *groups,T lambda1, constraint_type mode,int itermax,T tol,int numThreads) throw(const char *){
                                                                                                                                               ^~~~~~~~~~~~~~~~~~~
./spams.h:419:144: note: use 'noexcept(false)' instead
void _l1L2BCD(Matrix<T> *X,Matrix<T> *D,Matrix<T>*alpha0,Vector<int> *groups,T lambda1, constraint_type mode,int itermax,T tol,int numThreads) throw(const char *){
                                                                                                                                               ^~~~~~~~~~~~~~~~~~~
                                                                                                                                               noexcept(false)
./spams.h:500:1: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
./spams.h:500:1: note: use 'noexcept(false)' instead
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
noexcept(false)
./spams.h:652:1: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
./spams.h:652:1: note: use 'noexcept(false)' instead
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
noexcept(false)
./spams.h:820:1: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
./spams.h:820:1: note: use 'noexcept(false)' instead
throw(const char *) 
^~~~~~~~~~~~~~~~~~~
noexcept(false)
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [spams.o] Error 1
ERROR: compilation failed for package ‘spams’
* removing ‘/Users/cjfields/Library/R/arm64/4.3/library/spams’
* restoring previous ‘/Users/cjfields/Library/R/arm64/4.3/library/spams’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/1q/dqz36cq11lb5ms6247zr6l840000gn/T//Rtmpz2Mra5/file9e5132cb9934/spams_2.6.tar.gz’ had non-zero exit status
gdurif commented 1 year ago

Hi @cjfields , thanks for your contribution to SPAMS. We will review it (especially the install on other systems) ASAP and then merge it. Best,

cjfields commented 7 months ago

Hi @gdurif just checking if anything else in this needed to be addressed. Let me know

gdurif commented 1 week ago

Merged, sorry for the long wait and thanks for your contribution 🙂

cjfields commented 1 week ago

Merged, sorry for the long wait and thanks for your contribution 🙂

No worries, as an open-source developer I completely understand!