The point of this effort is to prevent me from dual booting windows ,having to install CPLEX twice in the same system (storage is quite limited) and ofc be able to compile the required cross-platform executables from my main os which is debian linux.
For this reason i'm using mingw64 and my compilation script looks like this:
#!/bin/sh
#COMPILATION FLAGS
FLAGS='-DIL_STD -DILOUSEMT -D_REENTRANT'
EXTRA='-std=c++11 -static -static-libgcc -static-libstdc++'
#INCLUDES
OPL_INCL='-I/opt/ibm/ILOG/CPLEX_Studio128/opl/include'
CPL_INCL='-I/opt/ibm/ILOG/CPLEX_Studio128/cplex/include'
CON_INCL='-I/opt/ibm/ILOG/CPLEX_Studio128/concert/include'
#LINKER
OPL_LIB='-L/opt/ibm/ILOG/CPLEX_Studio128/opl/lib/x64_windows_vs2017/stat_mda'
CPL_LIB='-L/opt/ibm/ILOG/CPLEX_Studio128/cplex/lib/x64_windows_vs2017/stat_mda'
CON_LIB='-L/opt/ibm/ILOG/CPLEX_Studio128/concert/lib/x64_windows_vs2017/stat_mda'
#echo $FLAGS
/usr/bin/x86_64-w64-mingw32-g++ $FLAGS $OPL_INCL $EXTRA main.cpp $OPL_LIB $CON_LIB $CPL_LIB -lcplex -lm -lpthread
#g++ -std=c++11 $FLAGS $OPL_INCL main.cpp $OPL_LIB $CON_LIB $CPL_LIB -lcplex -lm -lpthread
What I have done is that I copied the windows version of the library files from another windows installation, and I'm now trying to compile my code using the global (I suppose) include files but using the windows version (.lib) of the necessary cplex libraries.
I thought that the nightmare would be the linking, but to my surprise, I didn't even manage to get there. The Mingw compiler is aborting compilation because of a generic.h
file missing (which from what I understand with a bit of searching, it should be related with the kernel or something)
In file included from /opt/ibm/ILOG/CPLEX_Studio128/opl/include/ilconcert/iloenv.h:21:0,
from /opt/ibm/ILOG/CPLEX_Studio128/opl/include/ilconcert/iloalg.h:21,
from /opt/ibm/ILOG/CPLEX_Studio128/opl/include/ilconcert/ilomodel.h:21,
from /opt/ibm/ILOG/CPLEX_Studio128/opl/include/ilcplex/ilocplex.h:27,
from /opt/ibm/ILOG/CPLEX_Studio128/opl/include/ilopl/iloopl.h:23,
from main.cpp:3:
/opt/ibm/ILOG/CPLEX_Studio128/opl/include/ilconcert/ilosys.h:262:21: fatal error: generic.h: No such file or directory
#include "generic.h"
^
compilation terminated.
I also tried just for testing to compile using g++
and this error was quickly bypassed and as expected the new errors are related with linking the cplex library : /usr/bin/ld: cannot find -lcplex
, which is probably missing cause I have not included the linux library folders.
Do I have any hopes to do that or is this impossible in the first place?
PS: I have a much simpler piece of code where I'm doing exactly the same thing (no CPLEX) involved and compilation works like a charm. So I suppose that the issue should be also CPLEX related.