0

There is library which is compiled against -lyaml. But libyaml.so is not getting listed as dependency by ldd. Build is happening successfully using autoconf tool chain.

$ nm libxxxx.so | grep -i yaml
 U yaml_document_delete
 U yaml_document_get_node
 U yaml_parser_delete
 U yaml_parser_initialize
 U yaml_parser_load
 U yaml_parser_set_input_file


$ readelf -d libxxxx.so
    Tag        Type                         Name/Value
    0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
    0x000000000000000e (SONAME)             Library soname: [libxxxx.so.0] 

There is another shared library which depends depend upon libxxxx.so.

$ ldd  lib/libxxxx1.so
    libzmq.so.5 => /usr/lib/x86_64-linux-gnu/libzmq.so.5 (0x00007fd45e072000)
    libxmaapi.so.0 => 

When I am linking my executable with libxxxx1.so, it is giving undefined symbols error. The question is how do I link against library not found in dependency tree?

This question provides approaches to ignore the problem. Linking with dynamic library with dependencies

YSC
  • 38,212
  • 9
  • 96
  • 149
Pankaj
  • 37
  • 6

1 Answers1

1

The one approach which I found is disabling optimization using the gcc flag -Wl,--no-as-needed. Since I am already linking using -lyaml, symbols are getting resolved. It works but not efficient.

Pankaj
  • 37
  • 6