infer icon indicating copy to clipboard operation
infer copied to clipboard

Infer can't run on Xcode 13 with Big Sur

Open comcuter opened this issue 3 years ago • 4 comments

Please make sure your issue is not addressed in the FAQ.

Please include the following information:

  • [x] The version of infer from infer --version.
    v1.1.0
  • [x] Your operating system and version, for example "Debian 9", "MacOS High Sierra", whether you are using Docker, etc. macOS BigSur 11.3.1, Xcode 13.0
  • [x] Which command you ran, for example infer -- make. With this app https://github.com/facebook/infer/tree/main/examples/ios_hello First xcodebuild clean build -target HelloWorldApp -sdk iphonesimulator | tee xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json, then infer run --compilation-database-escaped compile_commands.json
  • [x] The full output in a paste, for instance a gist. https://gist.github.com/comcuter/2000625a18675d131704bc0ec03c6fa0
  • [x] If possible, a minimal example to reproduce your problem (for instance, some code where infer reports incorrectly, together with the way you run infer to reproduce the incorrect report). https://github.com/facebook/infer/tree/main/examples/ios_hello this simple demo

comcuter avatar Sep 26 '21 09:09 comcuter

Same problem here, with a different LLVM-based custom built clang (DeClang). Methinks, this is a result of switching to SDK 15, and the (new ❓) NS_FORMAT_ARGUMENT(A) macro in Foundation/NSObjcRuntime.h.

I could work around this by:

  • removing CLANG_ENABLE_MODULES = YES; from xcodeproj.
  • adding -DDNS_FORMAT_ARGUMENT(A)= to command line (need to carefully escape the round brackets)

alexcohn avatar Oct 12 '21 09:10 alexcohn

Thanks @alexcohn. After test with the latest Xcode SDK, I found that some header file add _Nullable_result keyword to support concurrency feature in Objc(ref), which is not supported in clang 11, so I use marco to define _Nullable_result to _Nullable. So with these commands, infer works!
First xcodebuild OTHER_CFLAGS="-DNS_FORMAT_ARGUMENT(A)= -D_Nullable_result=_Nullable" -target HelloWorldApp -sdk iphonesimulator clean build | tee xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json then infer run --skip-analysis-in-path Pods --compilation-database-escaped compile_commands.json

PS: I found that xcpretty will handle the ( = escape, so I didn't escape these symbols.

comcuter avatar Oct 13 '21 10:10 comcuter

i fixed in this way too https://github.com/cagnulein/qdomyos-zwift/commit/02d1710d0b2757e6a14159479e6049ec60c9ea9b

cagnulein avatar Oct 31 '21 05:10 cagnulein

I have resolved this issue, this is my env:

  • [ ] MacOS Monterey 12.0.1
  • [ ] I have installed both Xcode12.5 and Xcode13
  • [ ] Running project use Xcode13

The problem is : When I run pod install , the xcode-select tools is used Xcode12.5's tools, I forget to select tools by new Xcode13.1

How to resolve:

  1. Delete Xcode12.5 from my Mac.
  2. Download Xcode 13.1 , unzip and move to Application and rename as Xcode
  3. xcode-select Xcode13.1, you can run cmd into terminal:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Then, that's resolve! 🎉🎉🎉

YuanfuC avatar Nov 01 '21 08:11 YuanfuC