public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Gfortran: trouble creating statically link executable
@ 2014-02-02  1:33 ken72cc
  2014-02-02  7:30 ` Marc Glisse
  0 siblings, 1 reply; 3+ messages in thread
From: ken72cc @ 2014-02-02  1:33 UTC (permalink / raw)
  To: gcc-help

I'm trying to create a standalone executable that will run on a system w/o
fortran installed.  Spent the entire morning and cannot figure out how to do
it.  If I try the following, I get an error message that the lapack library
can't be found even though the static libraries exist in the specified
directory.  Does -Wl-R somehow not work for static libraries?  It know it
works for shared libraries.

    [guest@T61 DGELS_Lib]$ gfortran -o dgels3 TestDGELS_2.f -static
-Wl,-R/usr/lib64/atlas-sse3 -llapack -lf77blas
    /usr/bin/ld: cannot find -llapack
    collect2: ld returned 1 exit status

    [guest@T61 DGELS_Lib]$ ls -l /usr/lib64/atlas-sse3/liblapack.a
/usr/lib64/atlas-sse3/libf77blas.a
    -rw-r--r--. 1 root root  562242 Mar 20  2012
/usr/lib64/atlas-sse3/libf77blas.a
    -rw-r--r--. 1 root root 9639442 Mar 20  2012
/usr/lib64/atlas-sse3/liblapack.a

What am I doing wrong?

Ken



--
View this message in context: http://gcc.1065356.n5.nabble.com/Gfortran-trouble-creating-statically-link-executable-tp1007813.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Gfortran: trouble creating statically link executable
  2014-02-02  1:33 Gfortran: trouble creating statically link executable ken72cc
@ 2014-02-02  7:30 ` Marc Glisse
  2014-02-02 18:10   ` ken72cc
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Glisse @ 2014-02-02  7:30 UTC (permalink / raw)
  To: ken72cc; +Cc: gcc-help

On Sat, 1 Feb 2014, ken72cc wrote:

> I'm trying to create a standalone executable that will run on a system w/o
> fortran installed.  Spent the entire morning and cannot figure out how to do
> it.  If I try the following, I get an error message that the lapack library
> can't be found even though the static libraries exist in the specified
> directory.  Does -Wl-R somehow not work for static libraries?  It know it
> works for shared libraries.

You should read: man ld
-R (aka -rpath) is to find shared libraries at runtime. To find libraries 
(any kind) at compile-time, you want -L. Your distribution should provide 
either a symlink in a standard location or a common way (pkg-config, 
cmake, whatever) to discover this hidden location automatically.

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Gfortran: trouble creating statically link executable
  2014-02-02  7:30 ` Marc Glisse
@ 2014-02-02 18:10   ` ken72cc
  0 siblings, 0 replies; 3+ messages in thread
From: ken72cc @ 2014-02-02 18:10 UTC (permalink / raw)
  To: gcc-help

Marc, thanks that helped a lot.  I'm pretty much a beginner and have yet to
fully understand the basics.  My program now works.

Ken



--
View this message in context: http://gcc.1065356.n5.nabble.com/gfortran-trouble-creating-statically-linked-executable-tp1007813p1007872.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-02 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-02  1:33 Gfortran: trouble creating statically link executable ken72cc
2014-02-02  7:30 ` Marc Glisse
2014-02-02 18:10   ` ken72cc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).