[Coin-discuss] Lapack, blas, g2c and makefiles
Matthew Saltzman
mjs at ces.clemson.edu
Fri Mar 4 11:14:55 EST 2005
On Fri, 4 Mar 2005, Francois Margot wrote:
>
> 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.
The problem here is that the -l option to gcc automatically prepends "lib"
and appends ".a" or ".so*" to the string supplied in order to specify the
filename. It looks like the right action if your lib name doesn't conform
to this convention is to just include the lib as one of the input files to
the link stage. The -l option searches the paths specified by the
compiler defaults and the -L option, so not using it means you will have
to specify the full (relative or absolute) path to the lapack file.
I have the lapack RPM for Fedora Core 3 installed, and those libraries
conform to the libxxx.a convention. That may be a consequence of the way
the RPMs are built. It wouldn't surprise me to discover that the makefile
developers have it installed similarly using RPMs or DEBs.
>
> 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
>
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
>
--
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs
More information about the Coin-discuss
mailing list