From: Aaron Sloman
Subject: how do I access f77 libraries on linux (for lapack and blas)?
Date: 
Message-ID: <cped3c$r47$1@soapbox.cs.bham.ac.uk>
[Plea for help posted to

    comp.lang.pop
    comp.lang.lisp
    comp.lang.fortran
]

I wonder if anyone who is familiar with Fortran/Lapack/Linux can help
me.

A part of the Poplog system[1] is the 'popvision' library[2] produced by
David Young at Sussex University, which provides a lot of program
libraries, documentation and teaching materials for computer vision.

It also includes a number of additional libraries. Many of the program
libraries are written in C for speed, then made available for dynamic
linking in Pop11[3], which provides interactive access to the C
procedures, analogous to Matlab and AI language systems, giving a
mixture of run time speed and convenient incremental development and
testing.

Recently a Pop11 interface to the Lapack and Blas (mathematics, linear
algebra) libraries was added to Popvision:

	http://www.netlib.org/lapack/
	http://www.netlib.org/blas/

These libraries were developed using Solaris on Suns, at Sussex
University, but they are designed for use on any system on which Poplog
runs and I have tested the tutorial examples on a version of Poplog
running on a PC with Linux (Redhat 8 and Redhat 9), which included the
Lapack and Blas libraries (distributed as rpm files in the linux
distribution.)

All the examples worked except one using a procedure returning
eigenvalues and eigenvectors.

The dynamic linker complained about 'undefined symbol' s_wsfe
and poplog aborted.

When I reported this to David he responded:

> Just had a quick look - on the Solaris system this symbol is defined in
> libF77.so. It may mean that you need to download a Fortran run-time
> library

I suspect that the relevant F77 library is available for Linux and may
even be installed on one of the machines in our department, I but have
not been able to locate it.

Is there a Fortran user, especially one who has used lapack on linux,
who can tell me which library I need and where it is likely to be
located on a linux system?

We already have these:

    /usr/lib/liblapack.so
    /usr/lib/libblas.so

I need to know the location and the library name for the relevant
Fortran library/libraries on linux, so that they can be specified in
Pop11, for use by the dynamic linker.

Thanks.

Aaron
===
http://www.cs.bham.ac.uk/~axs/
········@cs.bham.ac.uk
------------------------------
[1] Information about Poplog (a free, open source, multi language
system for research and teaching in AI, etc.) is available here:

    http://www.cs.bham.ac.uk/research/poplog/freepoplog.html
    http://www.cs.bham.ac.uk/research/poplog/poplog.info.html
    http://www.cs.bham.ac.uk/research/poplog/comp.lang.pop.faq.html

[2] An overview of the Popvision library is available here
    http://www.cs.bham.ac.uk/research/poplog/help/popvision.txt

[3] Pop11 is a multi-paradigm, extendable, Lisp-like language with a
more conventional syntax. More information about it is available here

    http://www.cs.bham.ac.uk/research/poplog/primer/START.html

and in the documentation provided with poplog.
===
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/  (also talks in /talks )
FREE BOOK: http://www.cs.bham.ac.uk/research/cogaff/crp/
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/packages/simagent.html

From: Tim Prince
Subject: Re: how do I access f77 libraries on linux (for lapack and blas)?
Date: 
Message-ID: <76Dud.31912$zx1.16932@newssvr13.news.prodigy.com>
"Aaron Sloman" <········@cs.bham.ac.uk> wrote in message
·················@soapbox.cs.bham.ac.uk...
> [Plea for help posted to
>
>     comp.lang.pop
>     comp.lang.lisp
>     comp.lang.fortran
> The dynamic linker complained about 'undefined symbol' s_wsfe
> and poplog aborted.
>
> When I reported this to David he responded:
>
> > Just had a quick look - on the Solaris system this symbol is defined in
> > libF77.so. It may mean that you need to download a Fortran run-time
> > library
>
> I suspect that the relevant F77 library is available for Linux and may
> even be installed on one of the machines in our department, I but have
> not been able to locate it.
Presumably, you are using blas and lapack libraries compiled for g77, or
possibly f2c.  If the former, the libg2c libraries are required, but ought
to be installed automatically with a reasonable version of g77.  If you
haven't set LD_LIBRARY_PATH, linux tends to look for .so libraries only in
/usr/lib/ .
From: Aaron Sloman
Subject: Re: how do I access f77 libraries on linux (for lapack and blas)?
Date: 
Message-ID: <cpf7ad$rul$1@soapbox.cs.bham.ac.uk>
"Tim Prince" <·······@nospamcomputer.org> writes:

> Date: Sat, 11 Dec 2004 14:02:43 GMT
> Organization: SBC http://yahoo.sbc.com
>
> "Aaron Sloman" <········@cs.bham.ac.uk> wrote in message
> .....
> > The dynamic linker complained about 'undefined symbol' s_wsfe
> > and poplog aborted.
> >
> > When I reported this to David he responded:
> >
> > > Just had a quick look - on the Solaris system this symbol is defined in
> > > libF77.so. It may mean that you need to download a Fortran run-time
> > > library
> >
> > I suspect that the relevant F77 library is available for Linux and may
> > even be installed on one of the machines in our department, I but have
> > not been able to locate it.

> Presumably, you are using blas and lapack libraries compiled for g77, or
> possibly f2c.  If the former, the libg2c libraries are required, but ought
> to be installed automatically with a reasonable version of g77.  If you
> haven't set LD_LIBRARY_PATH, linux tends to look for .so libraries only in
> /usr/lib/ .

I forgot to say that I had previously discovered that one way to
make F77 libraries available is to libg2c, and I had found that on
our system it was available as
    /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/libg2c.so

which is actually a symbolic link to
    /usr/lib/libg2c.so.0

But even with that I got 'undefined symbol' s_wsfe

    strings /usr/lib/libg2c.so.0 |grep wsfe

produces
    e_wsfe
    s_wsfe

But I still get the undefined symbol error, which makes me think
that something in libg2c.so uses s_wsfe, but assumes that it is
defined somewhere else.

I have now noticed that there is a file

    /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/f771

moreover

    strings    /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/f771 | grep wsfe

produces
    s_wsfe
    e_wsfe

So that suggests that the library I am looking for is that f771
file.

However, it has no 'lib' prefix or '.so' suffix, which suggests that I
can't use it as a dynamically linked library. (I am very ignorant about
programming in C Fortran and similar languages).

If it is a static library only then I fear that what I am trying to do
may  be impossible.

I have just checked on a Sun and found that the library contains
    libF77.so

So maybe for some reason there's a suitable dynamic library on Solaris,
but not on linux.

If so, using this part of lapack may require a version of poplog that
has been statically linked with lapack and f771

Maybe someone understands my question better than I do and can suggest
a way to access that f771 file.

Thanks.
Aaron
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/  (also talks in /talks )
FREE BOOK: http://www.cs.bham.ac.uk/research/cogaff/crp/
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/packages/simagent.html
From: Tim Prince
Subject: Re: how do I access f77 libraries on linux (for lapack and blas)?
Date: 
Message-ID: <a_Fud.57584$QJ3.8060@newssvr21.news.prodigy.com>
"Aaron Sloman" <···@cs.bham.ac.uk> wrote in message
·················@soapbox.cs.bham.ac.uk...
>
>
> I have now noticed that there is a file
>
>     /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/f771
>
> moreover
>
>     strings    /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/f771 | grep wsfe
>
> produces
>     s_wsfe
>     e_wsfe
>
> ...
>
> Maybe someone understands my question better than I do and can suggest
> a way to access that f771 file.
The way f771 is accessed is by running g77.  If you run
'g77 -print-search-dirs' you should see the library search path used by g77,
which should include the corresponding libg2c.so.
'ldd f771' likewise should show which .so are used by it.
From: Jan Vorbrüggen
Subject: Re: how do I access f77 libraries on linux (for lapack and blas)?
Date: 
Message-ID: <325e9aF3gtpvkU1@individual.net>
> I suspect that the relevant F77 library is available for Linux and may
> even be installed on one of the machines in our department, I but have
> not been able to locate it.

AFAIK, that library comes with the Sun Fortran compiler, and the names of
the routines it contains are non-portable. You need to look at what the call
to that routine in the POP11 code actually does. Also, I believe f771 is the
first pass of g77.

	Jan
From: Aaron Sloman
Subject: Re: how do I access f77 libraries on linux (for lapack and blas)? [SOLVED]
Date: 
Message-ID: <cqeerm$20ga$1@soapbox.cs.bham.ac.uk>
This problem is now solved using the latest lapack and blas rpms.

On Sat, 11 Dec 2004 09:02:36 +0000 (UTC)
I sent a plea for help to

    comp.lang.pop
    comp.lang.lisp
    comp.lang.fortran
>...
> Recently a Pop11 interface to the Lapack and Blas (mathematics, linear
> algebra) libraries was added to Popvision:
>
> 	http://www.netlib.org/lapack/
> 	http://www.netlib.org/blas/
>
> ....

The libraries were developed on Solaris on Suns in poplog and worked
fine there, but on linux ,,,

> All the examples worked except one using a procedure returning
> eigenvalues and eigenvectors.
>
> The dynamic linker complained about 'undefined symbol' s_wsfe
> and poplog aborted.

I have now solved the problem as follows, and tested it on two linux
machines, one running redhat 9 on an athlon-based PC and one running
redhat 9 with a 2.4.26  kernel (to support software suspend) on a
dell D600 laptop, as follows.

On the athlon I installed all of these, in this order

     libg2c-3.4.3-2.athlon.rpm

     blas-3.0-29.athlon.rpm
     blas-devel-3.0-29.athlon.rpm

     lapack-3.0-29.athlon.rpm
     lapack-devel-3.0-29.athlon.rpm

On the dell I installed these in this order
     libg2c-3.4.3-2.i686.rpm

     blas-3.0-29.i686.rpm
     blas-devel-3.0-29.i686.rpm

     lapack-3.0-29.i686.rpm
     lapack-devel-3.0-29.i686.rpm

Those rpm files were obtained from the PLD distribution libraries
    http://ftp.pld.org.pl/dists/ac/ready/
(for which many thanks to the PLD team).

There were also some minor changes required in the Pop11 code which
are now available in a temporary package at

    http://www.cs.bham.ac.uk/research/poplog/popvision.tar.gz

Aaron
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/  (also talks in /talks )
FREE BOOK: http://www.cs.bham.ac.uk/research/cogaff/crp/
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/packages/simagent.html
From: Aaron Sloman
Subject: Re: how do I access f77 libraries on linux (for lapack and blas)? [REALLY SOLVED]
Date: 
Message-ID: <cqieon$24s1$1@soapbox.cs.bham.ac.uk>
My previous announcement of a fix was premature. The problem is now
really solved.

Some time ago I mentioned difficulty using the latest additions to David
Young's 'popvision' extension to Pop11.

He had introduced Pop11 libraries that invoked the powerful BLAS and
LAPACK fortran libraries. This allowed a wide range of mathematical
procedures to be conveniently accessed interactively in pop11, in a
similar way to Matlab, though with the extra generality of the pop11
language (which is similar in power to Lisp.)

However, some of the LAPACK procedures failed to access BLAS procedures,
causing 'undefined symbol' errors.

Various people make suggestions, and then I thought the problem had been
solved by getting new libraries. I wrote, prematurely, on Thu, 23 Dec
2004:

> This problem is now solved using the latest lapack and blas rpms.

The problem disappeared after installing new versions of blas, and
lapack along with blas-devel, lapack-devel, and libg2c libraries.

Somehow that enabled me to use David's packages.

However, thanks to further investigations and help from David Young and
Jeff Best I found that there was a bug in the linux version of Poplog's
mechanisms for linking in dynamic libraries: a bit was not set in one
of the control flags which would have made symbols 'global'. This bit
was set properly in Solaris poplog which is why the Lapack extensions
had worked on Suns.

After linux poplog was rebuilt with the dynamic linking bug fixed, it
turned out that the new blas and lapack libraries were not required
after all, since the lapack extension to pop11 worked on machines
running Redhat 8 and 9 that had not had the latest blas and lapack
libraries installed.

I.e. installing the new libraries (including the -devel versions)
was merely a 'workaround' rather than a fix to the basic cause of the
problem.

The latest version of linux poplog, incorporating this dynamic linking
fix can now be fetched from

    http://www.cs.bham.ac.uk/research/poplog/freepoplog.html

    http://www.cs.bham.ac.uk/research/poplog/bham-linux-poplog.tar.gz

The 'News' section of the former file mentiones other recent
developments, including reduction in size of the bham-linux-poplog tar
file from about 21 Mbytes to about 19Mbytes, and provision of a script
for checking a PC linux system to see if meets the main requirements
for installing Poplog. (If run as root it can install missing symbolic
links in /usr/X11R6/lib/ )

Apologies for the red-herrings and premature announcement!

Thanks to all who offered suggestions regarding the dynamic linking
problem and seasonal greetings.

Aaron
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/  (also talks in /talks )
FREE BOOK: http://www.cs.bham.ac.uk/research/cogaff/crp/
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/packages/simagent.html