2

I've run into this problem a few times now. I have some program that is looking for a library and can't find it, even though it is in /usr/lib/x86_64-linux-gnu.

Maybe this a flaw in the way the dependent program was written. I don't know much about this, but I would expect the dependent program to specify the name of the library, and let the system search a list of paths.

Can anyone explain briefly how Ubuntu expects a properly behaved program to look for dynamic libraries?

As a concrete example, the latest case involves the libpcsclite.so library. The Oracle documentation suggests that Java (the dependent program) will look in /usr/lib64 and /usr/local/lib64 on my system—neither of which exist. I've had similar problems in the past with non-Java dependents. Part of my question is, why would a program list search locations like this? Is there a search mechanism provided by Linux that should be used instead?

Is this a problem with Java, to be corrected by using its sun.security.smartcardio.library system property, or is pcsclite failing to support the multi-architecture naming conventions correctly? If the latter, should I be creating symlinks manually, or is this something a tool like ldconfig should fix?

erickson
  • 121
  • 4

1 Answers1

0

My guess is that the problem is you are installing packages outside of apt (apt-get). Either use Ubuntu packages (ppa if possible) or if you are compiling packages, as you compile, use ./configure --help and specify a library path as a part of your configuration.

See also:

http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

http://www.linuxquestions.org/questions/linux-general-1/using-a-non-standard-library-path-when-compiling-software-781185/

From the second link:

CFLAGS="-I/path/to/your/headers" LDFLAGS="-L/path/to/your/lib" ./configure --blah

If you need further assistance you will have to be more specific regarding "some program that is looking for a library and can't find it" - What program? How did you install it ? etc.

To set your java environment, edit ~/.pam_environment, add:

export JAVA_HOME=/usr/java/<your version of java>
export PATH=${PATH}:${JAVA_HOME}/bin

For all users (system) edit /etc/environment

See also: https://help.ubuntu.com/community/EnvironmentVariables#Persistent_environment_variables

Panther
  • 100,877
  • 19
  • 193
  • 283
  • Thanks. Actually, in one of these cases, I used `apt` from the command line, and in the example above, I used the Synaptic package manager; all of my pcsc libraries are supported by the distribution and provided by Ubuntu Developers. As for the program, in the latest case, it's Java 1.7.0_05, installed from a tarball from Oracle. – erickson Aug 07 '13 at 19:26
  • I don't see the relevance of [that question](http://stackoverflow.com/questions/9612941/how-to-set-java-environment-path-in-ubuntu) or its answers. It deals with the location of Java; I don't have any problems with that. The problem is Java's inability to find another shared library on my system, `libpcsdlite.so`. – erickson Aug 07 '13 at 20:27
  • If you set your path, and JAVA from SUN can not find system libs, then it would be a bug with JAVA. – Panther Aug 07 '13 at 20:38
  • If it is a problem with an application from the Ubuntu repositories, you should file a bug report with Ubuntu. – Panther Aug 07 '13 at 20:52
  • I am looking for more general background, as described in my question. Bugging Oracle wouldn't get me a useful solution, and I already have a work around. What I want to know, is how is this supposed to work, and when it doesn't what's the right way to handle it? – erickson Aug 08 '13 at 00:20