pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkgsrc vs built-in openssl when using pkg-config to build 3rd party software



Hello,

I ran into a small issue where 'pkg-config --libs-only-L libssl' was
used to set linking/runtime options for a source-package linking
against libssl, resulting in a binary unable to find libssl.so.

(The package in question was Fossil; I am aware fossil is in pkgsrc,
but I want to use the version from upstream instead.)

Resulting binary can find its .so fine in case openssl from pkgsrc is
not installed, i.e. the .so is in /usr/lib instead of /usr/pkg/lib

After building the binary:

  michai@main:/tmp/ftest/f$ ./fossil
  Shared object "libssl.so.1.0.0" not found
  michai@main:/tmp/ftest/f$ ldd fossil
  fossil:
         -lssl.1.0.0 => not found
         -lcrypto.1.0.0 => not found
         -lz.1 => /usr/lib/libz.so.1
         -lgcc_s.1 => /usr/lib/libgcc_s.so.1
         -lc.12 => /usr/lib/libc.so.12
  michai@main:/tmp/ftest/f$ ls -l /usr/pkg/lib/libssl.*
  -rw-r--r--  1 root  wheel  524452 Apr 10 18:00 /usr/pkg/lib/libssl.a
  lrwxr-xr-x  1 root  wheel      15 Apr 10 18:00
/usr/pkg/lib/libssl.so -> libssl.so.1.0.0
  -r-xr-xr-x  1 root  wheel  403437 Apr 10 18:00 /usr/pkg/lib/libssl.so.1.0.0
  michai@main:/tmp/ftest/f$ LD_LIBRARY_PATH=/usr/pkg/lib ./fossil
  Usage: ./fossil COMMAND ...
  ...

The LDFLAGS for the link are result of 'pkg-config --libs-only-L':

  michai@main:/tmp/ftest/f$ pkg-config --libs-only-L libssl
  -L/usr/pkg/lib

My question: what is the prefered way to make sure a binary finds its
.so libs? Manpage for 'pkg-config' hints at '--libs-only-L' providing
-R/-rpath options, which it does not in the case of libssl. Should I
use LD_LIBRARY_PATH, ld.so.conf, hack the libssl.pc pkg-config file,
or..?

Thanks in advance,
Michai Ramakers


Home | Main Index | Thread Index | Old Index