facebookarchive / pfff

Tools for code analysis, visualizations, or style-preserving source transformation.
http://github.com/facebook/pfff/wiki/Main
Other
2.44k stars 204 forks source link

Fatal error: exception Failure("php checker needs a graph file") - Mac Sierra #151

Open ScottAtGithub opened 7 years ago

ScottAtGithub commented 7 years ago

I downloaded the latest version from github today, but I always got the following error message when I tried scheck on a few php files on my Mac. This is what I tried:

./scheck ./tests/php/coverage/t1_a.php Fatal error: exception Failure("php checker needs a graph file")

Please help. Thx!

istana commented 7 years ago

I was just able to run it. You need to build graph data first. For some reason scheck requires working directory to be the source code of the target. This should work:

mkdir ~/pfff_output
cd ~/phpsource
~/pfff/codegraph -lang php -derived_data -o ~/pfff_output/ -build ~/phpsource
~/pfff/scheck -lang php -with_graph_code ~/pfff_output/graph_code.marshall ~/phpsource
ScottAtGithub commented 7 years ago

I was able to build pfff yesterday but codegraph was not there, so I downloaded and installed softwares/plugins like gtk but was failed in building pfff (ml_glib.c:165:3: error: use of undeclared identifier 'caml__frame').

Let me try to see if I can fix it. Thank you very much anyway!

istana commented 7 years ago

that's interesting, I used install_macos.txt guide

sarcastron commented 7 years ago

I am also having issues compiling on OS X Sierra.

ml_glib.c:165:3: error: use of undeclared identifier 'caml__frame'
maxbeutel commented 7 years ago

Same for me, but on OS X El Capitan.

I followed the build instructions in install_macos.txt, make then dies with


ml_glib.c:165:3: error: use of undeclared identifier 'caml__frame'
  CAMLlocal2(b, msg);
  ^
/usr/local/lib/ocaml/caml/memory.h:309:3: note: expanded from macro 'CAMLlocal2'
  CAMLxparam2 (x, y)
  ^
/usr/local/lib/ocaml/caml/memory.h:236:12: note: expanded from macro 'CAMLxparam2'
    (void) caml__frame, \
           ^
ml_glib.c:348:11: warning: 'g_io_channel_read' is deprecated [-Wdeprecated-declarations]
  switch (g_io_channel_read(GIOChannel_val(io),
          ^
/usr/local/Cellar/glib/2.50.2/include/glib-2.0/glib/giochannel.h:166:13: note: 'g_io_channel_read' has been explicitly marked deprecated here
GIOError    g_io_channel_read   (GIOChannel    *channel,
            ^
1 warning and 1 error generated.
make[3]: *** [ml_glib.o] Error 2
make[2]: *** [all] Error 2
make[1]: *** [rec] Error 2
make: *** [all] Error 2```

Edit: This should probably be reported as a separate issue I suppose?
winnerineast commented 7 years ago

@maxbeutel I encountered the same error in macOS Sierra.

istana commented 7 years ago

me too, but I'm not sure how to fix it

petitchevalroux commented 7 years ago

It's seems to be related to ocaml 4.04. The same issue (https://github.com/facebook/hhvm/issues/7560) exists in hhvm.

Workarounds :

  1. Downgrade ocaml https://github.com/facebook/hhvm/issues/7560#issuecomment-268281219
  2. Use this commit (at your own risks xD) https://github.com/petitchevalroux/pfff/commit/10a3991e7fa19c4dbfa05c761df1edb1077ad473 based from
    https://github.com/facebook/hhvm/commit/28eefc45ef093c0d81e62375bd7cb22eb6d4b947