astamm / nloptr

nloptr provides an R interface to NLopt, a free/open-source library for nonlinear optimization providing a common interface to a number of different optimization routines which can handle nonlinear constraints and lower and upper bounds for the controls.
https://astamm.github.io/nloptr/
Other
105 stars 35 forks source link

Cannot install from source under macOS + clang6 #50

Closed renkun-ken closed 5 years ago

renkun-ken commented 5 years ago

The latest CRAN release of nloptr does not compile with R 3.5.1 under macOS 10.14 and clang6 (suggested at https://cloud.r-project.org/bin/macosx/tools)

* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/local/clang6/bin/clang++ accepts -g... yes
checking how to run the C++ preprocessor... /usr/local/clang6/bin/clang++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether /usr/local/clang6/bin/clang++ accepts -g... (cached) yes
checking for pkg-config... yes
configure: Now testing for NLopt header file.
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking nlopt.h usability... no
checking nlopt.h presence... no
checking for nlopt.h... no
configure: Need to configure and build NLopt
configure: Starting to install library to /private/var/folders/dh/6nhw4l5x0sq0wqgwh346fwjm0000gn/T/RtmpMnCyKX/R.INSTALL58f477c63e96/nloptr/src/nlopt_src
rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
hybrid.c:91:12: warning: 'nlopt_minimize' is deprecated [-Wdeprecated-declarations]
     ret = nlopt_minimize(p->local_alg, n, fcount, p, 
           ^
../api/nlopt.h:337:35: note: 'nlopt_minimize' has been explicitly marked deprecated here
     int maxeval, double maxtime) NLOPT_DEPRECATED;
                                  ^
../api/nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
1 warning generated.
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
newuoa.c:184:9: warning: 'nlopt_minimize_constrained' is deprecated [-Wdeprecated-declarations]
         ret = nlopt_minimize_constrained(NLOPT_LD_MMA, *n, quad_model, &qmd,
               ^
../api/nlopt.h:348:35: note: 'nlopt_minimize_constrained' has been explicitly marked deprecated here
     int maxeval, double maxtime) NLOPT_DEPRECATED;
                                  ^
../api/nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
newuoa.c:1241:10: warning: 'nlopt_minimize_constrained' is deprecated [-Wdeprecated-declarations]
         return nlopt_minimize_constrained(NLOPT_LD_MMA, *n, lag, &ld,
                ^
../api/nlopt.h:348:35: note: 'nlopt_minimize_constrained' has been explicitly marked deprecated here
     int maxeval, double maxtime) NLOPT_DEPRECATED;
                                  ^
../api/nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
2 warnings generated.
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
general.c:134:38: warning: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Wdeprecated-declarations]
     nlopt_srand(nlopt_time_seed() + my_gettid() * 314159);
                                     ^
general.c:116:23: note: expanded from macro 'my_gettid'
#  define my_gettid() syscall(SYS_gettid)
                      ^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int      syscall(int, ...);
         ^
1 warning generated.
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
In file included from f77api.c:103:
./f77funcs.h:57:14: warning: 'nlopt_minimize_constrained' is deprecated [-Wdeprecated-declarations]
     *info = nlopt_minimize_constrained((nlopt_algorithm) *algorithm, 
             ^
./nlopt.h:348:35: note: 'nlopt_minimize_constrained' has been explicitly marked deprecated here
     int maxeval, double maxtime) NLOPT_DEPRECATED;
                                  ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:103:
./f77funcs.h:96:6: warning: 'nlopt_get_local_search_algorithm' is deprecated [-Wdeprecated-declarations]
     nlopt_get_local_search_algorithm(&deriv, &nonderiv, maxeval);
     ^
./nlopt.h:365:25: note: 'nlopt_get_local_search_algorithm' has been explicitly marked deprecated here
                                             int *maxeval) NLOPT_DEPRECATED;
                                                           ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:103:
./f77funcs.h:104:6: warning: 'nlopt_set_local_search_algorithm' is deprecated [-Wdeprecated-declarations]
     nlopt_set_local_search_algorithm(deriv, nonderiv, *maxeval);
     ^
./nlopt.h:368:24: note: 'nlopt_set_local_search_algorithm' has been explicitly marked deprecated here
                                             int maxeval) NLOPT_DEPRECATED;
                                                          ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:103:
./f77funcs.h:109:13: warning: 'nlopt_get_stochastic_population' is deprecated [-Wdeprecated-declarations]
     *pop = nlopt_get_stochastic_population();
            ^
./nlopt.h:370:57: note: 'nlopt_get_stochastic_population' has been explicitly marked deprecated here
NLOPT_EXTERN(int) nlopt_get_stochastic_population(void) NLOPT_DEPRECATED;
                                                        ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:103:
./f77funcs.h:113:6: warning: 'nlopt_set_stochastic_population' is deprecated [-Wdeprecated-declarations]
     nlopt_set_stochastic_population(*pop);
     ^
./nlopt.h:371:61: note: 'nlopt_set_stochastic_population' has been explicitly marked deprecated here
NLOPT_EXTERN(void) nlopt_set_stochastic_population(int pop) NLOPT_DEPRECATED;
                                                            ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:114:
./f77funcs.h:57:14: warning: 'nlopt_minimize_constrained' is deprecated [-Wdeprecated-declarations]
     *info = nlopt_minimize_constrained((nlopt_algorithm) *algorithm, 
             ^
./nlopt.h:348:35: note: 'nlopt_minimize_constrained' has been explicitly marked deprecated here
     int maxeval, double maxtime) NLOPT_DEPRECATED;
                                  ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:114:
./f77funcs.h:96:6: warning: 'nlopt_get_local_search_algorithm' is deprecated [-Wdeprecated-declarations]
     nlopt_get_local_search_algorithm(&deriv, &nonderiv, maxeval);
     ^
./nlopt.h:365:25: note: 'nlopt_get_local_search_algorithm' has been explicitly marked deprecated here
                                             int *maxeval) NLOPT_DEPRECATED;
                                                           ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:114:
./f77funcs.h:104:6: warning: 'nlopt_set_local_search_algorithm' is deprecated [-Wdeprecated-declarations]
     nlopt_set_local_search_algorithm(deriv, nonderiv, *maxeval);
     ^
./nlopt.h:368:24: note: 'nlopt_set_local_search_algorithm' has been explicitly marked deprecated here
                                             int maxeval) NLOPT_DEPRECATED;
                                                          ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:114:
./f77funcs.h:109:13: warning: 'nlopt_get_stochastic_population' is deprecated [-Wdeprecated-declarations]
     *pop = nlopt_get_stochastic_population();
            ^
./nlopt.h:370:57: note: 'nlopt_get_stochastic_population' has been explicitly marked deprecated here
NLOPT_EXTERN(int) nlopt_get_stochastic_population(void) NLOPT_DEPRECATED;
                                                        ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:114:
./f77funcs.h:113:6: warning: 'nlopt_set_stochastic_population' is deprecated [-Wdeprecated-declarations]
     nlopt_set_stochastic_population(*pop);
     ^
./nlopt.h:371:61: note: 'nlopt_set_stochastic_population' has been explicitly marked deprecated here
NLOPT_EXTERN(void) nlopt_set_stochastic_population(int pop) NLOPT_DEPRECATED;
                                                            ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:129:
./f77funcs.h:57:14: warning: 'nlopt_minimize_constrained' is deprecated [-Wdeprecated-declarations]
     *info = nlopt_minimize_constrained((nlopt_algorithm) *algorithm, 
             ^
./nlopt.h:348:35: note: 'nlopt_minimize_constrained' has been explicitly marked deprecated here
     int maxeval, double maxtime) NLOPT_DEPRECATED;
                                  ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:129:
./f77funcs.h:96:6: warning: 'nlopt_get_local_search_algorithm' is deprecated [-Wdeprecated-declarations]
     nlopt_get_local_search_algorithm(&deriv, &nonderiv, maxeval);
     ^
./nlopt.h:365:25: note: 'nlopt_get_local_search_algorithm' has been explicitly marked deprecated here
                                             int *maxeval) NLOPT_DEPRECATED;
                                                           ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:129:
./f77funcs.h:104:6: warning: 'nlopt_set_local_search_algorithm' is deprecated [-Wdeprecated-declarations]
     nlopt_set_local_search_algorithm(deriv, nonderiv, *maxeval);
     ^
./nlopt.h:368:24: note: 'nlopt_set_local_search_algorithm' has been explicitly marked deprecated here
                                             int maxeval) NLOPT_DEPRECATED;
                                                          ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:129:
./f77funcs.h:109:13: warning: 'nlopt_get_stochastic_population' is deprecated [-Wdeprecated-declarations]
     *pop = nlopt_get_stochastic_population();
            ^
./nlopt.h:370:57: note: 'nlopt_get_stochastic_population' has been explicitly marked deprecated here
NLOPT_EXTERN(int) nlopt_get_stochastic_population(void) NLOPT_DEPRECATED;
                                                        ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
In file included from f77api.c:129:
./f77funcs.h:113:6: warning: 'nlopt_set_stochastic_population' is deprecated [-Wdeprecated-declarations]
     nlopt_set_stochastic_population(*pop);
     ^
./nlopt.h:371:61: note: 'nlopt_set_stochastic_population' has been explicitly marked deprecated here
NLOPT_EXTERN(void) nlopt_set_stochastic_population(int pop) NLOPT_DEPRECATED;
                                                            ^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
15 warnings generated.
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
clang-6.0: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
testopt.cpp:218:11: warning: 'nlopt_minimize' is deprecated [-Wdeprecated-declarations]
    ret = nlopt_minimize(algorithm,
          ^
../api/nlopt.h:337:35: note: 'nlopt_minimize' has been explicitly marked deprecated here
     int maxeval, double maxtime) NLOPT_DEPRECATED;
                                  ^
../api/nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
#  define NLOPT_DEPRECATED __attribute__((deprecated))
                                          ^
1 warning generated.
make[2]: *** No rule to make target `nlopt-guile.cpp', needed by `all'.  Stop.
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
/bin/sh: .././install-sh: Permission denied
make[3]: *** [install-includeHEADERS] Error 1
make[2]: *** [install-am] Error 2
make[1]: *** [install] Error 2
make: *** [install-recursive] Error 1
./configure: line 3333: checking: command not found
configure: Done installing library to /private/var/folders/dh/6nhw4l5x0sq0wqgwh346fwjm0000gn/T/RtmpMnCyKX/R.INSTALL58f477c63e96/nloptr/src/nlopt_src
cp: src/nlopt_src/include/*: No such file or directory
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/PkgFlags.R
** libs
/usr/local/clang6/bin/clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include   -fPIC  -Wall -g -O2  -c dummy.cpp -o dummy.o
/usr/local/clang6/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/usr/local/include  -Wall -g -O2  -I/private/var/folders/dh/6nhw4l5x0sq0wqgwh346fwjm0000gn/T/RtmpMnCyKX/R.INSTALL58f477c63e96/nloptr/src/nlopt_src/include -fPIC  -Wall -g -O2  -c init_nloptr.c -o init_nloptr.o
init_nloptr.c:35:10: fatal error: 'nlopt.h' file not found
#include "nlopt.h"
         ^~~~~~~~~
1 error generated.
make: *** [init_nloptr.o] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/nloptr’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/nloptr’
Warning in install.packages :
  installation of package ‘nloptr’ had non-zero exit status
renkun-ken commented 5 years ago

brew install nlopt solves the problem.