infer icon indicating copy to clipboard operation
infer copied to clipboard

Error capturing Gradle project

Open AnyMarvel opened this issue 9 years ago • 5 comments

I use the official version of 0.12 did not cause problems. But from Https://github.com/facebook/infer/issues/668 The problem has not been compiled. Currently only use the official version The problem has been closed, but the latest version is not resolved, trouble to see

infer --version Infer version v0.12.0-70b5606 Copyright 2009 - present Facebook. All Rights Reserved.

gradle build success

gradle clean

success

infer -- gradle build *** Failed to execute compilation command: exited with code 2 *** Command: 'javac' '@/home/admin/example/infer-out/filelists/gradle_fIs7vn.txt' '@/tmp/args_81bf47'

Traceback (most recent call last): File "/home/admin/infer/infer/bin/../lib/python/infer.py", line 186, in main() File "/home/admin/infer/infer/bin/../lib/python/infer.py", line 168, in main capture_exitcode = imported_module.gen_instance(args, cmd).capture() File "/home/admin/infer/infer/lib/python/inferlib/capture/gradle.py", line 209, in capture return util.run_compilation_commands(cmds, clean_cmd) File "/home/admin/infer/infer/lib/python/inferlib/capture/util.py", line 41, in run_compilation_commands if cmd.start() != os.EX_OK: File "/home/admin/infer/infer/lib/python/inferlib/jwlib.py", line 37, in start raise e returned non-zero exit status 2 ERROR: (Unix.Exit_or_signal (Exit_non_zero 1))

the last version is also could not support gradle.

AnyMarvel avatar Jul 12 '17 03:07 AnyMarvel

This looks different than #668, where the issue was that infer run -- gradle ... didn't work when infer -- gradle ... did.

There's an error running javac:

*** Failed to execute compilation command: exited with code 2
*** Command: 'javac' '@/home/admin/example/infer-out/filelists/gradle_fIs7vn.txt' '@/tmp/args_81bf47'

What's the output of 'javac' '@/home/admin/example/infer-out/filelists/gradle_fIs7vn.txt' '@/tmp/args_81bf47'? If that doesn't help, what are the contents of "/home/admin/example/infer-out/filelists/gradle_fIs7vn.txt"?

jvillard avatar Jul 12 '17 10:07 jvillard

@jvillard I too am getting same error for android app: when I run javac - javac gradle_X7wvCV.txt error: Class names, 'gradle_X7wvCV.txt', are only accepted if annotation processing is explicitly requested 1 error

and when I run javac '@/workspace/Android_Infer/infer-out/filelists/gradle_X7wvCV.txt' output:- javac: file not found: library/src/com/viewpagerindicator/CirclePageIndicator.java Usage: javac use -help for a list of possible options

Can you please help to resolve this issue.

sukeshmlr avatar Aug 10 '17 12:08 sukeshmlr

faced same issue on 0.13.0

VarickQ avatar Jan 31 '18 08:01 VarickQ

It seems that the infer did not work properly.

The error is as following:

Usage Error:
*** Failed to execute compilation command: exited with code 2
*** Command: 'javac' '@/Users/xingli/Workspace/Android/XXX/infer-out/filelists/gradle_Dt27zY.txt' '@/var/folders/xm/jfdqqgwj251_56_td1dmkwnr0000gn/T/args_79088e'
*** Output:
javac: -classpath requires an argument
Usage: javac <options> <source files>
use -help for a list of possible options

*** Infer needs a working compilation command to run.


Failed to execute: /usr/local/Cellar/infer/0.13.0/lib/infer/infer/lib/python/inferlib/../../../bin/infer capture --continue -- javac -source 1.7 -target 1.7 -d /Users/xingli/Workspace/Android/XXX/annotation/build/classes/java/main -g -sourcepath -proc:none -XDuseUnsharedTable=true -classpath @/Users/xingli/Workspace/Android/XXX/infer-out/filelists/gradle_Dt27zY.txt
Traceback (most recent call last):
  File "/usr/local/Cellar/infer/0.13.0/lib/infer/infer/bin/../lib/python/infer.py", line 186, in <module>
    main()
  File "/usr/local/Cellar/infer/0.13.0/lib/infer/infer/bin/../lib/python/infer.py", line 168, in main
    capture_exitcode = imported_module.gen_instance(args, cmd).capture()
  File "/usr/local/Cellar/infer/0.13.0/lib/infer/infer/lib/python/inferlib/capture/gradle.py", line 217, in capture
    return util.run_compilation_commands(cmds, clean_cmd)
  File "/usr/local/Cellar/infer/0.13.0/lib/infer/infer/lib/python/inferlib/capture/util.py", line 46, in run_compilation_commands
    if cmd.start() != os.EX_OK:
  File "/usr/local/Cellar/infer/0.13.0/lib/infer/infer/lib/python/inferlib/jwlib.py", line 37, in start
    raise e
subprocess.CalledProcessError: Command '[u'/usr/local/Cellar/infer/0.13.0/lib/infer/infer/lib/python/inferlib/../../../bin/infer', u'capture', u'--continue', u'--', u'javac', u'-source', u'1.7', u'-target', u'1.7', u'-d', u'/Users/xingli/Workspace/Android/XXX/annotation/build/classes/java/main', u'-g', u'-sourcepath', u'-proc:none', u'-XDuseUnsharedTable=true', u'-classpath', u'@/Users/xingli/Workspace/Android/XXX/infer-out/filelists/gradle_Dt27zY.txt']' returned non-zero exit status 1

I try to run javac command independently, and it works ok.

javac -source 1.7 -target 1.7 -d /Users/xingli/Workspace/Android/XXX/annotation/build/classes/java/main -g -sourcepath -proc:none -XDuseUnsharedTable=true -classpath @/Users/xingli/Workspace/Android/XXX/infer-out/filelists/gradle_Dt27zY.txt

but I try to run with infer, it gives me the wrong answer.

➜  bin infer capture --continue -- javac -source 1.7 -target 1.7 -d /Users/xingli/Workspace/Android/XXX/annotation/build/classes/java/main -g -sourcepath -proc:none -XDuseUnsharedTable=true -classpath @/Users/xingli/Workspace/Android/XXX/infer-out/filelists/gradle_Dt27zY.txt
Capturing in javac mode...
Usage Error:
*** Failed to execute compilation command: exited with code 2
*** Command: 'javac' '@/Users/xingli/Workspace/Android/XXX/infer-out/filelists/gradle_Dt27zY.txt' '@/var/folders/xm/jfdqqgwj251_56_td1dmkwnr0000gn/T/args_8980b8'
*** Output:
javac: -classpath requires an argument
Usage: javac <options> <source files>
use -help for a list of possible options

*** Infer needs a working compilation command to run.

Please tell me if you need more info, thanks.

iluhcm avatar Feb 01 '18 03:02 iluhcm

I ran into this problem also.

It turns out that it is apparently just listing the file parameters in the wrong order. The args file should go before the filelist. This is why it says

-classpath requires an argument

When I manually execute the command with the parameters switched it works fine. So, for me it was javac '@/tmp/args_.tmp.64ce62' '@/tmp/working/infer-out/filelists/gradle_oHPBCi.txt'

Odysseuss avatar Apr 07 '18 20:04 Odysseuss