I have libz-dev installed on ubuntu 20.04. I added the following lines in pin/source/tools/SimpleExamples/icount.cpp :
#include <zlib.h>
and in main():
gzFile gp;
gp = gzopen("compressed_log_file", "ab");
gzbuffer(gp, 100000);
My makefile build rule for linking is:
$(OBJDIR)icount$(PINTOOL_SUFFIX): $(OBJDIR)icount$(OBJ_SUFFIX)
$(LINKER) $(TOOL_LDFLAGS_NOOPT) $(LINK_EXE)$@ $< $(TOOL_LPATHS) $(TOOL_LIBS) -lz
which follows the Intel Pin User Guide except for the -lz flag I added.
I can make with no errors, but when I run the pin tool, I get this error:
E: Unable to load /pin/source/tools/SimpleExamples/obj-intel64/icount.so: dlopen failed: library "libz.so.1" not found
My execution command is:
../../../../pin -t icount.so -- ls
- Am I linking correctly?
- Should I be trying to link statically instead of using dlopen?