Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

Running CPLEX on Linux with old gcc

  • 1.  Running CPLEX on Linux with old gcc

    Posted Wed September 03, 2014 08:55 PM

    Originally posted by: davidrey123


    Hello, 

    I have been running CPLEX using the C++ Concert API on a Windows machine for some time now and it's working fine but I am trying to run the same CPLEX code on a Linux machine which has a somewhat old gcc and I have not able to compile my cpp files. Basically I get lots of errors messages, most of them being triggered by ilocplex files.

    After browsing through the forum I found this thread https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014912991 and as suggested I have tried to compile the CPLEX examples with the lines: 

    cd /path/to/cos/cplex/x86-64_sles10_4.1/static_pic

    make ilolpex1

    but I still get a lot of errors: I have attached the whole output in the log file.

    Could you help me compile these CPLEX examples on my Linux machine?

    Thank you,

    -David


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Running CPLEX on Linux with old gcc

    Posted Mon September 15, 2014 10:14 AM

    That is odd. What version of CPLEX are you using and what is your version of gcc? Any chance to upgrade any of them?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Running CPLEX on Linux with old gcc

    Posted Mon September 15, 2014 07:58 PM

    Originally posted by: davidrey123


    Hello, 

    Thank you for your reply.

    I use CPLEX 12.5.0.0 and the gcc/Linux environment is:

    GCC: gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
    Linux: CentOS release 5.9 (Final)

    Best.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Running CPLEX on Linux with old gcc

    Posted Tue September 16, 2014 04:20 AM

    Hm, I tried the exact same thing with CPLEX 12.5.0.0 here and it worked:

    djunglas@... static_pic <807> g++ --version
    g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
    Copyright (C) 2006 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    djunglas@... static_pic <808> make blend
    g++ -O0 -c -m64 -O -fPIC -fno-strict-aliasing -fexceptions -DNDEBUG -DIL_STD -I../../../include -I../../../../concert/include  ../../../examples/src/cpp/blend.cpp -o blend.o
    g++ -O0 -m64 -O -fPIC -fno-strict-aliasing -fexceptions -DNDEBUG -DIL_STD -I../../../include -I../../../../concert/include  -L../../../lib/x86-64_sles10_4.1/static_pic -L../../../../concert/lib/x86-64_sles10_4.1/static_pic -o blend blend.o -lconcert -lilocplex -lcplex -lm -pthread

    What seems odd is that your compiler command line looks different than mine (I have "-O0", you have "-O" and the flags are in different places). Are you sure you are using 12.5.0.0? I was using a fresh install of 12.5.0.0 for my test.

    Could you please run this command:

    g++ -E -m64 -fPIC -fno-strict-aliasing -fexceptions -DNDEBUG -DIL_STD -I../../../include -I../../../../concert/include ../../../examples/src/cpp/blend.cpp | grep IloRtti | head -n 1

    and post here what that produces? It should give

    class IloRtti {

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Running CPLEX on Linux with old gcc

    Posted Wed September 17, 2014 08:31 PM

    Originally posted by: davidrey123


    Hello Daniel,

    I attached the output the executing your command produced. 

    Regards,

    -David


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Running CPLEX on Linux with old gcc

    Posted Wed September 17, 2014 08:36 PM

    Originally posted by: davidrey123


    I thing you are right we are not using CPLEX 12.5 (as I thought) but CPLEX 12.2.

    Should I just try to update to 12.5 ?


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Running CPLEX on Linux with old gcc

    Posted Thu September 18, 2014 01:57 AM

    I just tried 12.2 here and it works well in the exact same environment. Could it be that your CPLEX installation is somehow corrupted? Maybe run

    g++ -c -m64 -O -fPIC -fexceptions -DNDEBUG -DIL_STD -I../../../include -I../../../../concert/include ../../../examples/src/cpp/blend.cpp -E | sed -e '/^$/d'

    and

    g++ -c -m64 -O -fPIC -fexceptions -DNDEBUG -DIL_STD -I../../../include -I../../../../concert/include ../../../examples/src/cpp/blend.cpp -E -dM

    and attach the outputs here. That may give us a clue about what is going wrong on your side.


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Running CPLEX on Linux with old gcc

    Posted Thu September 18, 2014 02:39 AM

    Originally posted by: davidrey123


    It's good news to hear that 12.2 worked for you because I think we had tried to install 12.5 but it had not work out well.

    I don't see why our CPLEX installation would be corrupted but if necessary I am happy to try and install 12.2 again. For the record, when I use cplexamp with AMPL, it works fine.

    I have attached the two outputs.

    Regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Running CPLEX on Linux with old gcc

    Posted Mon September 22, 2014 03:08 AM

    It seems as if your preprocessor is skipping over a significant part of the ilosys.h header file. I have no idea why that happens. I see that in ilosys.h there are some Windows-like linefeeds. I don't think that this should throw off the preprocessor but could you still try to run dos2unix on the header files in your concert/ilconcert directory?

    If that does not help, could you please try to install cplex into a separate location and see if compiling from there works any better?


    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Running CPLEX on Linux with old gcc

    Posted Mon September 22, 2014 08:09 PM

    Originally posted by: davidrey123


    Hi Daniel, 

    I ran dos2unix on the header files in the ilconcert directory but no luck, it doesn't seem to change anything. I will re-install CPLEX in a separate location today and keep you posted.

    thanks

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Running CPLEX on Linux with old gcc

    Posted Thu September 18, 2014 01:54 AM

    The 'ILO_EXPORTED' should not be in the output. If I understand correctly then the compilation command

    g++ -c -m64 -O -fPIC -fexceptions -DNDEBUG -DIL_STD -I../../../include -I../../../../concert/include  ../../../examples/src/cpp/blend.cpp -o blend.o

    fails for you. Can you please try if just defining ILO_EXPORTED fixes the problem:

    g++ -c -m64 -O -fPIC -fexceptions -DNDEBUG -DIL_STD -DILO_EXPORTED -I../../../include -I../../../../concert/include  ../../../examples/src/cpp/blend.cpp -o blend.o

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: Running CPLEX on Linux with old gcc

    Posted Thu September 18, 2014 02:40 AM

    Originally posted by: davidrey123


    Indeed I think the 1st one fails. However defining ILO_EXPORTED triggers two errors. I have included both output in the attached file. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: Running CPLEX on Linux with old gcc

    Posted Mon September 15, 2014 07:59 PM

    Originally posted by: davidrey123


    It would be quite complicated to update the gcc but I believe we could update CPLEX.


    #CPLEXOptimizers
    #DecisionOptimization