From j|nghu@zh@o @end|ng |rom hotm@||@com  Thu Mar 10 11:45:33 2022
From: j|nghu@zh@o @end|ng |rom hotm@||@com (jing hua zhao)
Date: Thu, 10 Mar 2022 10:45:33 +0000
Subject: [Rd] Compiling error with glmnet and nloptr
In-Reply-To: <CWLP123MB4466801A3CE25E33C2CA5171A50B9@CWLP123MB4466.GBRP123.PROD.OUTLOOK.COM>
References: <a9526ce4-0cea-46fc-b1e9-4bfced56aadf@www.fastmail.com>
 <a6c2a79a-90a5-44d3-926b-9f1e630d9672@www.fastmail.com>
 <CWLP123MB4466801A3CE25E33C2CA5171A50B9@CWLP123MB4466.GBRP123.PROD.OUTLOOK.COM>
Message-ID: <CWLP123MB4466719C8B53048B59A0327AA50B9@CWLP123MB4466.GBRP123.PROD.OUTLOOK.COM>

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 at hotmail.com>
Sent: 10 March 2022 09:22
To: R-devel <r-devel at 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,

glmnet:

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?

nloptr:

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]]



[Rd] Compiling error with glmnet and nloptr
jing hua zhao