Home > Archive > Fortran > September 2006 > I'm going crazy with the libraries!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
I'm going crazy with the libraries!
|
|
| Lorents 2006-09-25, 7:00 pm |
| Please, could someone explain me (or point out a
reference/book/oracle/whatever_is_needed) that explains how those nice
libraries (blas, lapack) work? I mean, what's inside those .a files? How
do I know what's inside one of these files? And most importantly, how do
I make my intel compiler understand where to take them?
I've been told that they should have names like "liblapack.a" and the
compiler command is -L/lapack
Doesn't work for me, though. I can write whatever I want after -L (even
a non-existing directory) but nothing changes, I always get the same
string of errors!
Lorenz
| |
| petros.dafniotis@gmail.com 2006-09-25, 7:00 pm |
| ..a files are collections of objec files (.o).
Typically the linker needs to know:
1. the name of the library; this is done with the -l option
2. the location of the library; this is done with the -L option
Unfortunately 1 is even more complicated as the "lib" prefix in
"liblapack.a" should not be specified in general. DO not know about the
Intel compilers.
So... for your case try:
ifc test.o -L /home/myself/lapack -llapack
to link test.o with the liblapack.a that resides in
/home/myself/lapack.
Hope this helped a bit.
Petros
Lorents wrote:
> Please, could someone explain me (or point out a
> reference/book/oracle/whatever_is_needed) that explains how those nice
> libraries (blas, lapack) work? I mean, what's inside those .a files? How
> do I know what's inside one of these files? And most importantly, how do
> I make my intel compiler understand where to take them?
> I've been told that they should have names like "liblapack.a" and the
> compiler command is -L/lapack
> Doesn't work for me, though. I can write whatever I want after -L (even
> a non-existing directory) but nothing changes, I always get the same
> string of errors!
>
> Lorenz
| |
| Steve Lionel 2006-09-25, 7:00 pm |
|
Lorents wrote:
> Please, could someone explain me (or point out a
> reference/book/oracle/whatever_is_needed) that explains how those nice
> libraries (blas, lapack) work? I mean, what's inside those .a files? How
> do I know what's inside one of these files? And most importantly, how do
> I make my intel compiler understand where to take them?
> I've been told that they should have names like "liblapack.a" and the
> compiler command is -L/lapack
..a (archive) files are simply collections of object (.o) files in a
format that is convenient for use by the linker.
-L tells the linker in what directory it should look for libraries -
you specify a directory name. -l (lowercase) tells the linker to pull
in a specific library which, as was already noted, you name with the
initial "lib" removed. You can have multiple -L and -l options on the
command line. You can also specify the full path to a library on the
command that invokes the linker.
For more information specifically regarding Intel Fortran, see provided
on-disk documentation under Building Applications>Creating and Using
Libraries. I will note that the preferred command name for Intel
Fortran is now "ifort" - "ifc" will still work for now but will give
you a warning that it is obsolete.
Some general comments. You need to know if any of the library source
is in Fortran - if so, it is usually the case that the library works
with one specific compiler only, the one it was built with. See the
library documentation for details. The library documentation is also
where you'd find out what is in the library and how to call the
routines. If you simply want to get a list of the names of globals in
the library, use the "nm" command.
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH
User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://developer.intel.com/software/products/support/
| |
| Lorents 2006-09-26, 8:04 am |
| Steve Lionel wrote:
[...]
>
>
> Some general comments. You need to know if any of the library source
> is in Fortran - if so, it is usually the case that the library works
> with one specific compiler only, the one it was built with. See the
> library documentation for details. The library documentation is also
> where you'd find out what is in the library and how to call the
> routines. If you simply want to get a list of the names of globals in
> the library, use the "nm" command.
>
Thank you all for your help. I made a step forward towards the final
result, but I'm not there yet. Your last comment was illuminating Steve,
I didn't know libraries were compiler-dependent! I am using Intel
compiler 7 (ifc) because the version of lapack I've got won't work with
the newer version (ifort). I am trying to compile a main fortran program
with some other routines written in C. I compiled the C routines with cc
and then I'm trying to link all the object files together (without
success so far). The problem is that to make the various object files
see one another I have to put a -nus option. Anyway, when I do so the
compiler can't find the lapack libraries anymore! any suggestions?
Lorenz
| |
| Steve Lionel 2006-09-26, 8:04 am |
| Lorents wrote:
> The problem is that to make the various object files
> see one another I have to put a -nus option. Anyway, when I do so the
> compiler can't find the lapack libraries anymore! any suggestions?
I don't know enough to make a detailed suggestion. I will comment that
if your version of lapack was built with ifc 7, then you must use ifc7
to build the Fortran part of your application. Using a "big hammer"
switch such as -nus, which prevents the customary appending of an
underscore to Fortran global names, is usually not the right solution.
I'd suggest posting to the Intel Fortran for Linux user forum at
http://softwareforums.intel.com/ and describe in more detail what
you're doing and what pieces you have. There you can get advice more
tailored to your needs.
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH
User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://developer.intel.com/software/products/support/
Doctor Fortran blog
http://www.intel.com/software/drfortran
| |
| Lorents 2006-09-27, 8:00 am |
| Steve Lionel wrote:
> Lorents wrote:
>
>
[...]
>
> I'd suggest posting to the Intel Fortran for Linux user forum at
> http://softwareforums.intel.com/ and describe in more detail what
> you're doing and what pieces you have. There you can get advice more
> tailored to your needs.
Thank you for your reply Steve, and excuse me if my tone was somewhat
irritated. I managed to solve my problem removing the -nus and the
underscores in the routine names in the C files. Banal as it is, it took
me sometime to try figure that out.
Thanks,
Lorenzo
|
|
|
|
|