[2.0.0] fails to build on R 3.6.0
tuxmaster5000 opened this issue · comments
The build fails with:
[ 90%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/solver.cc.o
[ 92%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/local_optimizer.cc.o
[ 94%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/ags.cc.o
[ 96%] Linking CXX static library libnlopt.a
Error running link command: No such file or directory
make[2]: *** [libnlopt.a] Error 2
make[1]: *** [CMakeFiles/nlopt.dir/all] Error 2
gmake: *** [all] Error 2
I think the config step don't resect the fact, that R 3.6.0 don't have variables AR and RANLIB. And so the cmake defaults are overwritten with invalid values.
I have attached an full build log.
building the bundled nlopt-2.7.1 works well.
cmake3 -DBUILD_SHARED_LIBS=OFF ..
81%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/local_optimizer.cc.o
[ 82%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/ags.cc.o
[ 84%] Linking CXX static library libnlopt.a
[ 87%] Built target nlopt
Scanning dependencies of target t_tutorial
Scanning dependencies of target testopt
[ 89%] Building CXX object test/CMakeFiles/t_tutorial.dir/t_tutorial.cxx.o
[ 91%] Building C object test/CMakeFiles/testopt.dir/testfuncs.c.o
[ 93%] Building C object test/CMakeFiles/testopt.dir/testopt.c.o
[ 94%] Building C object test/CMakeFiles/testopt.dir/__/src/util/timer.c.o
[ 96%] Building C object test/CMakeFiles/testopt.dir/__/src/util/mt19937ar.c.o
[ 98%] Linking CXX executable testopt
[ 98%] Built target testopt
[100%] Linking CXX executable t_tutorial
[100%] Built target t_tutorial
So the problem is the overwritten cmake variables.
Of course the lib will work.
test.log
Thanks for reporting this. I will provide a solution in the next release, either by requiring R >= 4.0.x
or by setting AR
and RANLIB
only if the detected version of R is >= 4.0.x
. I will let you know if I implement the latter if you are willing to test if it works on your system.
Thanks, yes of course I can test it.
Here is the working patch, which can you use as an reference.
r.patch.txt
Would you mind contributing it as a PR please?
I will try it tomorrow, because I must look how to detect the R major version.
because I must look how to detect the R major version.
> getRversion()
[1] ‘4.1.2’
> getRversion() > "3.6.0"
[1] TRUE
> getRversion() > "4.2.0"
[1] FALSE
>
To a first appromixation, I wouldn't though. We are at 4.1.2 and 2 1/2 months away from R 4.2.0.