AlexeyG / GRASS

GeneRic ASembly Scaffolder
GNU General Public License v3.0
5 stars 3 forks source link

Grass needs some IBM development CPLEX library to compile? #6

Open mmokrejs opened 8 years ago

mmokrejs commented 8 years ago

Hi, I am trying to prepare a package for Gentoo Linux. The following error seems that you maybe use some IBM development CPLEX library? Any details whether it is required or not?

g++ -c -O2 -m64 -std=gnu++0x -Wall -fPIC -fexceptions -fopenmp -DNDEBUG -DIL_STD -I../Common/ -I/usr/include/bamtools -I/data/bio/alexeygritsenk/apps/ILOG/cplex/include -I/data/bio/alexeygritsenk/apps/ILOG/concert/include -I/usr/include/ncbi-tools++ -o obj/DPSolver.o DPSolver.cpp
In file included from IterativeSolver.h:33:0,
                 from EMSolver.h:34,
                 from DPSolver.cpp:30:
FixedMIQPSolver.h:35:30: fatal error: ilcplex/ilocplex.h: No such file or directory
 #include <ilcplex/ilocplex.h>
                              ^
compilation terminated.
Makefile:30: recipe for target 'obj/DPSolver.o' failed
make[1]: *** [obj/DPSolver.o] Error 1
make[1]: Leaving directory '/var/tmp/portage/sci-biology/grass-20130628/work/GRASS-master/scaffoldOptimizer'
Makefile:24: recipe for target 'scaffoldOptimizer' failed
AlexeyG commented 8 years ago

Hi,

ILOG/IBM CPLEX is required - it's used internally to solve Quadratic and Linear Programming problem. It's a difficult dependency, which requires installing obtaining a license from IBM (free from academic usage).

It should be possible to port the code to use some open source solver, but I don't have time for this.

Also, if you decide to install CPLEX and continue compiling, you might want to change the custom include path to match your directories:

-I/usr/include/bamtools -I/data/bio/alexeygritsenk/apps/ILOG/cplex/include -I/data/bio/alexeygritsenk/apps/ILOG/concert/include -I/usr/include/ncbi-tools++

Alexey

mmokrejs commented 8 years ago

I learned by the hard way already. ;-)

https://www.mail-archive.com/gentoo-commits@lists.gentoo.org/msg184287.html

I wonder whether you would better include standard paths into the Makefile.config , everybody except you has to edit the file. ;-)

Also, would be nice if you provided the manual.tex converted into .pdf or .txt.

AlexeyG commented 8 years ago

If you can provided an edited Makefile, I will merge it.

2016-02-11 22:18 GMT+01:00 mmokrejs notifications@github.com:

I learned by the hard way already. ;-)

https://www.mail-archive.com/gentoo-commits@lists.gentoo.org/msg184287.html

I wonder whether you would better include standard paths into the Makefile.config , everybody except you has to edit the file. ;-)

Also, would be nice if you provided the manual.tex converted into .pdf or .txt.

— Reply to this email directly or view it on GitHub https://github.com/AlexeyG/GRASS/issues/6#issuecomment-183063229.

mmokrejs commented 8 years ago

Here it is, but while we are at it I think that:

  1. you should stick with CFLAGS and CXXFLAGS and preserve user's environment in this way:

CFLAGS = $(CFLAGS) -std=gnu++0x

  1. Not sure why you force -m64, leave it off.
  2. Use CXX instead of CCC

CXX ?= g++

  1. So the below Makefile.config still needs some work.
# C++ compiler
CCC = g++
# Compiler flags (you probably don't need to change anything here)
CCCFLAGS = -O2 -m64 -std=gnu++0x -Wall
# include directory
CCCINC = -I../Common/ -I/usr/include/bamtools
# library directory and libraries
CCCLIB = -lbamtools

# Extra flags. Used for compiling scaffoldOptimizer (it uses the NCBI C++ Toolkit and CPLEX API)
CCEFLAGS = -fPIC -fexceptions -fopenmp -DNDEBUG -DIL_STD
CCEINC = -I/data/bio/alexeygritsenk/apps/ILOG/cplex/include -I/data/bio/alexeygritsenk/apps/ILOG/concert/include -I/usr/include/ncbi-tools++
CCELIB = -lxalgoalignnw -lxobjmgr -lgenome_collection -lseqset -lseqedit -lseq -lseqcode -lsequtil -lpub -lmedline -lbiblio -lgeneral -lxser -lxutil -lxncbi -ltables -L/data/bio/alexeygritsenk/apps/ILOG/cplex/lib/x86-64_sles10_4.1/static_pic -lilocplex -lcplex -L/data/bio/alexeygritsenk/apps/ILOG/concert/lib/x86-64_sles10_4.1/static_pic -lconcert -lm -pthread

# Do not change anything below unless (you think) you know what you're doing.
MAKE = make
MD = mkdir
CDIR = ../Common
ODIR = obj
BDIR = ../bin
  1. I did not fiddle with the CPLEX-related paths, I do not have it so no idea what are its common installation path
AlexeyG commented 8 years ago

I updated the makefile with the changes you propose.

mmokrejs commented 7 years ago

It does not seem so. Here is what I meant.

fix_Makefile_variablenames.patch.txt

Oh yes, I still need to install the CPLEX library anyway.

vishalvishukumar commented 6 years ago

I was facing similar problem while integrating CPLEX with R, and installing the cplexAPI package, see https://cran.r-project.org/web/packages/cplexAPI/ there were few mistakes that I was doing, first of all, the problem arises because R does not know where IBM CPLEX is installed, so you have to manually change the file Makevars.win in the cplexAPI_1.3.3.tar.gz PKG_CPPFLAGS=-g -DR=1 -DUSE_R=1 -I"${CPLEX_STUDIO_DIR}\cplex\include" PKG_LIBS=-L"${CPLEX_STUDIO_LIB}" -lm -lcplex1261

two thing that you need to check is -L"${CPLEX_STUDIO_LIB}" is replaced by in my case, -L"C:/Program Files/IBM/ILOG/CPLEX_Studio1271/cplex/bin/x64_win64" (see bin/x64_win64) , replace $ too

second inside the folder x64_win64, look for cplex12**.dll file, this the file where -lcplex1261 is pointing to, here manually change -lcplex1261 to whatever your file name is (in my case it was cplex1271.dll, so I changed -lcplex1261 to -lcplex1271,

similarly ${CPLEX_STUDIO_DIR} must be replaced by C:/Program Files/IBM/ILOG/CPLEX_Studio1271 (in my case).

After this, follow the instruction given in https://www.r-bloggers.com/using-cplex-in-r-installing-cplexapi-in-windows-10/, essentially use the following command (from command lines) to repackage and install cplexAPI_1.3.3.tar.gz (make sure you have Rtools installed, and make sure environment variables have PATH pointing to installation files of R, essentially taking to R.exe and Rcmd.exe for the commands to run)

R CMD build --no-build-vignettes --no-manual --md5 C:\Users{computer name here}\Desktop\cplexAPI R CMD INSTALL --build --no-multiarch .\cplexAPI_1.3.3.tar.gz