title: error while loading shared libraries: libxcb-errors.so.0: cannot open shared object file: No such file or directory
body: <p>The test binary gets this error on execution:</p>
  <p>&quot;error while loading shared libraries: libxcb-errors.so.0: cannot open shared object file: No such file or directory&quot;.</p>
  <p>Part of <code>Makefile</code>:</p>
  <pre><code>...
  
  TARGET  = mylib.so
  
  LIBS_DYNAMIC    = $(shell pkg-config --libs xcb-errors)
  
  $(TARGET): $(OBJ)
      $(CC) -shared -o $@ $^ $(CFLAGS) $(LIBS_DYNAMIC)
  
  $(TEST): $(TEST-SRC) $(BIN)
      $(CC) $(TEST-SRC) -o $@ $(PREFIX_LIB)/$(TARGET)
  
  ...
  </code></pre>
  <p>The dynamic library is created, then the test file linked to the library. When the test file gets executed the error pops up. I don't know how to overcome it. This is my question.</p>
  <pre><code># ldconfig -v | grep xcb
     329  /usr/local/lib:
     330   libxcb-errors.so.0 -&gt; libxcb-errors.so.0.0.0
  
  # pkg-config --libs xcb-errors
     -L/usr/local/lib -lxcb-errors -lxcb
  
  # stat /usr/local/lib/libxcb-errors.so.0
     /usr/local/lib/libxcb-errors.so.0 -&gt; libxcb-errors.so.0.0.0
  
  # stat /usr/local/lib/libxcb-errors.so.0.0.0
  ## the file exists
  </code></pre>
  <p>I am not proficient in all this linking magic, but as of my knowledge the link step should went OK. How to link properly?</p>