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

Add Cppcheck 2.2 #3424

Merged
merged 19 commits into from
Nov 16, 2020
Merged

Add Cppcheck 2.2 #3424

merged 19 commits into from
Nov 16, 2020

Conversation

mjvankampen
Copy link
Contributor

@mjvankampen mjvankampen commented Nov 5, 2020

Specify library name and version: cppcheck/2.2

  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

Deprecates https://github.com/bincrafters/conan-cppcheck_installer

I removed the z3 option as the original z3 (https://github.com/Z3Prover/z3/blob/master/cmake/Z3Config.cmake.in) provides some definitions that the conan z3 recipe does not provide, while cppcheck uses them. The best way to solve this is to add these to the z3 conan package right?

@conan-center-bot
Copy link
Collaborator

All green in build 1 (18cc73d32825d312beb81aa235c7006d73c0a12f)! 😊

It improves cppcheck reliability greatly
@mjvankampen mjvankampen marked this pull request as draft November 5, 2020 10:19
@conan-center-bot
Copy link
Collaborator

Some configurations of 'cppcheck/2.2' failed in build 2 (f8fe968c2722b951877b813793c3b85c50b67f01):

Mark Jan van Kampen added 2 commits November 5, 2020 11:43
The conan generated z3 package file does not provide the cmake definitions that cppcheck expects: https://github.com/Z3Prover/z3/blob/master/cmake/Z3Config.cmake.in
@conan-center-bot
Copy link
Collaborator

All green in build 4 (d489b31fce2ff6b6a901760d0182bed24cec089e)! 😊

@conan-center-bot
Copy link
Collaborator

Failure in build 5 (c41f8b8814f9110ed95ca11ec8c95712c86edddb):

  • cppcheck/2.2
    • Hooks errors detected:
      • [HOOK - conan-center.py] pre_export(): ERROR: [NO FINAL ENDLINE (KB-H041)] File '/home/conan/w/cci_PR-3424/recipes/cppcheck/all/conandata.yml' does not end with an endline (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H041)

@conan-center-bot
Copy link
Collaborator

config.yml syntax error in build 6:

Only one library can be changed in the same PR: [cppcheck/all, flatc/all]|

Mark Jan van Kampen added 2 commits November 5, 2020 13:01
@conan-center-bot
Copy link
Collaborator

Some configurations of 'cppcheck/2.2' failed in build 7 (3281eaf71d46f717248af7ce0572da1160005483):

@conan-center-bot
Copy link
Collaborator

Some configurations of 'cppcheck/2.2' failed in build 8 (08e3b56890923f0d2f40b4798cd20f301da7990c):

@conan-center-bot
Copy link
Collaborator

Some configurations of 'cppcheck/2.2' failed in build 9 (c2a8cb9a6b71b24f84511fb3abdce2bdd1edb15c):

@conan-center-bot
Copy link
Collaborator

Failure in build 10 (40fa9a02b1f0cb5121c6167679ccafbbc649e3f1):

  • Error processing recipe (ref 'cppcheck/2.2'): Linux x86_64, Release, gcc 4.9, libstdc++
    You are depending on 'z3/4.8.8' but it is not in the repository

@mjvankampen mjvankampen marked this pull request as ready for review November 6, 2020 09:23
@mjvankampen
Copy link
Contributor Author

I am unsure why the build fails, any tips?

@prince-chrismc
Copy link
Contributor

$ conan search -r conan-center z3*   
Existing package recipes:

z3/4.8.8
$ conan search -r conan-center -rev z3/4.8.8@
Revisions for 'z3/4.8.8' at remote 'conan-center':
0d84ad48876496eb900c5ad9a028367e (2020-08-25 11:38:27 UTC)

Matches the original PR: #1451

😖

I can see a few minor changes, let's see if rebuilding will do the trick

Comment on lines +11 to +13
# Setup libraries to link
set(Z3_LIBRARIES CONAN_PKG::z3)
set(PCRE_LIBRARY CONAN_PKG::pcre)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these for? I dont see where they are being used 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are normally set in https://github.com/danmar/cppcheck/blob/488813d00fab8278a78d518cf0d3d6651c8f0caa/cmake/findDependencies.cmake and used in various places. Using the standard mechanism leaves out some other dependencies (in case of PCRE) or uses the wrong name (in case of z3).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh thank you for the insight, I did not get to that file while searching the repo! Awesome work!

os.rename(extracted_dir, self._source_subfolder)

def _configure_cmake(self):
cmake = CMake(self)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

cmake = CMake(self)
cmake.definitions["USE_Z3"] = self.options.with_z3
cmake.definitions["HAVE_RULES"] = self.options.have_rules
cmake.definitions["USE_MATCHCOMPILER"] = self.settings.build_type == "Release"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at upstream, I am not 100% sure is this makes sense
https://github.com/danmar/cppcheck/blob/488813d00fab8278a78d518cf0d3d6651c8f0caa/cmake/options.cmake#L2

can you please confirm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the matchcompiler to "auto. The rest I left as is, I think those are correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly what I was looking at, just the github UI showing more.

$<TARGET_OBJECTS:simplecpp_objs_sanitized>
$<TARGET_OBJECTS:tinyxml_objs_sanitized>
$<TARGET_OBJECTS:lib_objs_sanitized>)
- target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals/tinyxml ${CMAKE_SOURCE_DIR}/externals)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to recommend keeping patches small. It appears that some of these are not relevant to building.

Would you mind trying to cut of the ones which are not a hard requirement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced it to dmake, thank you for all your comments!

@conan-center-bot
Copy link
Collaborator

All green in build 15 (0342f1deddb179a0a298ec5e2cf4ac6a87ad92c1)! 😊

prince-chrismc
prince-chrismc previously approved these changes Nov 8, 2020
Copy link
Contributor

@prince-chrismc prince-chrismc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 LGTM !

Copy link
Contributor

@ericLemanissier ericLemanissier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disclaimer, I did not test this !

Comment on lines +10 to +12
# Setup libraries to link
set(Z3_LIBRARIES CONAN_PKG::z3)
set(PCRE_LIBRARY CONAN_PKG::pcre)
Copy link
Contributor Author

@mjvankampen mjvankampen Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this won't work. The z3 package is exposed as z3_LIBRARIES not Z3_LIBRARIES (ref. original Z3Config.cmake.in https://github.com/Z3Prover/z3/blob/master/cmake/Z3Config.cmake.in).

I could patch more files in cppcheck but I think it is nicer to solve it outside that project.

As for PCRE I think as cppcheck uses find_library dependencies of PCRE (such as mpir) are not linked in correct? I'm not 100% sure but I remember mpir linker errors. I will try.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing PCRE leads to errors as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cppcheck uses find_library to find pcre, so if you want this to work, you need to add the cmake_path generator to the recipe, and add include(conan_paths.cmake) to this CMakeLists.txt , as I suggested earlier
Regarding Z3, there is indeed an incompatibility in the varibales generated by conan. this is conan-io/conan#7691 striking again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scratch that. this won't work as you pointed out, because find_library won't guess the dependencies. Too bad the upstream project uses cmake variables and find_library, instead of cmake targets :/

Comment on lines +10 to +12
# Setup libraries to link
set(Z3_LIBRARIES CONAN_PKG::z3)
set(PCRE_LIBRARY CONAN_PKG::pcre)
Copy link
Contributor Author

@mjvankampen mjvankampen Nov 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this won't work. The z3 package is exposed as z3_LIBRARIES not Z3_LIBRARIES (ref. original Z3Config.cmake.in https://github.com/Z3Prover/z3/blob/master/cmake/Z3Config.cmake.in).

I could patch more files in cppcheck but I think it is nicer to solve it outside that project.

As for PCRE I think as cppcheck uses find_library dependencies of PCRE (such as mpir) are not linked in correct? I'm not 100% sure but I remember mpir linker errors. I will try.

@conan-center-bot
Copy link
Collaborator

Some configurations of 'cppcheck/2.2' failed in build 16 (259e3cf7cc6120c2d86e3f9d8d5bc807b7f588d7):

This reverts commit 259e3cf.
Comment on lines +10 to +12
# Setup libraries to link
set(Z3_LIBRARIES CONAN_PKG::z3)
set(PCRE_LIBRARY CONAN_PKG::pcre)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scratch that. this won't work as you pointed out, because find_library won't guess the dependencies. Too bad the upstream project uses cmake variables and find_library, instead of cmake targets :/

@conan-center-bot
Copy link
Collaborator

All green in build 17 (4fa00eb3a4329a74108246f10c8ea7bea099ae1c)! 😊

@mjvankampen
Copy link
Contributor Author

Yeah that's a shame, when I find some time I will try to update cppcheck :)

@conan-center-bot conan-center-bot merged commit a1d9697 into conan-io:master Nov 16, 2020
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

Successfully merging this pull request may close these issues.

5 participants