Closed jerviedog closed 5 years ago
This would happen is Clp was built with support for Glpk (the coinglpk
package was detected at configure time), but then Glpk was not linked in the end. Most likely, there was already a version of CoinUtils present on the system that wasn't built with Glpk support and Clp was linked to that, but then Glpk was downloaded and built when you ran coinbrew
as above. Did you separately install CoinUtils or maybe install the Debian package for CoinUtils? Can you do
pkg-config --libs coinutils
and see what the output says?
Thanks for your reply:)
I don't have any COIN-OR package installed. But I do build GLPK myself.
But after I removed the glpk path from LD_LIBRARY_PATH, the undefined reference error in linking state still occurred.
The build command that trigger the error was:
g++ -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DCLP_BUILD -o .libs/clp ClpMain.o
./.libs/libClpSolver.so ~/opt/COIN-OR-OptimizationSuite/build/Clp/master/src/.libs/libClp.so ./.libs/libClp.so -L/usr/lib/gcc/x86_64-linux-gnu/6 -L/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/6/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/6/../../.. ~/opt/COIN-OR-OptimizationSuite/build/ThirdParty/Mumps/1.6/.libs/libcoinmumps.so -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lgfortran -lquadmath ~/opt/COIN-OR-OptimizationSuite/build/CoinUtils/master/src/.libs/libCoinUtils.so -lbz2 -lz -lblas ~/opt/COIN-OR-OptimizationSuite/build/ThirdParty/Glpk/1.10/.libs/libcoinglpk.so ~/opt/COIN-OR-OptimizationSuite/build/ThirdParty/ASL/1.4/.libs/libcoinasl.so -lm -ldl -Wl,--rpath -Wl,/opt/cpp/opt/coin-or/lib
I searched all the cpp files for cbc_glp_tran. There are three hits:
./CoinUtils/CoinUtils/src/CoinMpsIO.cpp ./Cbc/Cbc/src/CbcSolver.cpp ./Clp/Clp/src/ClpSolver.cpp
The definition for cbc_glp_tran is in the file ./CoinUtils/CoinUtils/src/CoinMpsIO.cpp.
Any idea?
Ps: I have deleted the build/ directory before building. Before I built Clp, I succeeded in building CoinUtils and Osi packages.
Update:
I succeeded in building Clp after:
I modified the file: ./CoinUtils/CoinUtils/src/CoinMpsIO.cpp from
glp_tran cbc_glp_tran = NULL; glp_prob cbc_glp_prob = NULL;
to
glp_tran cbc_glp_tran = NULL; glp_prob cbc_glp_prob = NULL;
I rebult CoinUitls.
By the way. I also succeeded in building Cbc after the modification. The test also seemed OK.
Hmm, this is strange. So Glpk was detected as present (and was present) when Clp was built (you have ~/opt/COIN-OR-OptimizationSuite/build/ThirdParty/Glpk/1.10/.libs/libcoinglpk.so
in the build command), but either it was not present or CoinUtils did not detect it as present when it was built (and hence COIN_HAS_GLPK
was not defined).
I'm not sure exactly what went wrong. Somehow, things were built out of order. It could have something to do with the parallel build, although I don't see how this could have caused the problem. If you now restore CoinUtils to its unmodified state (git reset --hard HEAD
) and then do
coinbrew/coinbrew build Clp --reconfigure
it should work. When reconfiguring CoinUtils, it will now detect the presence of Glpk (which is already built) and will rebuild CoinUtils with Glpk support, then Clp will link correctly.
If the problem repeats itself another time, let us know, but for now, I'm not sure how to replicate the issue.
I think you are right. This might be caused by previous configuration which tried to use system Glpk.
I cloned a fresh COIN-OR-OptimizationSuite, and directly built Clp. This worked.
I also tried another method to see if COIN_HAS_GLPK would be unset if I built CoinUtils first. The build process was successful.
So you are right. Thanks.
Great, thanks!
Dear colleagues,
I followed the build routine:
coinbrew/coinbrew fetch --main-proj=Clp coinbrew/coinbrew build --main-proj=Clp --parallel-jobs=8
The build system failed with the error message:
./.libs/libClpSolver.so: undefined reference to
cbc_glp_prob' ./.libs/libClpSolver.so: undefined reference to
cbc_glp_tran'The error was due to the compilation of clp program.
Any idea?