This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc linking
- From: "Dima Sorkin" <dima dot sorkin at gmail dot com>
- To: "mcwalker at purdue dot edu" <mcwalker at purdue dot edu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 26 Jun 2008 11:17:42 +0300
- Subject: Re: gcc linking
- References: <1214336069.48614c45a5b6e@webmail.purdue.edu>
Hi.
I link LAPACK and BLAS in the following way:
With static libs, I use "-L" and "-l" options (read the gcc manual on these).
With dynamic libs, I pass their names as is to the linkage command.
Suppose your (static) libs are
/usr/lib/libclapack.a
/usr/lib/libcblas.a
/usr/lib/libatlas.a <-- optionally, if you have ATLAS installed.
On linking, do:
gcc -o my_exe my_obj1.o my_obj2.o -L/usr/lib -lclapack -lcblas -latlas
Dynamic libs:
/usr/lib/libclapack.so
/usr/lib/libcblas.so
On linking, do:
gcc -o my_exe my_obj1.o my_obj2.o /usr/lib/libclapack.so /usr/lib/libcblas.so
Regards,
Dima.
On 6/24/08, mcwalker@purdue.edu <mcwalker@purdue.edu> wrote:
> Hello,
>
> I am trying to link the CLAPACK/CBLAS libraries with a C program using gcc (on a
> RedHat Linux machine). I know where the library file is located, but don't know
> how to link with it. I did not install the libraries myself, but I've been
> assured that they are compiled. Is there something I need to change in the
> environment variables? I don't know which version of gcc I am using. If I can
> clarify any information needed for this query, please let me know.
>
> Thank you,
> Mike Walker
>