0

I have to include google protocol buffer in pintool in order to save trace data but when I compile with this makefile makefile.rules

TOOL_LIBS += -lprotobuf -pthread -lboost_system

$(OBJDIR)Source1$(OBJ_SUFFIX): trace.pb.cc
    $(CXX) $(TOOL_CXXFLAGS) $(COMP_OBJ)$@ $<

$(OBJDIR)Source2$(OBJ_SUFFIX): protoio.cc
    $(CXX) $(TOOL_CXXFLAGS) $(COMP_OBJ)$@ $<

$(OBJDIR)Source3$(OBJ_SUFFIX): tracerProto.cpp
    $(CXX) $(TOOL_CXXFLAGS) $(COMP_OBJ)$@ $<

# Build the tool as a dll (shared object).
$(OBJDIR)tracerProto$(PINTOOL_SUFFIX): $(OBJDIR)Source1$(OBJ_SUFFIX) trace.pb.h $(OBJDIR)Source2$(OBJ_SUFFIX) protoio.hh $(OBJDIR)Source3$(OBJ_SUFFIX)
    $(LINKER) $(TOOL_LDFLAGS_NOOPT) $(LINK_EXE)$@ $(^:%.h=) $(TOOL_LPATHS) $(TOOL_LIBS)

but I got this error when run using this command pin -t obj-intel64/tracerProto2.so -- /bin/ls

E: Unable to load tracerProto2.so: dlopen failed: library "libprotobuf.so.17" not found

but protocol buffer library is installed already.

I have done using protobuf in another project which is built by cmake. It works correctly. How can I solve this problem?

  • 1
    The fact the other project (built with CMake) works correctly is not proof. By default, CMake places the full path to the libraries used for linking into the executable, so it can find it when started. Check your LD_LIBRARY_PATH and "friends"... Where the protobuf is installed? on a standard location or not, – gordan.sikic Jan 10 '23 at 11:09
  • "dlopen failed" is an error emitted by the built `pin` program. It could arise because of a usage error, a build configuration error, a system configuration error, or maybe something else. It may reflect a flaw in the program or its build system, or it may reflect a user / builder mistake. We just don't have anything like the context we would need to diagnose this with any specificity. – John Bollinger Jan 10 '23 at 12:51

0 Answers0