Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile external/solver #6

Open
coert opened this issue Oct 25, 2016 · 3 comments
Open

Unable to compile external/solver #6

coert opened this issue Oct 25, 2016 · 3 comments

Comments

@coert
Copy link

coert commented Oct 25, 2016

After successfully installing Gurobi 6.0.5 I try to make the solver. During linking I get the following:

CMakeFiles/solver-callback.dir/src/pose/research/solver-callback.cxx.o: In function void andres::ilp::Gurobi<double>::addConstraint<unsigned long*, double const*>(unsigned long*, unsigned long*, double const*, double, double) [clone .constprop.252]': solver-callback.cxx:(.text+0x2fc): undefined reference toGRBModel::addConstr(GRBLinExpr const&, char, GRBLinExpr const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)'
solver-callback.cxx:(.text+0x363): undefined reference to GRBModel::addConstr(GRBLinExpr const&, char, GRBLinExpr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' CMakeFiles/solver-callback.dir/src/pose/research/solver-callback.cxx.o: In functionandres::ilp::Gurobi::Callback::callback()':
solver-callback.cxx:(.text._ZN6andres3ilp6GurobiIdE8Callback8callbackEv[_ZN6andres3ilp6GurobiIdE8Callback8callbackEv]+0xbf): undefined reference to GRBException::getMessage[abi:cxx11]() const' CMakeFiles/solver-callback.dir/src/pose/research/solver-callback.cxx.o: In functionvoid andres::ilp::Gurobi::addConstraint<__gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator > >, __gnu_cxx::__normal_iterator<double*, std::vector<double, std::allocator > > >(__gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator > >, __gnu_cxx::__normal_iterator<unsigned long*, std::vector<unsigned long, std::allocator > >, gnu_cxx::normal_iterator<double*, std::vector<double, std::allocator > >, double, double) [clone .constprop.251]':
solver-callback.cxx:(.text.ZN6andres3ilp6GurobiIdE13addConstraintIN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEENS5_IPdS7_IdSaIdEEEEEEvT_SF_T0_dd.constprop.251[ZN4pose13PoseEstimatorIN6andres3ilp6GurobiIdEE24FeasibleSolutionCallbackE25addAllCouplingConstraintsEv]+0xb2): undefined reference to GRBModel::addConstr(GRBLinExpr const&, char, GRBLinExpr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' CMakeFiles/solver-callback.dir/src/pose/research/solver-callback.cxx.o: In functionvoid andres::ilp::Gurobi::addConstraint<unsigned long*, double const*>(unsigned long, unsigned long, double const
, double, double) [clone .constprop.253]':
solver-callback.cxx:(.text.ZN6andres3ilp6GurobiIdE13addConstraintIPmPKdEEvT_S7_T0_dd.constprop.253[ZN4pose13PoseEstimatorIN6andres3ilp6GurobiIdEE24FeasibleSolutionCallbackE36addAllImpossiblePartClassConstraintsEv]+0xb3): undefined reference to GRBModel::addConstr(GRBLinExpr const&, char, GRBLinExpr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' CMakeFiles/solver-callback.dir/src/pose/research/solver-callback.cxx.o: In functionvoid andres::ilp::Gurobi::addConstraint<unsigned long, double const>(unsigned long
, unsigned long
, double const
, double, double)':
solver-callback.cxx:(.text._ZN6andres3ilp6GurobiIdE13addConstraintIPmPKdEEvT_S7_T0_dd[_ZN6andres3ilp6GurobiIdE13addConstraintIPmPKdEEvT_S7_T0_dd]+0x13c): undefined reference to GRBModel::addConstr(GRBLinExpr const&, char, GRBLinExpr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' solver-callback.cxx:(.text._ZN6andres3ilp6GurobiIdE13addConstraintIPmPKdEEvT_S7_T0_dd[_ZN6andres3ilp6GurobiIdE13addConstraintIPmPKdEEvT_S7_T0_dd]+0x19f): undefined reference toGRBModel::addConstr(GRBLinExpr const&, char, GRBLinExpr const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)'
solver-callback.cxx:(.text._ZN6andres3ilp6GurobiIdE13addConstraintIPmPKdEEvT_S7_T0_dd[_ZN6andres3ilp6GurobiIdE13addConstraintIPmPKdEEvT_S7_T0_dd]+0x1f3): undefined reference to GRBModel::addConstr(GRBLinExpr const&, char, GRBLinExpr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' CMakeFiles/solver-callback.dir/src/pose/research/solver-callback.cxx.o:solver-callback.cxx:(.text._ZN6andres3ilp6GurobiIdE13addConstraintIN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEENS5_IPKmS9_EEEEvT_SE_T0_dd[_ZN6andres3ilp6GurobiIdE13addConstraintIN9__gnu_cxx17__normal_iteratorIPmSt6vectorImSaImEEEENS5_IPKmS9_EEEEvT_SE_T0_dd]+0x169): more undefined references toGRBModel::addConstr(GRBLinExpr const&, char, GRBLinExpr const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)' follow
CMakeFiles/solver-callback.dir/src/pose/research/solver-callback.cxx.o: In function main': solver-callback.cxx:(.text.startup+0x5f9): undefined reference toGRBException::getMessageabi:cxx11 const'
collect2: error: ld returned 1 exit status
CMakeFiles/solver-callback.dir/build.make:102: recipe for target 'solver-callback' failed
make[3]: *** [solver-callback] Error 1
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/solver-callback.dir/all' failed
make[2]: *** [CMakeFiles/solver-callback.dir/all] Error 2
CMakeFiles/Makefile2:153: recipe for target 'CMakeFiles/solver-callback.dir/rule' failed
make[1]: *** [CMakeFiles/solver-callback.dir/rule] Error 2
Makefile:155: recipe for target 'solver-callback' failed
make: *** [solver-callback] Error 2

Gurobi environment set to:
GUROBI_HOME=/opt/gurobi605/linux64
LD_LIBRARY_PATH=/opt/gurobi605/linux64/lib

Output from CMake:
coert@beta039608 /mnt/33EE47FC4F4F9C75/Install/deepcut_multiperson/external/solver $ cmake . -DGUROBI_ROOT_DIR=/opt/gurobi605/linux64 -DGUROBI_VERSION=60
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
-- OpenMP found
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.8.16")
-- Found GUROBI: /opt/gurobi605/linux64/lib/libgurobi60.so
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/33EE47FC4F4F9C75/Install/deepcut_multiperson/external/solver

What am I missing here?

@Gerjo
Copy link

Gerjo commented Nov 22, 2016

This particular error is caused by using a wrong version of the GCC compiler. I believe this has to do with the ABI interface changing with later versions of C++.

The Gurobi website lists gcc-4.6 as the latest supported[0], though the solver library clearly needs a newer version because it specifies the -std=c++11 option in CMake, and not -std=c++0x which is what gcc-4.6 supports. The gcc-4.8.1 compiler is first that supports the -std=c++11 option[1], and will get rid of the above linker error.

Assuming you run Ubuntu, you can sudo apt-get install g++-4.8 to get the latest 4.8 compiler. Following that, you must adjust your CMake invocation to:
cmake . -DGUROBI_ROOT_DIR=/home/gerjo/gurobi603/linux64 -DGUROBI_VERSION=60 -DCMAKE_CXX_COMPILER=/usr/bin/g++-4.8 -DCMAKE_C_COMPILER=/usr/bin/gcc-4.8

Setting -DGUROBI_ROOT_DIR to your installation.

I also hasten to add, that I'm using Gurobi 6.0.3 which you can acquire here (requires login). Not sure if that makes a difference, but the version number seems to match the one given in the build instructions under step 4.

Perhaps the repository maintainer, @eldar, can comment on which GCC version to use exactly?

[0] http://www.gurobi.com/products/supported-platforms
[1] https://gcc.gnu.org/projects/cxx-status.html#cxx11

@bghani
Copy link

bghani commented Nov 22, 2016

Thank you, Gerjo. I had the exact same problem. Your solution worked for me.

@derkbreeze
Copy link

@Gerjo Thank you Gerjo for your nice advice! Really works for me using default gcc and g++ 5.4.0 in Ubuntu16.04. I installed g++ 4.8.0 and it really helps a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants