This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc linking
On Thu, Jun 26, 2008 at 3:17 AM, Dima Sorkin <dima.sorkin@gmail.com> wrote:
> 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
That should work for shared libs also (if the LD_LIBRARY_PATH is set properly).
If you have both types installed for a given lib, then you can pass a
flag to gcc (or g++) to choose static or dynamic linking on a
by-library basis. See the gcc manual for details.
And it is all more easily managed if you will use something like GNU
programs "make" or "makepp" as a build tool.
-Tom