FlameGraph
FlameGraph copied to clipboard
Can't locate open.pm in @INC
When running flamegraph.pl
on RHEL 8.1, I encounter the following error:
$ perf script | ~/FlameGraph/stackcollapse-perf.pl | ~/FlameGraph/flamegraph.pl > flame.svg
Can't locate open.pm in @INC (you may need to install the open module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ~/FlameGraph/flamegraph.pl line 97.
BEGIN failed--compilation aborted at ~/FlameGraph/flamegraph.pl line 97.
For reference, it appears that this issue is the same. It seems strange to me that opening a file requires a supplementary package, but for reference, it appears that
$ yum install perl-open.noarch
should fix this issue on RHEL.
Had same problem, worked.
I think this was caused by the UTF-8 support, which added this line:
use open qw(:std :utf8);
I deliberately wrote flamegraph to not use dependencies, as it was such a short program that I didn't want to burden end-users. That's why it contains its own embedded SVG library.
Here's what I'd suggest we do here: A) Detect if perl-open is available, and if so, use it otherwise not. So if you want UTF-8 support on RHEL you have to install perl-open.noach, but if you don't have that installed it still works but throws a warning about UTF-8 and the missing package. B) If there's not much functionality of UTF-8 that we need, something that can be made a 20-line function, can we just add it as a function and remove the dependency. Like I did for SVG. C) As a last resort I'd add a "DEPENDENCIES" section to README.md and say RHEL is special and needs perl-open.noarch. Last resort.
I just bumped into this problem. Thanks for documenting the workaround here. While I'm sad that Brendan's suggestions haven't been implemented, I wish I could take the time to fix for any future users. FWIW, if there was a note in the README, I would probably have missed that and found this issue first, so (C) probably wouldn't have helped me. Maybe the existence of this issue is actually a sufficient solution.