[Coin-discuss] Lapack, blas, g2c and makefiles
Francois Margot
fmargot at andrew.cmu.edu
Fri Mar 4 05:52:42 EST 2005
Hi:
I had trouble compiling Bcp and Cbc with a version of COIN that has
Lapack, Blas and g2c installed. I had to modify the makefiles to make it
work. I wonder if something is wrong with my installation or my understanding
of the makefiles, but something could be done to make this easier.
The problem might be that the lapack library I have is named lapack_LINUX.a
and not liblapack_LINUX.a. But since I am using the default names used by the
Lapack makefiles, either put a warning in the COIN makefile that these names
should be changed or modify the makefiles so that it can handle names not
starting with "lib". I am far from an expert in makefiles, so I might have
overlooked something obvious.
Here is what happened when trying to compile cbc:
The libraries I have are
$(ENV_LAPACK_LIB)/lapack_LINUX.a
$(ENV_LAPACK_LIB)/blas_LINUX.a
$(ENV_G2C_LIB)/libg2c.a
where the $(ENV_****_LIB) are the full path to the directories containing
the libraries.
I modified COIN/Makefiles/Makefile.location as follows:
CoinLibsDefined += COIN_lapack
and further below
ifneq ($(filter COIN_lapack,$(CoinLibsDefined)),)
export lapackIncDir :=
export lapackLibDir :=
export lapackLibName := $(ENV_LAPACK_LIB)/lapack_LINUX.a \
$(ENV_LAPACK_LIB)/blas_LINUX.a \
$(ENV_G2C_LIB)/libg2c.a
export lapackDefine := COIN_USE_DENSE
endif
Since lapackLibDir will only be used to pass a -L flag to gcc, it is useless
to put the path to the libraries there, since -L is used only for -l
libraries.
Trying to do "make unitTest" in COIN/Cbc fails, as the script removes
the ".a" from $(ENV_LAPACK_LIB)/lapack_LINUX.a, $(ENV_BLAS_LIB)/blas_LINUX.a
and $(ENV_G2C_LIB)/libg2c.a.
I could fix that by adding around line 106 in Makefile.Test
LDFLAGS := $(patsubst %lapack_LINUX,%lapack_LINUX.a,$(LDFLAGS))
LDFLAGS := $(patsubst %blas_LINUX,%blas_LINUX.a,$(LDFLAGS))
LDFLAGS := $(patsubst %libg2c,%libg2c.a,$(LDFLAGS))
For Bcp, it apparently completely ignores the presence of Lapack. I had to add
$(ENV_LAPACK_LIB)/lapack_LINUX.a $(ENV_BLAS_LIB)/blas_LINUX.a \
$(ENV_G2C_LIB)/libg2c.a
in the compilation line for bcps in COIN/Bcp/Makefile, around line 340.
Francois
More information about the Coin-discuss
mailing list