Topic
6 replies Latest Post - ‏2013-02-22T09:57:47Z by T_O
SystemAdmin
SystemAdmin
7944 Posts
ACCEPTED ANSWER

Pinned topic Compile using old CPLEX version

‏2013-02-21T23:07:06Z |
I have several versions of cplex and I want to compile using an old one.

The current command line is : $(CXX) $(CFLAGS) -o x x.o -lilocplex -lconcert -lcplex -lm -lpthread

Thanks for your suggestions,
Updated on 2013-02-22T09:57:47Z at 2013-02-22T09:57:47Z by T_O
  • T_O
    T_O
    308 Posts
    ACCEPTED ANSWER

    Re: Compile using old CPLEX version

    ‏2013-02-21T23:29:03Z  in response to SystemAdmin
    Where is the problem? Just change the actual include and library path to the older CPLEX version and hope that the API is compatible.

    Best regards,
    Thomas
    • SystemAdmin
      SystemAdmin
      7944 Posts
      ACCEPTED ANSWER

      Re: Compile using old CPLEX version

      ‏2013-02-22T00:04:47Z  in response to T_O
      Hi thanks for your answer,

      I am not familiar with the compilation arguments, and I do not know how to change the include and library path to the older CPLEX version.

      The libraries are stored in the folder named /home/modules/modulefiles

      and how I can change the above command to use cplex-studio/12.1 version?

      I am sorry for a such easy question, but I have no clue from where I should start because of my UNIX/linux knowledge.

      MInh.
      • T_O
        T_O
        308 Posts
        ACCEPTED ANSWER

        Re: Compile using old CPLEX version

        ‏2013-02-22T00:21:28Z  in response to SystemAdmin
        Ok. First of all, somewhere your include and library paths must be defined (otherwise the compiler would not be able do locate CPLEX). Could you post the output of the following command:
        env | grep _PATH
        


        Best regards,
        Thomas

        P.S.: You could set include and library paths using -I and -L, but i don't know which one is preferred then. So let's find out, where your path is set.
        Updated on 2014-03-24T22:39:21Z at 2014-03-24T22:39:21Z by iron-man
        • SystemAdmin
          SystemAdmin
          7944 Posts
          ACCEPTED ANSWER

          Re: Compile using old CPLEX version

          ‏2013-02-22T00:39:03Z  in response to T_O
          Thanks for your kindly help, this is the output of the grep :

          LIBRARY_PATH=/home/ibm/cplex-studio/12.5.0.0/cpoptimizer/lib/x86-64_sles10_4.1/static_pic:/home/ibm/cplex-studio/12.5.0.0/opl/lib/x86-64_sles10_4.1/static_pic:/home/ibm/cplex-studio/12.5.0.0/concert/lib/x86-64_sles10_4.1/static_pic:/home/ibm/cplex-studio/12.5.0.0/cplex/lib/x86-64_sles10_4.1/static_pic
          LD_LIBRARY_PATH=/home/ibm/cplex-studio/12.5.0.0/opl/bin/x86-64_sles10_4.1:/home/ibm/cplex-studio/12.5.0.0/cplex/bin/x86-64_sles10_4.1:/home/sungrid/sge-6.0u3/lib/lx24-amd64:/usr/lib64/mpi/gcc/openmpi/lib64
          LIBRARY_PATH_EXPANDED=-L/home/ibm/cplex-studio/12.5.0.0/cpoptimizer/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/12.5.0.0/opl/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/12.5.0.0/concert/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/12.5.0.0/cplex/lib/x86-64_sles10_4.1/static_pic
          • SystemAdmin
            SystemAdmin
            7944 Posts
            ACCEPTED ANSWER

            Re: Compile using old CPLEX version

            ‏2013-02-22T07:06:21Z  in response to SystemAdmin
            If you are unfamiliar with Linux/Unix and Makefiles then I think there is an easier way. CPLEX comes with example code and a Makefile to build them. In your CPLEX installation there should be a directory cplex/examples/x86-64_sles10_4.1/static_pic (in very old version 'sles' maybe 'debian'). Do the following
            1. Change to that directory.
            2. Run 'make lpex1'. This will compile the lpex1.o object file as well as the lpex1 binary. From the output you can see which flags you need to supply for compilation.
            3. Do this for each version you have.
            4. Adjust your own build process accordingly.
            What may be even easier is to copy cplex/examples/x86-64_sles10_4.1/static_pic/Makefile to your own Makefile (in the directory where x.c is). The only things you need to change are
            1. Replace the string "lpex1" by "x" (so that the x.c source file is compiled into the "x" binary.
            2. Change the two assignments
            
            CPLEXDIR      = ../../.. CONCERTDIR    = ../../../../concert
            

            into (replacing /path/to/COS with the respective CPLEX installation directory)
            
            CPLEXDIR      = /path/to/COS/cplex CONCERTDIR    = /path/to/COS/concert
            

            3. Run 'make x'
            4. Optionally delete everything that is not needed from the copied Makefile.
            Note that the example Makefile has also rules to build C++ and Java examples.

            If you run into further troubles with that then please specify
            • which version of CPLEX causes the trouble,
            • where that version is installed,
            • what exactly are the error messages you see.
          • T_O
            T_O
            308 Posts
            ACCEPTED ANSWER

            Re: Compile using old CPLEX version

            ‏2013-02-22T09:57:47Z  in response to SystemAdmin
            Ok, thank you. I don't yet see where the include path comes from (I guess it comes from the flags).

            Either follow Daniel's approach or provide the output of
            env | grep cplex
            


            For your information:
            It should be sufficient to change some environement variables for the compile command. Something like

            LIBRARY_PATH=/foo/bar/lib OTHER_VARIABLE_WHICH_I_DONT_KNOW_YET=something your_old_build_command ...

            Best regards,
            Thomas
            Updated on 2014-03-24T22:39:13Z at 2014-03-24T22:39:13Z by iron-man