koknat / callGraph

A multi-language tool which parses source code for function definitions and calls
GNU General Public License v3.0
245 stars 28 forks source link

I cannot run call graph on my mac #9

Open JohnCheeKinChow opened 2 years ago

JohnCheeKinChow commented 2 years ago

Hi,

I am a rookie in this, but I want to get this tool works. I saw the issue of luke: https://github.com/koknat/callGraph/issues/1. I tried following his advice but that don't work.

  1. brew install graphviz. I get this error:

    Warning: No available formula with the name "graphviz". ==> Searching for similarly named formulae... Error: No similarly named formulae found. It was migrated from homebrew/cask to homebrew/core.

  2. sudo cpan install GraphViz. I get this message:

    Configuring R/RS/RSAVAGE/GraphViz-2.24.tgz with Makefile.PL Can't exec "dot": No such file or directory at Makefile.PL line 21. Please install Graphviz from http://www.graphviz.org/. No 'Makefile' created RSAVAGE/GraphViz-2.24.tgz /usr/bin/perl Makefile.PL -- NOT OK

  3. I downloaded the github from callGraph, perl_call_graph, graphviz-perl, and IPC-Run but don't know what to do with them.

Is someone that can help me?

Thanks a lot!

JohnCheeKinChow commented 2 years ago

After some trying. I got some done. But still not working.

callGraph/perl_call_graph/bin/perl_call_graph ; exit; Please specify some files to parse! => That is good

and running callgraph is succesfully. but still the last step when I type callGraph . It does not work and I get:

command not found: callGraph

koknat commented 2 years ago

I'm guessing here since I don't have a Mac: cd to the directory with callGraph executable ./callGraph

mujtabaat commented 2 years ago

@JohnCheeKinChow if you are able to run the callGRAPH guide me through this i'm unable to figured out this followed the issue 1 @koknat if possible kindly make a video or detailed READme that would be a great aid to new rookies

koknat commented 2 years ago

Hi @mujtabaat Sorry, but I don't have a mac myself, so I can't advise you on how to install the 'graphviz' dependency. What happens when you run ./callGraph ?

mujtabaat commented 2 years ago

now i'm able to run your callGraph test file for dart and swift etc, but upon running my code of dart used for flutter mobile application i got this

Screenshot 2022-08-30 at 12 20 18 PM

any possible reason

JohnCheeKinChow commented 2 years ago

Have you installed graphviz succesfully? My files are javascript and it worked

mujtabaat commented 2 years ago

Yeah i did callGraph is running, don't know why it didn't find the function calls[found 3 function definition] in the code of flutter application.

koknat commented 2 years ago

Could you share the lines containing the 3 function definitions (just the line with function name), and the lines containing the calls to those functions?

On Tue, Aug 30, 2022 at 2:41 AM mujtabaat @.***> wrote:

Yeah i did callGraph is running, don't know why it didn't find the function calls[found 3 function definition] in the code of flutter application.

— Reply to this email directly, view it on GitHub https://github.com/koknat/callGraph/issues/9#issuecomment-1231424449, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK7KKTT2M72KSJT7JRTJLDV3XJMDANCNFSM52ZCOKHQ . You are receiving this because you were mentioned.Message ID: @.***>

koknat commented 2 years ago

Also, could you share how you installed graphviz for mac? Did you use 'brew' or something else? Asking in case it helps someone else with mac installation.

thegoatinthemachine commented 2 years ago

It's possible that at the time you raised the issue, graphviz may not have had a successful formula in homebrew, though I doubt that since I've been using that for years.

brew install graphviz should successfully get you that. Make sure you run brew dr before calling it quits on that.

If you don't want to futz around with cpan configuration, which I didn't, you can brew install cpanminus which puts an executable cpanm in the /usr/local/bin path.

Then for the dependencies for callGraph on cpan packages, sudo cpanm GraphViz

All that'd be left is to make sure that callGraph is either being called explicitly, or that it's in your path. I cloned the repo and used stow (a GNU project perl script, actually, also in homebrew) to manage its symlink.

koknat commented 2 years ago

Thank you @thegoatinthemachine

cosmojg commented 2 years ago

Just to provide another data point, callGraph works just fine on my machine running macOS Monterey (version 12.6), Homebrew (version 3.6.4), and GraphViz (version 6.0.1). Also, everything works as expected after adding callGraph to $PATH in Fish, Zsh, and Bash.

Notably, I ran into configuration issues (loadable library and perl binaries are mismatched) when trying to run callGraph with Homebrew's version of Perl. For lack of time, I ended up uninstalling Homebrew's Perl, nuked my Perl-related configuration files, unset my Perl-related environment variables, and switched to using the native Perl and CPAN binaries that ship with macOS by default. After starting from scratch, all I had to do was run cpan GraphViz with sudo and everything else worked as expected. (This was definitely user error, and I suspect I could get things running swimmingly with Homebrew's Perl if I tried hard enough.)

koknat commented 2 years ago

Thanks @cosmojg for sharing your config and experience

mkessy commented 2 years ago

Figured I leave another data point for those looking to get it running on macOS (Monterey 12.6). Thanks to @thegoatinthemachine instructions I got it working without any fuss.

brew install graphviz && brew install cpanminus && sudo cpanm GraphViz