[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 2445fd8: LD_LIBRARY_PATH described in book's s
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 2445fd8: LD_LIBRARY_PATH described in book's section on Linking |
Date: |
Mon, 12 Feb 2018 07:28:33 -0500 (EST) |
branch: master
commit 2445fd8cf044969528f50072dfe1d8dd9299afab
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
LD_LIBRARY_PATH described in book's section on Linking
The linking section of the book only discussed the compilation of a program
and the relevant linking issues. But one major issue bother new-commers is
the linking and run-time and `LD_LIBRARY_PATH'. So a paragraph was added to
describe this important environment variable and run-time linking.
---
doc/gnuastro.texi | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 499816c..a9b19fa 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -18515,8 +18515,8 @@ library, you might need another tool.} program, for
example:
$ ldd /usr/local/bin/astarithmetic
@end example
-Library file names start with a @file{lib} and end with suffix depending on
-their type as described below. In between these two is the name of the
+Library file names start with a @file{lib} and end with a suffix depending
+on their type as described below. In between these two is the name of the
library, for example @file{libgnuastro.a} (Gnuastro's static library) and
@file{libgsl.so.0.0.0} (GSL's shared library).
@@ -18552,16 +18552,17 @@ the @file{prefix/lib/} directory (see
@ref{Installation directory}). In
this way other programs can make which ever kind of link that they want.
To link with a library, the linker needs to know where to find the
-library. You do that with two separate options to the linker (see
address@hidden and example on libraries} for an example):
+library. @emph{At compilation time}, these locations can be passed to the
+linker with two separate options (see @ref{Summary and example on
+libraries} for an example) as described below.
@table @option
@item -L DIR
Will tell the linker to look into @file{DIR} for the libraries. For example
@file{-L/usr/local/lib}, or @file{-L/home/yourname/.local/lib}. You can
make multiple calls to this option, so the linker looks into several
-directories. Note that the space between @key{L} and the directory is
-optional and commonly not used.
+directories at compilation time. Note that the space between @key{L} and
+the directory is optional and commonly not used.
@item -lLIBRARY
Specify the unique name of a library to be linked. As discussed above,
@@ -18591,6 +18592,14 @@ the linker will complain and abort.
@end table
+If you have compiled and linked your program with a dynamic library, then
+the linker needs to know the location of the libraries @emph{every time}
+the final program is run. For this purpose, the linker looks into the
address@hidden environment variable. Therefore, if you don't get
+any errors when compiling/linking, but are unable to run your program
+because of a failure to find a library, it is because the linker hasn't
+found the dynamic library @emph{at run time}. See @ref{Installation
+directory} on how to add any directory to @code{LD_LIBRARY_PATH}.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master 2445fd8: LD_LIBRARY_PATH described in book's section on Linking,
Mohammad Akhlaghi <=