Troubles with oclint-json-compilation-database | with Xcode 5 project

3,560 views
Skip to first unread message

eelco

unread,
Oct 11, 2013, 12:20:40 PM10/11/13
to oclint...@googlegroups.com
Hi,

I'm trying to use xctools or xcodebuild to generate a compile_commands.json to create a html or pmd(xml) report for Jenkins. For now i'm having different problems as having empty(only [] showing) compile_commands.json file when building with dependency frameworks(cocoa pods).

With a simpele project it generates the attached compile_commands.json. Now, when i'm having a seemingly correct commands file, by running oclint-json-compilation-database it will give errors like the following:
While building module 'UIKit' imported from /Users/eelcokoelewijn/Developer/afl_ios_xctooltest/xctool_test/xctool_test/xctool_test-Prefix.pch:14:
While building module 'QuartzCore' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UICollectionViewLayout.h:11:
While building module 'OpenGLES' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAEAGLLayer.h:7:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h:8:10: fatal error: could not build module 'Foundation'
#include <Foundation/Foundation.h>

I'm using oclint 0.7 with xcode 5 installed on a mac with osx 10.8.5. For creating the compile_commands.json i used xctool with -reporter json-compilation-database:compile_commands.json flag. Also tried xcodebuild and then oclint-xcodebuild to create compile_commands.json, this commands file also produces the same problem.

Attached is the compile_commands.json for a simple project which gives the above errors.

Any tips are welcome!



---------------------------------------------
aFrogleap BV
Making Mobile Magic

Adres......Van Diemenstraat 224
...............1013 CP Amsterdam
Tel..........+31(0)20-7542266
Web........www.afrogleap.nl
KVK........50419706
---------------------------------------------
compile_commands.json

Longyi Qi

unread,
Oct 13, 2013, 3:56:32 PM10/13/13
to eelco, oclint...@googlegroups.com
Hi,
Could you try using https://raw.github.com/oclint/oclint-xcodebuild/master/oclint-xcodebuild to replace the existing oclint-xcodebuild and see if the latest version can generate the correct compile_commands.json for you?

Or, not sure this project is available on github or any public platforms? So that  we can take a look at try to reproduce locally in order to have a better understanding?

Thanks,
Longyi



--
You received this message because you are subscribed to the Google Groups "OCLint Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oclint-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

swizzlr...@gmail.com

unread,
Nov 21, 2013, 2:36:16 PM11/21/13
to oclint...@googlegroups.com, eelco
I'm having the same problem when using the compile_commands.json generated by the latest version of xctool. I'll give oclint-xcodebuild a try. I am using 0.7 – does it fail to understand modules?

Longyi Qi

unread,
Nov 21, 2013, 7:41:36 PM11/21/13
to swizzlr...@gmail.com, oclint...@googlegroups.com, eelco
I would expect oclint-xcodebuild-0.7 fails with Xcode 5 also. Would you like to try the latest one from trunk, and let us know if it works for you?

By the way, did you say the latest xctool stop working for Xcode 5? I would like to catch up with it as well.

Longyi

Jani Jegoroff

unread,
Nov 28, 2013, 10:28:36 AM11/28/13
to oclint...@googlegroups.com
I have same problems with OCLint 0.7 release, Xcode 5 and iOS7 project. 

Are you planning to fix this bug for the next release?

Longyi Qi

unread,
Nov 28, 2013, 10:30:59 AM11/28/13
to Jani Jegoroff, oclint...@googlegroups.com
We should have this fixed in our trunk, would you help try the latest dev version?
--

Jani Jegoroff

unread,
Nov 28, 2013, 5:21:42 PM11/28/13
to oclint...@googlegroups.com, Jani Jegoroff
I might give a try tomorrow. When are you planning to release next stable version?

Jani

Marc C

unread,
Nov 29, 2013, 5:16:22 AM11/29/13
to oclint...@googlegroups.com, Jani Jegoroff
I'm having the same issue on 0.8 with  XCode 5 iOS7 Project. I get hundreds of compiler warnings on a simple Utility project.

On another, more complicated project I don't even get that far, I get the following:

** BUILD SUCCEEDED **

Assertion failed: (!isa<ObjCProtocolDecl>(getDeclContext()) && "It's a protocol method"), function getClassInterface, file /Users/lqi/.jenkins/workspace/oclint-ci/oclint-build-nodes/master/oclint/llvm/tools/clang/lib/AST/DeclObjC.cpp, line 881.

However, I believe this is being addressed with the Fixing the Crash for FeatureEnvyRule pull.

Longyi Qi

unread,
Nov 29, 2013, 11:46:24 AM11/29/13
to Jani Jegoroff, oclint...@googlegroups.com
End of the year. LLVM 3.4 is expected to be released on Dec 23, and if it’s released on time, we will release 0.8 within a week.

If you could let us know if the latest dev version works with your environment, that will be highly appreciated.

Longyi Qi

unread,
Nov 29, 2013, 11:55:11 AM11/29/13
to Marc C, oclint...@googlegroups.com, Jani Jegoroff
The embedded clang backend is newer than the one bundled with Xcode 5, so I would expect more compiler warnings then the the derived compiler specific for Xcode 5.

I worried more about the crashes from the feature envy rule. The fix was patched yesterday, and our nightly build machine is now generating the new dev binary, once it’s done and the new binary published (http://oclint.org/downloads.html), would you give it a try and let us know if you still get this assertion failure? Please keep the download URL for record in case the issue still exists, I need to know the git revision from the url.

You can checkout the build status from http://pearland.qilongyi.com:5581/

Thanks,
Longyi

Jani Jegoroff

unread,
Dec 3, 2013, 7:11:45 AM12/3/13
to oclint...@googlegroups.com, Marc C, Jani Jegoroff
I tried new binaries. When I execute command oclint-json-compilation-database -debug -- -report-type pmd -o oclint.xml I noticed following:

1. Few errors about config file
Reading config file: /usr/local/bin/../etc/oclint
No such file or directory
Reading config file: /Users/<user>/.oclint
No such file or directory
Reading config file: /Users/<user>/<jenkins-job-path>/workspace/.oclint
No such file or directory

2. All source files are compiled and analysed successfully without errors

3. oclint.xml output file is not generated

Do you know why output file is not generated?

Jani Jegoroff

unread,
Dec 3, 2013, 7:33:58 AM12/3/13
to oclint...@googlegroups.com, Marc C, Jani Jegoroff
Version info I used:

  LLVM version 3.5svn
  DEBUG build with assertions.
  Built Nov 30 2013 (08:15:29).
  Default target: x86_64-apple-darwin13.0.0
  Host CPU: core-avx-i

Jani Jegoroff

unread,
Dec 6, 2013, 7:02:07 AM12/6/13
to oclint...@googlegroups.com, Marc C, Jani Jegoroff
Hey, any updates on this issue?

Longyi Qi

unread,
Dec 6, 2013, 7:07:32 PM12/6/13
to Jani Jegoroff, oclint...@googlegroups.com, Marc C
Hi Jani,
For errors about the config file: there are intermediate debug information, if you build OCLint with release build, it won't be there.

Based on the information I have, I have no clue why oclint.xml is not generated. The only thing I would suggest is to check if the file is outputted into `/Users/<user>/<jenkins-job-path>/workspace/.oclint` 

Thanks,
Longyi

Jani Jegoroff

unread,
Dec 10, 2013, 8:39:11 AM12/10/13
to oclint...@googlegroups.com, Jani Jegoroff, Marc C
There is no .oclint directory in jenkins job workspace dir.

Longyi Qi

unread,
Dec 14, 2013, 4:02:05 PM12/14/13
to Jani Jegoroff, oclint...@googlegroups.com
Yeah, I am not asking the existence of .oclint file, the debug information only indicates there is no .oclint, and it will use the default configurations.

Meanwhile, it shows your current working directory is /Users/<user>/<jenkins-job-path>/workspace/, so I am wondering if the oclint.xml has been generated there.

Longyi

srinivas chary

unread,
Dec 28, 2013, 8:55:18 AM12/28/13
to oclint...@googlegroups.com, Jani Jegoroff
Hi,

I have the same issue, I have the generated compile_commands.json file which is around 20mb for the project in my case. When I run "oclint-json-compilation-database -- -report-type=pmd -o=oclint.xml --stats" it is not generating any output file. I am able to get compiling and analyzing for each file as success when I run with debug mode.

Is there a way to check where it is breaking for genrating the file.

Right now I stuck with this to get a static report.

-Srinivas

Longyi Qi

unread,
Dec 28, 2013, 10:50:11 AM12/28/13
to srinivas chary, oclint...@googlegroups.com, Jani Jegoroff
Sorry for the inconvenience. But it’s sort of hard for us to identify the issue based on this description to the issue. 

Two things I would suggest:
1. Build oclint in debug mode, and turn on the `-debug` flag for extra outputs. Hope helpful extra info can be collected for diagnosis. 
2. Since you have the compile_commands.json file generated, try to analyze one file or a subset of the files (you can filter files with oclint-json-compilation-database), and see if you could see reports. And then extend the inspection area in order to have the problematic file. If you could like to share the problematic file, and the compile_commands.json segment specific for that file, then I could dig into it.

Thanks,
Longyi

srinivas chary

unread,
Dec 29, 2013, 11:12:01 AM12/29/13
to oclint...@googlegroups.com
Hi Longyi,

Thanks for the inputs provided. I tried with filter feature but it took so much time for me though to find the error based on trial and errors on folder scans. It is reporting below exceptions..

Compiling /Users/RELEASE/Releases/luavmiphone/Sources/Widgets/Chart2D3D/DvCGLNeXt/ThirdParty/KlJsonReader/json_reader.cppAssertion failed: (Instance && "Compiler instance not registered!"), function getCompilerInstance, file /Users/lqi/.jenkins/workspace/oclint-ci/oclint-build-nodes/master/oclint/llvm/tools/clang/include/clang/Frontend/FrontendAction.h, line 115.

Let me know how can we rectify this exception.

-Srinivas

Jani Jegoroff

unread,
Jan 7, 2014, 10:59:23 AM1/7/14
to oclint...@googlegroups.com, Jani Jegoroff
LLVM 3.4 was released yesterday. Does this mean that we can enjoy new OCLint stable release next week? :)

Longyi Qi

unread,
Jan 7, 2014, 11:08:04 AM1/7/14
to Jani Jegoroff, oclint...@googlegroups.com
Very soon! I am generating the release candidate build for 0.8 today, will send out the emails later today. :)

Jani Jegoroff

unread,
Jan 7, 2014, 11:23:46 AM1/7/14
to oclint...@googlegroups.com, Jani Jegoroff
Awesome! :)

Satish Patil

unread,
Mar 5, 2014, 9:56:54 AM3/5/14
to oclint...@googlegroups.com
Hi,

I have truble with executing  oclint-json-compilation-database in terminal, I get the following error

EEEPC0298:Generic administrator$ oclint-json-compilation-database -- -o=report.html
dlopen(/usr/bin/../lib/oclint/rules/libAvoidBranchingStatementAsLastInLoopRule.so, 1): no suitable image found.  Did find:
/usr/bin/../lib/oclint/rules/libAvoidBranchingStatementAsLastInLoopRule.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
oclint: error: cannot open dynamic library: /usr/bin/../lib/oclint/rules/libAvoidBranchingStatementAsLastInLoopRule.so

I am using Xcode 5 amd mac OSX 10.8.4

Thanks
Satish.

On Friday, October 11, 2013 9:50:40 PM UTC+5:30, eelco wrote:

Longyi Qi

unread,
Mar 5, 2014, 11:00:53 AM3/5/14
to Satish Patil, oclint...@googlegroups.com
If I understand correctly, you are using the linux binaries on a Mac machine. Switching to Mac binaries should load the dynamic libraries for you.
--

sanjay bhangade

unread,
Sep 17, 2014, 8:51:11 AM9/17/14
to oclint...@googlegroups.com
Still I am facing issue, Any one able to use it successfully with xcode 5

sar...@qburst.com

unread,
Jul 8, 2015, 6:28:19 AM7/8/15
to oclint...@googlegroups.com


Hi eelco,
            try this
         
$ xcodebuild clean build > xcodebuild.log


$ oclint-xcodebuild


$ oclint-json-compilation-database  -- -report-type pmd -o oclint.xml


Reply all
Reply to author
Forward
0 new messages