1.11M Members

Newbie Linking Issue

 
0
 

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: libyaml-cpp.so.0.2: cannot open shared object file: No such file or directory
$ ldd a.out
        libyaml-cpp.so.0.2 => [B]not found[/B]
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000034ce400000)
        libm.so.6 => /lib64/tls/libm.so.6 (0x00000034cbe00000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000034ce200000)
        libc.so.6 => /lib64/tls/libc.so.6 (0x00000034cbb00000)
        /lib64/ld-linux-x86-64.so.2 (0x00000034cb700000)
$ ls $LD_LIBRARY_PATH
CMakeCache.txt       CTestTestfile.cmake  libyaml-cpp.so.0.2.4  yaml-cpp.pc
CMakeFiles           libyaml-cpp.so       Makefile              yaml-reader
cmake_install.cmake  [B]libyaml-cpp.so.0.2[/B]   util
 
0
 

the actual code would be helpful not just the errors.

 
0
 

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.

 
0
 

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

 
0
 

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;
}
 
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 libyaml-cpp.so.0.2.4
lrwxrwxrwx  1 me users     20 Mar  7 16:48 libyaml-cpp.so.0.2 -> libyaml-cpp.so.0.2.4
lrwxrwxrwx  1 me users     18 Mar  7 16:48 libyaml-cpp.so -> libyaml-cpp.so.0.2

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

 
0
 

Try setting the path too.

 
0
 

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.

 
0
 

Have you set the path variable?

You can debug build by setting the verbosity.

Check your compiler documentation.

 
0
 

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.

 
0
 

I had the same problem and solved it by running sudo ldconifg

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article