[Rd] Compiling error with glmnet and nloptr

jing hua zhao j|nghu@zh@o @end|ng |rom hotm@||@com
Thu Mar 10 11:45:33 CET 2022

Just a note that I used R 4.1.2 and with R 4.1.3 I had the same issues nevertheless I was able to go through with (not entirely sure preferable) nloptr once abs() is changed into fabs() within �src/test-C-API.cpp. Thanks. Jing Hua

From: jing hua zhao <jinghuazhao using hotmail.com>
Sent: 10 March 2022 09:22
To: R-devel <r-devel using r-project.org>
Subject: Compiling error with glmnet and nloptr

Dear All,

I haven't been able to compile the latest glmnet and nloptr from CRAN wth the following error messages,


elnet_exp.cpp:141:59:   required from here
glmnetpp/include/glmnetpp_bits/elnet_point/gaussian_base.hpp:90:39: error: 'self' was not declared in this scope
                     [=](auto k) { self().template update<update_type::partial>(k, ab, dem); },
make: *** [elnet_exp.o] Error 1
ERROR: compilation failed for package �glmnet�
* removing �/rds/user/jhz22/hpc-work/R/glmnet�
* restoring previous �/rds/user/jhz22/hpc-work/R/glmnet�


test-C-API.cpp:108:35: error: call of overloaded 'abs(__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type)' is ambiguous
     expect_true(abs(res[1] - 8./27) < 1.0e-4);
/usr/local/software/archive/linux-scientific7-x86_64/gcc-9/gcc-6.5.0-dtb6lagchexqdijlx6xgkin3zlfddpzi/include/c++/6.5.0/cstdlib:172:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
make: *** [test-C-API.o] Error 1
ERROR: compilation failed for package �nloptr�

Any suggestions to fix these? I use gcc/6 and have

$ uname -a
Linux login-e-16 3.10.0-1160.59.1.el7.x86_64 #1 SMP Tue Feb 22 10:57:56 CST 2022 x86_64 x86_64 x86_64 GNU/Linux

Many thanks in advance,

Jing Hua

	[[alternative HTML version deleted]]

More information about the R-devel mailing list