Solidity: [Build] jsoncpp 1.8.4 compilation fails with clang-10

Created on 15 Aug 2019  路  7Comments  路  Source: ethereum/solidity

Description

clang-10 (unreleased) reports a type conversion error here

https://github.com/open-source-parsers/jsoncpp/blob/ddabf50f72cf369bf652a95c4d9fe31a1865a781/src/lib_json/json_value.cpp#L70-L73

Likely root cause is https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es46-avoid-lossy-narrowing-truncating-arithmetic-conversions

build system fuzz-blocker

All 7 comments

Would be solved (with quite a big hammer) by https://github.com/ethereum/solidity/issues/6900 ;-).

This currently fails the fuzzing build. Working on a (temporary) fix.

I have not been able to "hot" patch this so far. The closest I came is to remove the -Werror=conversion option here

https://github.com/open-source-parsers/jsoncpp/blob/2cf939e8c37494922ca2991902a0fe50baa2eaea/CMakeLists.txt#L127

Sadly, even I were to add -Wno-error=conversion here

https://github.com/ethereum/solidity/blob/2508cbc1eb417f2fde6aea8a2b036eae96ad990b/cmake/jsoncpp.cmake#L22

it will be undone by the linked cmake because jsoncpp's -Werror=conversion follows the options supplied by CMAKE_CXX_FLAGS (see first link)

What happens if you add -DJSON_USE_INT64_DOUBLE_CONVERSION to JSONCPP_CXX_FLAGS? Even if that works, we'd need to have a close look at what that actually does, though :-).

Nice find :-)

Sadly, I cannot just pass -DJSON_USE... to JSONCPP_CXX_FLAGS because cmake-3.14 (version in the ossfuzz docker image) complains of definition not being of VAR=VALUE form, and when I do change it to the form it warns me that the passed option is not used by jsoncpp

Manually-specified variables were not used by the project:                                                                                   JSON_USE_INT64_DOUBLE_CONVERSION

@bshastry That sounds a bit weird... are you sure there aren't just some quotes missing which will make cmake consider it as a -D-style cmake option instead of a list of cxx flags?

Yup, the problem was missing double quotes :man_facepalming:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

area picture area  路  3Comments

AnthonyAkentiev picture AnthonyAkentiev  路  3Comments

chriseth picture chriseth  路  3Comments

chriseth picture chriseth  路  3Comments

madvas picture madvas  路  3Comments