javalib incompatibility causes infer -- javac Hello.java to fail with no files analyzed
the log trace is as below: wyw@wyw-System-Product-Name:~/workspace/test$ infer -- javac Hello.java TODO: print error message Starting analysis (Infer version v0.1.0) Fatal error: exception Sys_error("/home/wyw/workspace/test/infer-out/captured: No such file or directory") [ERROR] Failure during create_makefile, original command was
[u'inferJ', u'-g', u'-a', 'infer', u'javac', 'Hello.java']
Traceback (most recent call last):
File "/home/wyw/Downloads/infer-linux64-v0.1.0/infer/infer/bin/inferJ", line 19, in
Anyone could explain?
Hello @wywlds,
Have you tried running javac Hello.java and see if it compiles correctly?
I suspect javac is not installed in your machine.
@martinoluca I installed javac. Proof: wyw@wyw-System-Product-Name:~/workspace/test$ javac -version javac 1.7.0_06
Thanks for reporting this. It seems that the execution reached the point where no source files were found:
https://github.com/facebook/infer/blob/master/infer/src/java/jMain.ml#L167
I suspect that we are having issues here with incompatible format:
https://github.com/facebook/infer/blob/master/infer/src/java/jClasspath.ml#L109
which leads to all the classes in the small example to be skipped.
But I would not know how to reproduce it.
I'm getting the same error.
I've run the infer/scripts/test.sh script. The output is below:
staff-246-113:infer David$ ./scripts/test.sh
+++ dirname ./scripts/test.sh
++ cd ./scripts
++ pwd
+ SCRIPT_DIR=/Users/David/Documents/Development/tools/infer-osx-v0.1.0/infer/scripts
+ INFER_DIR=/Users/David/Documents/Development/tools/infer-osx-v0.1.0/infer/scripts/..
+ INFER_BIN=/Users/David/Documents/Development/tools/infer-osx-v0.1.0/infer/scripts/../infer/bin
+ '[' '' == --xml ']'
+ TARGETS_TO_COMPILE=()
+ TARGETS_TO_TEST=()
+ '[' -e /Users/David/Documents/Development/tools/infer-osx-v0.1.0/infer/scripts/../infer/bin/InferJava ']'
+ TARGETS_TO_COMPILE+=('java')
+ TARGETS_TO_TEST+=('java')
++ uname
+ platform=Darwin
+ '[' -e /Users/David/Documents/Development/tools/infer-osx-v0.1.0/infer/scripts/../infer/bin/InferClang ']'
+ TARGETS_TO_COMPILE+=('clang')
+ TARGETS_TO_TEST+=('c' 'cpp')
+ '[' Darwin == Darwin ']'
+ TARGETS_TO_TEST+=('objc')
+ '[' -z java ']'
+ '[' -z java ']'
+ cd /Users/David/Documents/Development/tools/infer-osx-v0.1.0/infer/scripts/..
+ make -C infer java clang
make: *** No rule to make target `java'. Stop.
Maybe this will help.
Regards,
I've managed to get this working. Upgraded my java installation to:
$ java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
and downgraded my javac to:
$ javac -version
javac 1.7.0_79
as @jeremydubreil said, looks like compatibility issues.
@aussiDavid: Good point! Which version of Java were you using before ?
@wywlds: Can you please check which implementation of Java are you using with java -version ?
@jeremydubreil: I'm not 100% sure. From memory it was v1.6~.
I upgraded from build 1.7.0_75-b13 to 1.7.0_79 but no joy. I'll be more then happy to help troubleshooting . Infer looks so promising!
@icaspi: what do you get if you do: java -version ?
java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
@icaspi: Thanks! Should normally be working with this version. Which platform are you trying this on ?
OSX 10.10.3
@icaspi: OK, so nothing we did not test with. Did you try modifying the example file Hello.java a bit and check if it is always failing
@jeremydubreil Sorry I forgot to mention I'm running it using a gradle build on a somewhat of a complex project I'll try to run it on a hello world in a few hours and get back to you, thank you so much!
Same problem. I have two java environments for choice. The problem remains on both two versions.
export JAVA_6_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
export JAVA_7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
export JAVA_HOME=$JAVA_7_HOME
alias jdk7='export JAVA_HOME=$JAVA_7_HOME'
alias jdk6='export JAVA_HOME=$JAVA_6_HOME'
I have the same issue:
OSX 10.10.3, java version "1.7.0_71" ,Python 2.7.6
loulijun:test loulijun$ infer -- javac Hello.java
TODO: print error message
Starting analysis (Infer version v0.1.0)
Fatal error: exception Sys_error("/Users/loulijun/test/infer-out/captured: No such file or directory")
[ERROR] Failure during create_makefile, original command was
[u'inferJ', u'-g', u'-a', 'infer', u'javac', 'Hello.java']
Traceback (most recent call last):
File "/Users/loulijun/application/infer/infer-osx-v0.1.0/infer/infer/bin/inferJ", line 19, in <module>
stats = analysis.start()
File "/Users/loulijun/application/infer/infer-osx-v0.1.0/infer/infer/bin/inferlib.py", line 634, in start
self.analyze_and_report()
File "/Users/loulijun/application/infer/infer-osx-v0.1.0/infer/infer/bin/inferlib.py", line 613, in analyze_and_report
if self.analyze() == os.EX_OK:
File "/Users/loulijun/application/infer/infer-osx-v0.1.0/infer/infer/bin/inferlib.py", line 489, in analyze
self.args.analyzer
File "/Users/loulijun/application/infer/infer-osx-v0.1.0/infer/infer/bin/inferlib.py", line 318, in run_command
raise e
subprocess.CalledProcessError: Command '[u'/Users/loulijun/application/infer/infer-osx-v0.1.0/infer/infer/bin/InferAnalyze', u'-results_dir', '/Users/loulijun/test/infer-out', u'-makefile', u'Makefile', u'-allow_specs_cleanup', u'-models', u'/Users/loulijun/application/infer/infer-osx-v0.1.0/infer/infer/bin/../lib/java/models.jar', u'-project_root', '/Users/loulijun/test']' returned non-zero exit status 2
@jeremydubreil Hello.java is working fine I believe this the problem -
At first it complained about LeakCanary (https://github.com/square/leakcanary) I suspect its something with its lint release configuration, after removing LeakCanary it complains about this -
22:41:36.360 [ERROR] [org.gradle.BuildExceptionReporter]
22:41:36.360 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
22:41:36.361 [ERROR] [org.gradle.BuildExceptionReporter]
22:41:36.361 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
22:41:36.361 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':libraries:facebook:lint'.
22:41:36.361 [ERROR] [org.gradle.BuildExceptionReporter] > Lint found errors in the project; aborting build.
22:41:36.361 [ERROR] [org.gradle.BuildExceptionReporter]
22:41:36.361 [ERROR] [org.gradle.BuildExceptionReporter] Fix the issues identified by lint, or add the following to your build script to proceed with errors:
22:41:36.362 [ERROR] [org.gradle.BuildExceptionReporter] ...
22:41:36.362 [ERROR] [org.gradle.BuildExceptionReporter] android {
22:41:36.362 [ERROR] [org.gradle.BuildExceptionReporter] lintOptions {
22:41:36.362 [ERROR] [org.gradle.BuildExceptionReporter] abortOnError false
22:41:36.362 [ERROR] [org.gradle.BuildExceptionReporter] }
22:41:36.362 [ERROR] [org.gradle.BuildExceptionReporter] }
22:41:36.362 [ERROR] [org.gradle.BuildExceptionReporter] ...
22:41:36.362 [ERROR] [org.gradle.BuildExceptionReporter]
22:41:36.363 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
22:41:36.363 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
My release config (gradle clean assembleGoogleRelease) is building fine...
Any ideas?
Waiting for solve this problem.
Hi @icaspi, would you mind opening another issue for this problem, since running Infer on Hello.java seems to work for you? Many thanks!
@jeremydubreil it's java 1.7.0_06 java version "1.7.0_06" Java(TM) SE Runtime Environment (build 1.7.0_06-b24) Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)