0

The test binary gets this error on execution:

"error while loading shared libraries: libxcb-errors.so.0: cannot open shared object file: No such file or directory".

Part of Makefile:

...

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)

...

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.

# ldconfig -v | grep xcb
   329  /usr/local/lib:
   330   libxcb-errors.so.0 -> 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 -> libxcb-errors.so.0.0.0

# stat /usr/local/lib/libxcb-errors.so.0.0.0
## the file exists

I am not proficient in all this linking magic, but as of my knowledge the link step should went OK. How to link properly?

user14063792468
  • 839
  • 12
  • 28
  • To diagnose this, run `LD_DEBUG=files,libs /path/to/your/test` and update your question with the output. – Employed Russian Dec 19 '20 at 19:37
  • @EmployedRussian Thanks for comment. The issue was in the install script of the library. The script did not run `ldconfig` or something, I don't know what should be run in the situation, and the problem got me for about 1 hour. The output from the `LD_DEBUG` is an interesting part of finding the issue, but as of now I donno what I am expect to see - some other install, or me, indirectly, did run `ldconfig`. – user14063792468 Dec 20 '20 at 05:00
  • @EmployedRussian The annoying fact is that SO has this: https://stackoverflow.com/q/480764/8339821. And I did search with other wording and did not find anything similar. – user14063792468 Dec 20 '20 at 05:02

0 Answers0