Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infer failed in Xcode9: infer xcodebuild output error - *** Infer needs a working compilation command to run #759

Closed
tianshunjian opened this issue Sep 28, 2017 · 29 comments

Comments

@tianshunjian
Copy link

tianshunjian commented Sep 28, 2017

My project is created by Objective-C. And infer v0.12.0 was run successfully for my project in xcode 8 yesterday. Today I update my xcode to xcode 9, use some APIs in iOS 11, and update infer to v0.12.1.
Then when I run infer v0.12.1 on Xcode 9 with iOS 11 and LLVM v9.0.0 using the following command:

infer -- xcodebuild -workspace myProject.xcworkspace -scheme myProject -configuration Debug -sdk iphonesimulator

I got the following results:

Build Succeeded
Starting translating 463 files 

*** ERROR: Failed to execute compilation command. Output:
clang: error: cannot specify -o when generating multiple output files
*** Infer needs a working compilation command to run.

..MANY OF THESE ERRORS...then...

...
*** ERROR: Failed to execute compilation command. Output:
clang: error: cannot specify -o when generating multiple output files
*** Infer needs a working compilation command to run.
..

Nothing to compile. Try running `xcodebuild -workspace myProject.xcworkspace -scheme myProject -configuration Debug -sdk iphonesimulator clean` first.

There was nothing to analyze.
@Kaspik
Copy link

Kaspik commented Sep 29, 2017

The same issue here.

Objective-C project.

@tianshunjian
Copy link
Author

@jvillard Any advice will be appreciated so much

@Kaspik
Copy link

Kaspik commented Oct 2, 2017

@dulmarod Hey, any ideas what's happening here on new XCode or if current master (source) version has fixed this? Thanks!

@jvillard
Copy link
Contributor

jvillard commented Oct 3, 2017

There's a chance that the current master fixes this since it ships with a newer clang (5.0) than the 0.12.1 release. I'm not sure how to reproduce this locally to check so it would be great if you could try on your end. Let me know if you need any help with that.

@kaelinda
Copy link

The same issue here.

@IanLuo
Copy link

IanLuo commented Oct 18, 2017

same here, swift project

@ljfantin
Copy link

the same issue.
ObjC project

@tianshunjian
Copy link
Author

@jvillard I tried infer 0.12.1 with clang 6.0, however the same issue is still there.

@jvillard
Copy link
Contributor

Please try the new 0.13.0 release and let me know if the issue is still there: https://github.com/facebook/infer/releases/tag/v0.13.0

It's not yet in Homebrew but should be soon.

@tianshunjian 0.12.1 is the one that ships with an older clang.

@tianshunjian
Copy link
Author

@jvillard thanks very much

@StefanoBiasu
Copy link

StefanoBiasu commented Oct 24, 2017

Tried version 0.13.

After a clean of the project, running infer run with option --keep-going

infer run --keep-going -- xcodebuild -workspace < workspace > -scheme < scheme > -destination "platform=iOS Simulator,name=iPad Air" clean build

I got many issues:

Error: the following clang command did not run successfully:
'/usr/local/lib/infer/facebook-clang-plugins/clang/install/bin/clang' "@/var/folders/l2/j0r5rdh13yz3qmz97l5zj2h80000gp/T/clang_command_b483e4.txt"

and then

Nothing to compile. Try running xcodebuild -workspace <workspace> -scheme <scheme> -destination platform=iOS Simulator,name=iPad Air clean first.
There was nothing to analyze.

@lizuba
Copy link

lizuba commented Nov 2, 2017

@jvillard the same issue with StefanoBiasu

@jvillard
Copy link
Contributor

jvillard commented Nov 3, 2017

Any project I can try to reproduce this on?

Can you try passing --no-xcpretty to infer and see if that helps?

Error: the following clang command did not run successfully:
'/usr/local/lib/infer/facebook-clang-plugins/clang/install/bin/clang' "@/var/folders/l2/j0r5rdh13yz3qmz97l5zj2h80000gp/T/clang_command_b483e4.txt"

What was the error? Can you paste the contents of the argfile when that happens (here /var/folders/l2/j0r5rdh13yz3qmz97l5zj2h80000gp/T/clang_command_b483e4.txt).

@tianshunjian
Copy link
Author

@jvillard I tried infer 0.13.0 installed by Homebrew, and the same issue with StefanoBiasu is there. I run the command

infer --keep-going -- xcodebuild -workspace SohuLive.xcworkspace -scheme SohuLiveSDK-Video -configuration Debug -sdk iphonesimulator

then I got the following results:

▸ Build Succeeded
Starting translating 657 files
error error error: : : error reading '/Users/alien/Library/Developer/Xcode/DerivedData/SohuLive-ghdkpzrqqcwsfodvmauljdvdpvlo/Index/DataStore'error reading '/Users/alien/Library/Developer/Xcode/DerivedData/SohuLive-ghdkpzrqqcwsfodvmauljdvdpvlo/Index/DataStore'error reading '/Users/alien/Library/Developer/Xcode/DerivedData/SohuLive-ghdkpzrqqcwsfodvmauljdvdpvlo/Index/DataStore'


error: error reading '/Users/alien/Library/Developer/Xcode/DerivedData/SohuLive-ghdkpzrqqcwsfodvmauljdvdpvlo/Index/DataStore'
1 error generated.
1 error generated.
1 error generated.
1 error generated.
ERROR RUNNING CAPTURE: Bi_inbuf.End_of_input
Raised at file "src/bi_inbuf.ml", line 49, characters 6-24
Called from file "src/bi_io.ml" (inlined), line 508, characters 12-35
Called from file "atd/clang_ast_b.ml", line 27505, characters 7-24
Called from file "clang/Capture.ml", line 48, characters 8-39
Called from file "clang/Capture.ml" (inlined), line 93, characters 6-35
Called from file "clang/Capture.ml", line 157, characters 26-73

Error: the following clang command did not run successfully:
  '/usr/local/Cellar/infer/0.13.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang' "@/var/folders/nz/q5nqx70930b0b1vszw0v4qm80000gn/T/clang_command_63740c.txt"
ERROR RUNNING CAPTURE: Bi_inbuf.End_of_input
Raised at file "src/bi_inbuf.ml", line 49, characters 6-24
Called from file "src/bi_io.ml" (inlined), line 508, characters 12-35
Called from file "atd/clang_ast_b.ml", line 27505, characters 7-24
Called from file "clang/Capture.ml", line 48, characters 8-39
Called from file "clang/Capture.ml" (inlined), line 93, characters 6-35
Called from file "clang/Capture.ml", line 157, characters 26-73

and lots of those, finally I got "No issues found".

And this is the log file
logs.txt

@tianshunjian
Copy link
Author

tianshunjian commented Nov 6, 2017

@jvillard @lizuba @StefanoBiasu
I can get the right results by running the following command

infer --keep-going --no-xcpretty -- xcodebuild -workspace SohuLive.xcworkspace -scheme SohuLiveSDK-Video -configuration Debug -sdk iphonesimulator

And thank you @jvillard very much for your patience.
I wanna know why "--no-xcpretty" must be added when running infer. Could you please explain it.

@lizuba
Copy link

lizuba commented Nov 6, 2017

thank you! it seems to work if i add --no-xcpretty

@StefanoBiasu
Copy link

Thanks @tianshunjian for reporting my issue.
Tried with --no-xcpretty, seems to work even for me.
Thanks @jvillard

@jvillard
Copy link
Contributor

jvillard commented Nov 6, 2017

Thanks all for testing. By default infer pipes xcodebuild output to xcpretty to get a compilation database. --no-xcpretty makes infer use a different integration that works by having xcodebuild call infer directly instead of calling clang. The latter used to be more fragile, but now it looks like it's the other way around.

The xcpretty-based integration should be fixed, but in the meantime please use the --no-xcpretty workaround.

@StefanoBiasu
Copy link

StefanoBiasu commented Nov 16, 2017 via email

@dulmarod
Copy link
Contributor

Hi @tefanoBiasu, the options are available in infer --help. The help is very comprehensive, it's work getting familiar with the different options.

@StefanoBiasu
Copy link

StefanoBiasu commented Nov 16, 2017 via email

@TimorYang
Copy link

@jvillard I tried it the way you offered it, but it didn't work, just printed it.
0.13.0
log:

TimorYangdeMBP:AllInOne_IOS TimorYang$ infer --keep-going --no-xcpretty -- xcodebuild -workspace AllInOne.xcworkspace -scheme AllInOne -configuration Debug -sdk iphonesimulator
Capturing in xcodebuild mode...
argument -o/--out: invalid decode value: u'/Users/TimorYang/Documents/\u4f17\u5305/AllInOne_IOS/infer-out'

/usr/local/Cellar/infer/0.13.0/libexec/bin/infer --keep-going --no-xcpretty -- xcodebuild -workspace AllInOne.xcworkspace -scheme AllInOne -configuration Debug -sdk iphonesimulator
Infer version v0.13.0
Copyright 2009 - present Facebook. All Rights Reserved.
Usage: infer command [options]
See infer --help for more information.

Command does not exist

@lizuba
Copy link

lizuba commented Jan 6, 2018

哥们 你路径中是有中文么 换个英文路径看看@TimorYang

@TimorYang
Copy link

@lizuba 好的,谢谢.

@crespoxiao
Copy link

interesting

@liumingzhi
Copy link

Internal Error: /usr/local/Cellar/infer/0.15.0/lib/infer/infer/bin/../lib/python/infer.py
-j 4 --project-root /Users/mingzhi.liu/Desktop/工程1/lianjia_ios_platc
--out /Users/mingzhi.liu/Desktop/工程1/lianjia_ios_platc/infer-out --
xcodebuild -workspace LJShell.xcworkspace -scheme LJShell -configuration
Debug -sdk iphonesimulator -arch i386:
exited with code 1
Error backtrace:
Raised at file "base/Die.ml" (inlined), line 25, characters 6-36
Called from file "base/Logging.ml", line 314, characters 58-80
Called from file "integration/Driver.ml", line 159, characters 2-16
Called from file "integration/Driver.ml", line 280, characters 6-420
Called from file "infer.ml", line 20, characters 2-36
Called from file "infer.ml", line 130, characters 8-54

@gearcapitan
Copy link

mexico5dii_08114_1_6x7

@gearcapitan
Copy link

I have the same problem. @liumingzhi

@NameOfSelf
Copy link

The same problem here. Infer version -- 0.15.0 @liumingzhi
Internal Error: /usr/local/Cellar/infer/0.15.0/lib/infer/infer/bin/../lib/python/infer.py
-j 8 --project-root /Users/guwei --out /Users/guwei/infer-out -- xcodebuild
-workspace ios_hello.xcodeproj -scheme ios_hello -configuration Debug -sdk
iphonesimulator:
exited with code 66
Error backtrace:
Raised at file "base/Die.ml" (inlined), line 25, characters 6-36
Called from file "base/Logging.ml", line 314, characters 58-80
Called from file "integration/Driver.ml", line 159, characters 2-16
Called from file "integration/Driver.ml", line 280, characters 6-420
Called from file "infer.ml", line 20, characters 2-36
Called from file "infer.ml", line 130, characters 8-54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests