I'm trying to profile my c++ code on macOS using gperftools and pprof. I have installed gperftools and I am able to successfully run g++ test.cpp -o test -lprofiler
and CPUPROFILE=~/prof.out ./test
. But when I try to run pprof -text test ~/prof.out
, I'm getting the following error:
Using local file test.
Using local file /Users/<username>/prof.out.
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
.
.
and a lot other .dylib
files as well.
I've tried reinstalling Xcode command line tools, but still doesn't work. Can't seem to find any related issue. Any help would be appreciated.
I'm trying to profile my c++ code on macOS using gperftools and pprof. I have installed gperftools and I am able to successfully run g++ test.cpp -o test -lprofiler
and CPUPROFILE=~/prof.out ./test
. But when I try to run pprof -text test ~/prof.out
, I'm getting the following error:
Using local file test.
Using local file /Users/<username>/prof.out.
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libcharset.1.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: /usr/lib/libiconv.2.dylib (No such file or directory)
.
.
and a lot other .dylib
files as well.
I've tried reinstalling Xcode command line tools, but still doesn't work. Can't seem to find any related issue. Any help would be appreciated.
Share Improve this question edited Mar 16 at 1:00 Harith Laxman asked Mar 16 at 0:44 Harith LaxmanHarith Laxman 791 silver badge4 bronze badges 1- Please use a code block for posting text outputs of tools. – 3CxEZiVlQ Commented Mar 16 at 0:52
1 Answer
Reset to default 1So, first, use pprof tool from github/google/pprof. It is much better.
Second, those "missing" dylibs are actually missing. Kinda. OSX now has some sort of linker cache or something and a number of system libraries are there. So pprof won't be able to symbolize addresses inside those. But in many cases it is harmless. New pprof will still plot something like [libiconv.2.dylib] in place of actual functions if you have them in profile.