stanle / madopt

Apache License 2.0
16 stars 5 forks source link

Error building package #1

Closed davidromerot closed 8 years ago

davidromerot commented 9 years ago

I just found the following issue, but I am not sure whether this is specific for my setup or it has happened to others interested in this package.

When I try to compile/build the package in linux (mInt), I get the errors below.

I have the full set of COIN-OR libraries and includes in /usr/local/lib/coin and /usr/local/include/coin.

I get the same error whether I am trying to build the C++ libraries or just the Python package.

Thanks for your help solving this issue.

---- Error Message ---

[ 76%] Built target madopt [ 84%] Building CXX object CMakeFiles/madopt_ipopt.dir/src/ipopt_model.cpp.o

/home/dromero/Downloads/madopt-master/src/ipopt_model.cpp: In member function ‘virtual void MadOpt::IpoptModel::solve()’: /home/dromero/Downloads/madopt-master/src/ipopt_model.cpp:56:53: error: no matching function for call to ‘Ipopt::IpoptApplication::OptimizeTNLP(Ipopt::SmartPtrMadOpt::IpoptUserClass&)’ impl->Iapp.OptimizeTNLP(impl->ipopt_callback); ^ /home/dromero/Downloads/madopt-master/src/ipopt_model.cpp:56:53: note: candidate is: In file included from /home/dromero/Downloads/madopt-master/src/ipopt_nlp.hpp:19:0, from /home/dromero/Downloads/madopt-master/src/ipopt_model.cpp:17: /usr/local/include/coin/IpIpoptApplication.hpp:79:37: note: virtual Ipopt::ApplicationReturnStatus Ipopt::IpoptApplication::OptimizeTNLP(const Ipopt::SmartPtrIpopt::TNLP&) virtual ApplicationReturnStatus OptimizeTNLP(const SmartPtr& tnlp); ^ /usr/local/include/coin/IpIpoptApplication.hpp:79:37: note: no known conversion for argument 1 from ‘Ipopt::SmartPtrMadOpt::IpoptUserClass’ to ‘const Ipopt::SmartPtrIpopt::TNLP&’ /home/dromero/Downloads/madopt-master/src/ipopt_model.cpp:58:55: error: no matching function for call to ‘Ipopt::IpoptApplication::ReOptimizeTNLP(Ipopt::SmartPtrMadOpt::IpoptUserClass&)’ impl->Iapp.ReOptimizeTNLP(impl->ipopt_callback); ^ /home/dromero/Downloads/madopt-master/src/ipopt_model.cpp:58:55: note: candidate is: In file included from /home/dromero/Downloads/madopt-master/src/ipopt_nlp.hpp:19:0, from /home/dromero/Downloads/madopt-master/src/ipopt_model.cpp:17: /usr/local/include/coin/IpIpoptApplication.hpp:92:37: note: virtual Ipopt::ApplicationReturnStatus Ipopt::IpoptApplication::ReOptimizeTNLP(const Ipopt::SmartPtrIpopt::TNLP&) virtual ApplicationReturnStatus ReOptimizeTNLP(const SmartPtr& tnlp); ^ /usr/local/include/coin/IpIpoptApplication.hpp:92:37: note: no known conversion for argument 1 from ‘Ipopt::SmartPtrMadOpt::IpoptUserClass’ to ‘const Ipopt::SmartPtrIpopt::TNLP&’ make[2]: * [CMakeFiles/madopt_ipopt.dir/src/ipopt_model.cpp.o] Error 1 make[1]: * [CMakeFiles/madopt_ipopt.dir/all] Error 2 make: *\ [all] Error 2

stanle commented 9 years ago

Hello David and thanks for reporting. I've changed some things that should fix it, please get the newest version and try again.

Strange that my compiler did not have a problem with it. I have gcc 4.9.2. Out of curiosity, what compiler and version are you using?

Karsten

davidromerot commented 9 years ago

Hello Karsten,

Thanks for your quick reply. Unfortunately, I didn't have a chance to test this until today. My GCC is 4.8.1, and with the linux version I have (Mint16) I cannot upgrade GCC unless I compile it from source.

Another problem I have is that I do not have Cython.distutils because I am using the Anaconda python (2.7), so installing only the python module (without the C++ libraries) doesn't work either.

Just to let you know. I was trying to get madopt installed here, so I can play with it in my free time, but it is not really that urgent for me. If you could provide a python module that would work under python 2.7 (Anaconda is based on cython but also has ipython, I think), that would be great. If not, don't worry, once I upgrade my system later down the road I will try again.

Thanks for sharing your code...

On Wed, Feb 11, 2015 at 6:17 PM, Karsten Lehmann notifications@github.com wrote:

Hello David and thanks for reporting. I've changed some things that should fix it, please get the newest version and try again.

Strange that my compiler did not have a problem with it. I have gcc 4.9.2. Out of curiosity, what compiler and version are you using?

Karsten

— Reply to this email directly or view it on GitHub https://github.com/stanle/madopt/issues/1#issuecomment-73986365.

davidromerot commented 9 years ago

Update:

In the process of making this work, I was falling prey to a documented sudo problem on Ubunto (it changes the PATH environment), so I was not running the anaconda python but instead I was running the default python, so the Cython.Distutils module/package was not being found.

Now, after fixing this, the errors I get when building the python module are in the attached file, just in case it helps you.

Thanks, David

On Thu, Feb 19, 2015 at 2:01 PM, David Romero davidromerot@gmail.com wrote:

Hello Karsten,

Thanks for your quick reply. Unfortunately, I didn't have a chance to test this until today. My GCC is 4.8.1, and with the linux version I have (Mint16) I cannot upgrade GCC unless I compile it from source.

Another problem I have is that I do not have Cython.distutils because I am using the Anaconda python (2.7), so installing only the python module (without the C++ libraries) doesn't work either.

Just to let you know. I was trying to get madopt installed here, so I can play with it in my free time, but it is not really that urgent for me. If you could provide a python module that would work under python 2.7 (Anaconda is based on cython but also has ipython, I think), that would be great. If not, don't worry, once I upgrade my system later down the road I will try again.

Thanks for sharing your code...

  • David

On Wed, Feb 11, 2015 at 6:17 PM, Karsten Lehmann <notifications@github.com

wrote:

Hello David and thanks for reporting. I've changed some things that should fix it, please get the newest version and try again.

Strange that my compiler did not have a problem with it. I have gcc 4.9.2. Out of curiosity, what compiler and version are you using?

Karsten

— Reply to this email directly or view it on GitHub https://github.com/stanle/madopt/issues/1#issuecomment-73986365.

running build_ext skipping 'src/madopt.cpp' Cython extension (up-to-date) building 'madopt' extension gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dromero/anaconda/include/python2.7 -c src/madopt.cpp -o build/temp.linux-x86_64-2.7/src/madopt.o --std=c++11 -g cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] In file included from src/expr.hpp:19:0, from src/var.hpp:19, from src/model.hpp:22, from src/madopt.cpp:235: src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, MadOpt::Idx)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:60:9: warning: when initialized here [-Wreorder] Operator(OPType t, Idx p): type(t), value(p){ ^ src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, int)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:65:9: warning: when initialized here [-Wreorder] Operator(OPType t, int p): type(t), value(p){ ^ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dromero/anaconda/include/python2.7 -c src/ipopt_model.cpp -o build/temp.linux-x86_64-2.7/src/ipopt_model.o --std=c++11 -g cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] In file included from src/expr.hpp:19:0, from src/var.hpp:19, from src/model.hpp:22, from src/ipopt_model.hpp:19, from src/ipopt_model.cpp:16: src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, MadOpt::Idx)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:60:9: warning: when initialized here [-Wreorder] Operator(OPType t, Idx p): type(t), value(p){ ^ src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, int)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:65:9: warning: when initialized here [-Wreorder] Operator(OPType t, int p): type(t), value(p){ ^ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dromero/anaconda/include/python2.7 -c src/bonmin_model.cpp -o build/temp.linux-x86_64-2.7/src/bonmin_model.o --std=c++11 -g cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] In file included from src/expr.hpp:19:0, from src/var.hpp:19, from src/model.hpp:22, from src/bonmin_model.hpp:19, from src/bonmin_model.cpp:16: src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, MadOpt::Idx)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:60:9: warning: when initialized here [-Wreorder] Operator(OPType t, Idx p): type(t), value(p){ ^ src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, int)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:65:9: warning: when initialized here [-Wreorder] Operator(OPType t, int p): type(t), value(p){ ^ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dromero/anaconda/include/python2.7 -c src/model.cpp -o build/temp.linux-x86_64-2.7/src/model.o --std=c++11 -g cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] In file included from src/expr.hpp:19:0, from src/var.hpp:19, from src/model.hpp:22, from src/model.cpp:16: src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, MadOpt::Idx)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:60:9: warning: when initialized here [-Wreorder] Operator(OPType t, Idx p): type(t), value(p){ ^ src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, int)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:65:9: warning: when initialized here [-Wreorder] Operator(OPType t, int p): type(t), value(p){ ^ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dromero/anaconda/include/python2.7 -c src/common.cpp -o build/temp.linux-x86_64-2.7/src/common.o --std=c++11 -g cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dromero/anaconda/include/python2.7 -c src/expr.cpp -o build/temp.linux-x86_64-2.7/src/expr.o --std=c++11 -g cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] In file included from src/expr.hpp:19:0, from src/expr.cpp:16: src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, MadOpt::Idx)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:60:9: warning: when initialized here [-Wreorder] Operator(OPType t, Idx p): type(t), value(p){ ^ src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, int)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:65:9: warning: when initialized here [-Wreorder] Operator(OPType t, int p): type(t), value(p){ ^ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dromero/anaconda/include/python2.7 -c src/ipopt_nlp.cpp -o build/temp.linux-x86_64-2.7/src/ipopt_nlp.o --std=c++11 -g cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] In file included from src/expr.hpp:19:0, from src/var.hpp:19, from src/model.hpp:22, from src/ipopt_nlp.cpp:19: src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, MadOpt::Idx)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:60:9: warning: when initialized here [-Wreorder] Operator(OPType t, Idx p): type(t), value(p){ ^ src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, int)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:65:9: warning: when initialized here [-Wreorder] Operator(OPType t, int p): type(t), value(p){ ^ gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/dromero/anaconda/include/python2.7 -c src/bonmin_minlp.cpp -o build/temp.linux-x86_64-2.7/src/bonmin_minlp.o --std=c++11 -g cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] In file included from src/expr.hpp:19:0, from src/var.hpp:19, from src/model.hpp:22, from src/bonmin_model.hpp:19, from src/bonmin_minlp.cpp:17: src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, MadOpt::Idx)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:60:9: warning: when initialized here [-Wreorder] Operator(OPType t, Idx p): type(t), value(p){ ^ src/operator.hpp: In constructor ‘MadOpt::Operator::Operator(MadOpt::OPType, int)’: src/operator.hpp:129:16: warning: ‘MadOpt::Operator::type’ will be initialized after [-Wreorder] OPType type; ^ src/operator.hpp:128:19: warning: ‘uintptr_t MadOpt::Operator::value’ [-Wreorder] uintptr_t value; ^ src/operator.hpp:65:9: warning: when initialized here [-Wreorder] Operator(OPType t, int p): type(t), value(p){ ^ src/bonmin_minlp.cpp: In member function ‘virtual void MadOpt::BonminUserClass::finalize_solution(Bonmin::TMINLP::SolverReturn, Index, const Number*, Number)’: src/bonmin_minlp.cpp:70:14: error: ‘USER_INTERRUPT’ is not a member of ‘Bonmin::TMINLP::SolverReturn’ case SolverReturn::USER_INTERRUPT: ^ error: command 'gcc' failed with exit status 1

stanle commented 9 years ago

quick solution: your bonmin version is probably < 1.7. If you update to the newest (1.8.1) it should work. If you can not update then I can try to make it compatible with <= 1.6.

ciao Karsten

stanle commented 9 years ago

Hello David,

I've added code that should fix the problem you experineced. But their might be other problems with the compability to older bonmin versions. I can not test this right now. Also when you update to the newest madopt version, please note the change in the build process for the python module. You find all the details in the new README.

ciao Karsten

davidromerot commented 9 years ago

Thanks Karsten,

With the changes you made, the build process worked. For some reason, however, it was not detecting my bonmin libraries, and ignored my CUSTOM_LIBRARY and CUSTOM_INCLUDES directives. So after running cmake but before running make, I edited the CMakeCache and edited the bonmin entry (it's at the beginning of the file), and replaced the "not-found" symbol with the path pointing to my bonmin library. After that, it build the c++ libraries. Then I built the python module (with build_ext --inplace), and it worked.

The problem is now when I import the module in python. As you expected, there is an error which I think it is because of the older bonmin version I have. This is the error:

$ python Python 2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Aug 21 2014, 18:22:21) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://binstar.org

import madopt Traceback (most recent call last): File "", line 1, in ImportError: /home/dromero/anaconda/bin/../lib/libbonmin.so.4: undefined symbol: _ZTI11CbcStrategy

Trying to fix this, I downloaded Bonmin1.8 and compiled it from source. It gave me some errors during compilation, which I am trying to fix. I will let you know how it goes.

On Fri, Feb 20, 2015 at 2:11 AM, Karsten Lehmann notifications@github.com wrote:

Hello David,

I've added code that should fix the problem you experineced. But their might be other problems with the compability to older bonmin versions. I can not test this right now. Also when you update to the newest madopt version, please note the change in the build process for the python module. You find all the details in the new README.

ciao Karsten

— Reply to this email directly or view it on GitHub https://github.com/stanle/madopt/issues/1#issuecomment-75198590.