I've been having a harrowing time lately just trying to get several C programs compiled because I can't find where the libraries are located and pkg-config seems to be out of order.
I installed GNU GSL like this:
wget ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz
tar xvzf gsl-*gz
cd gsl-1.15
./configure
make
sudo make install
Apparently it installed in
/usr/local/lib
which is a non-standard place? (1) What is a standard place? (2) How would I get it to install there?
And I can't manage to compile a simple program that uses this library:
$ gcc gsl_erf.c -o gsl -I/usr/local/lib -L/usr/local/lib
/tmp/cc3WD9Zq.o: In function `main':
gsl_erf.c:(.text+0x24): undefined reference to `gsl_cdf_gaussian_P'
collect2: error: ld returned 1 exit status
Now, with pkg-config :
pkg-config --libs --cflags gslPackage gsl was not found in the pkg-config search path.
Perhaps you should add the directory containing `gsl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gsl' found
So I did add the directory:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
But no luck yet! :( pkg-config still gives me the same message as above. (Perhaps you sh ...
)
This is a more general problem I face regularly when I have to compile some C program. I would love a general solution for:
1. Where and how do I install my C libs? (Perhaps the same place yum installs them?)
2. How do I correct/configure and use pkg-config
----
**Update** : I tried one of the answer's suggestions below and running the compiled program gives me this : ./gsl_app: error while loading shared libraries: libgsl.so.0: cannot open shared object
Asked by gideon
(353 rep)
Jan 25, 2014, 07:55 AM
Last activity: Feb 19, 2018, 03:35 PM
Last activity: Feb 19, 2018, 03:35 PM