Start New Discussion within our Software Development Community

I've run into linking problems before, so I thought I had them figured out. This one I'm using every tool I have, but I can't seem to identify what the issue is.

Did a build from the yaml site yesterday, I keep getting this linking error at runtime. I set LD_LIBRARY_PATH, but as you can see the shared object that is missing with ldd is in the path. Am I missing something here?

$ g++ -fPIC -Wall -lyaml-cpp main.c -L$YAMLCPP/yaml-cpp/build-I$YAMLCPP/yaml-cpp/include
$ a.out
a.out: error while loading shared libraries: cannot open shared object file: No such file or directory
$ ldd a.out => [B]not found[/B] => /usr/lib64/ (0x00000034ce400000) => /lib64/tls/ (0x00000034cbe00000) => /lib64/ (0x00000034ce200000) => /lib64/tls/ (0x00000034cbb00000)
        /lib64/ (0x00000034cb700000)
CMakeCache.txt       CTestTestfile.cmake  yaml-cpp.pc
CMakeFiles        Makefile              yaml-reader
cmake_install.cmake  [B][/B]   util

the actual code would be helpful not just the errors.

Why? "cannot open shared object file: No such file or directory
" has nothing to do with the code.

Yes, I didn't think the code was necessary in a linking problem. However, here it is if someone wants to download and build the latest yaml.

Here is the code in main.c

#include "yaml.h"
#include <iostream>
#include <fstream>

int main()
   std::ifstream fin("test.yaml");
   YAML::Parser parser(fin);
   YAML::Node doc;

   return 0;

Thanks for taking time to respond. Very good thought, I built it myself though. Here's the detailed ls:

ls -lart $LD_LIBRARY_PATH | grep ".so"
-rwxr-xr-x  1 me users 664546 Mar  7 16:48
lrwxrwxrwx  1 me users     20 Mar  7 16:48 ->
lrwxrwxrwx  1 me users     18 Mar  7 16:48 ->

Check the size of the library on disk and whether you have the necessary permissions to use it?

Used $ chmod ugo+rw -R yaml-cpp-0.2.4 still same result. I built the directories in my area to remove any doubt. In that directory I have other .so's loading. Could it be an error with the build? How would I troubleshoot that?

Try setting the path too.

I had our network guy look into it. The problem was that the LD_LIBRARY_PATH was set in tcsh with 'set' as opposed to 'setenv'. This didn't allow the variable value to be propagated to the child process.

This article has been dead for over six months. Start a new discussion instead.