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

symbol issues with subclasses of IpoptException #418

Closed
notwa opened this issue Oct 23, 2020 · 1 comment
Closed

symbol issues with subclasses of IpoptException #418

notwa opened this issue Oct 23, 2020 · 1 comment

Comments

@notwa
Copy link

notwa commented Oct 23, 2020

as a loose follow-up to #416, Bonmin is failing to build for me because mingw GCC seems to be treating the TMINLP_INVALID class as an export. this pertains to Ipopt and not Bonmin since the issue is in the definitions for IPOPTLIB_EXPORT and DECLARE_STD_EXCEPTION. make fails with:

make[2]: Entering directory '/home/notwa/src/coin-or/coin-or-Bonmin-65c56ce/Bonmin/src/Apps'
/bin/sh ../../../libtool --tag=CXX --mode=link g++  -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long   -DBONMIN_BUILD   -o bonmin.exe  BonMin.o ../CbcBonmin/libbonminampl.la ../CbcBonmin/libbonmin.la -LC:/msys64/opt/coin-or/lib -lCbcSolver -lCbc -lCgl -lOsiClp -lClpSolver -lClp -lcoinasl -lm -lOsi -lCoinUtils -lbz2 -lz -lm -lipopt  -LC:/msys64/opt/coin-or/lib -lipoptamplinterface -lipopt
g++ -O3 -pipe -DNDEBUG -Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion -Wno-unknown-pragmas -Wno-long-long -DBONMIN_BUILD -o bonmin.exe BonMin.o  ../CbcBonmin/.libs/libbonminampl.a /home/notwa/src/coin-or/coin-or-Bonmin-65c56ce/Bonmin/src/CbcBonmin/.libs/libbonmin.a -LC:/msys64/opt/coin-or/lib -L=C:/msys64/opt/coin-or/lib ../CbcBonmin/.libs/libbonmin.a /opt/coin-or/lib/libCbcSolver.a /opt/coin-or/lib/libCbc.a /opt/coin-or/lib/libCgl.a /opt/coin-or/lib/libOsiClp.a /opt/coin-or/lib/libClpSolver.a /opt/coin-or/lib/libClp.a /opt/coin-or/lib/libcoinasl.a /opt/coin-or/lib/libOsi.a /opt/coin-or/lib/libCoinUtils.a -lbz2 -lz /opt/coin-or/lib/libipoptamplinterface.dll.a /opt/coin-or/lib/libipopt.dll.a -L/opt/coin-or/lib -L/opt/coin-or/lib
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/home/notwa/src/coin-or/coin-or-Bonmin-65c56ce/Bonmin/src/CbcBonmin/.libs/libbonmin.a(BonBranchingTQP.o):BonBranchingTQP.cpp:(.text$_ZN6Bonmin14TMINLP_INVALIDC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_i[_ZN6Bonmin14TMINLP_INVALIDC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_i]+0x259): undefined reference to `__imp__ZTVN6Bonmin14TMINLP_INVALIDE'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:437: bonmin.exe] Error 1

and you can see the symbol is indeed missing from BonBranchingTQP.o, despite being the object file defining the subclass:

                 U __imp__ZTVN5Ipopt14IpoptExceptionE
                 U __imp__ZTVN6Bonmin14TMINLP_INVALIDE

therefore the issue is before it even hits the linker. the symbol above for IpoptException is correctly linked in from libipopt.dll.a, but the compiler seems to be looking for TMINLP_INVALID externally as well.

my temporary workaround is adding #define IPOPTLIB_EXPORT to BonTMINLP.hpp after the includes, such that __declspec(dllimport) is not used on its subclasses. after this, Bonmin builds successfully.

@svigerske
Copy link
Member

65c56ce says that this is Bonmin 1.8.8, right (coin-or/Bonmin@65c56ce)?
That will not work with Ipopt 3.13.

You will have to either switch to Ipopt 3.12, etc (see https://github.com/coin-or/Bonmin/blob/stable/1.8/Dependencies) or use Bonmin/master.
There is no Bonmin release yet that uses 3.13, because we wait for a Cbc release.

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

2 participants