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,
This topic has been locked.
6 replies Latest Post - 2013-02-22T09:57:47Z by T_O
Pinned topic Compile using old CPLEX version
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-02-22T09:57:47Z at 2013-02-22T09:57:47Z by T_O
Re: Compile using old CPLEX version2013-02-22T00:04:47Z in response to T_OHi 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.
Re: Compile using old CPLEX version2013-02-22T00:21:28Z in response to SystemAdminOk. 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
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.
Re: Compile using old CPLEX version2013-02-22T00:39:03Z in response to T_OThanks for your kindly help, this is the output of the grep :
LIBRARY_PATH_EXPANDED=-L/home/ibm/cplex-studio/126.96.36.199/cpoptimizer/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/188.8.131.52/opl/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/184.108.40.206/concert/lib/x86-64_sles10_4.1/static_pic -L/home/ibm/cplex-studio/220.127.116.11/cplex/lib/x86-64_sles10_4.1/static_pic
Re: Compile using old CPLEX version2013-02-22T07:06:21Z in response to SystemAdminIf 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.
Re: Compile using old CPLEX version2013-02-22T09:57:47Z in response to SystemAdminOk, 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 ...