Skip to content

GCC6 Support #411

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

Closed
cinemast opened this issue Feb 3, 2016 · 22 comments
Closed

GCC6 Support #411

cinemast opened this issue Feb 3, 2016 · 22 comments
Assignees

Comments

@cinemast
Copy link
Contributor

cinemast commented Feb 3, 2016

Hi!

At Debian we are currently preparing the migration to GCC6. The following issues are currently affecting libjsoncpp.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=811958

Could you take a look at it?

@cdunn2001 cdunn2001 self-assigned this Feb 4, 2016
@cdunn2001
Copy link
Contributor

This weekend.

Any chance you can update to 1.6.x? The link refers to 0.10.5.

@cinemast
Copy link
Contributor Author

cinemast commented Feb 4, 2016

Tha transition is currently in progress. It might take a few days until its completed.

https://release.debian.org/transitions/html/auto-libjsoncpp.html

So you think those problems should be fixed in 1.6.x?

@cinemast
Copy link
Contributor Author

cinemast commented Feb 5, 2016

I tried rebuilding the latest release with GCC-6, resulting in the following build errors:

http://paste.debian.net/378673/

@cinemast
Copy link
Contributor Author

cinemast commented Feb 5, 2016

Also while we are at it, could you take a look at current debian patches and check if any of those could be imported upstream?

http://anonscm.debian.org/cgit/collab-maint/libjsoncpp.git/tree/debian/patches

@cdunn2001
Copy link
Contributor

So you think those problems should be fixed in 1.6.x?

No, but the fix depends on compiler version. (std::auto_ptr<> -> const std::scoped_ptr<>) I'd rather not fix this at all in the old code. If we can fix the conversion errors from your latest build, that's a better path forward.

Also while we are at it, could you take a look at current debian patches and check if any of those could be imported upstream?

Sure! This weekend.

@cinemast
Copy link
Contributor Author

cinemast commented Feb 5, 2016

Of course, I am working on dropping 0.x.y support in the next Debian release. Thanks for taking the effort.

Greetings

@cdunn2001
Copy link
Contributor

Patched 0.y.z and fixed 1.y.z. Let's try again.

And if it works, I'll cut a new 1.7.0 release. I've already updated the version number on the master branch.

@cinemast
Copy link
Contributor Author

cinemast commented Feb 7, 2016

Hi Cristopher!
With the latest git head on master, the errors are still mostly the same:

mkdir build
root@cinemast-ThinkPad-T410s:/tmp/jsoncpp# cd build/
root@cinemast-ThinkPad-T410s:/tmp/jsoncpp/build# cmake ..
-- The C compiler identification is GNU 6.0.0
-- The CXX compiler identification is GNU 6.0.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- JsonCpp Version: 1.7.0
-- Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "2.6")
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/jsoncpp/build
root@cinemast-ThinkPad-T410s:/tmp/jsoncpp/build# make -j4
Scanning dependencies of target jsoncpp_lib_static
[ 11%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o
[ 33%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o
[ 33%] Building CXX object src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_writer.cpp.o
/tmp/jsoncpp/src/lib_json/json_value.cpp: In copy constructor 'Json::Value::CZString::CZString(const Json::Value::CZString&)':
/tmp/jsoncpp/src/lib_json/json_value.cpp:235:18: error: conversion to 'unsigned char:2' from 'unsigned int' may alter its value [-Werror=conversion]
   storage_.policy_ = (other.cstr_
                      ~~~~~~~~~~~~
                  ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      ? noDuplication : duplicate)
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  : static_cast<DuplicationPolicy>(other.storage_.policy_));
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/tmp/jsoncpp/src/lib_json/json_value.cpp:235:18: error: conversion to 'unsigned char:2' from 'unsigned int' may alter its value [-Werror=conversion]
/tmp/jsoncpp/src/lib_json/json_value.cpp: In instantiation of 'bool Json::InRange(double, T, U) [with T = long long int; U = long long int]':
/tmp/jsoncpp/src/lib_json/json_value.cpp:706:51:   required from here
/tmp/jsoncpp/src/lib_json/json_value.cpp:61:12: error: conversion to 'double' from 'long long int' may alter its value [-Werror=conversion]
   return d >= min && d <= max;
          ~~^~~~~~

/tmp/jsoncpp/src/lib_json/json_value.cpp:61:24: error: conversion to 'double' from 'long long int' may alter its value [-Werror=conversion]
   return d >= min && d <= max;
                      ~~^~~~~~

/tmp/jsoncpp/src/lib_json/json_value.cpp: In instantiation of 'bool Json::InRange(double, T, U) [with T = int; U = long long unsigned int]':
/tmp/jsoncpp/src/lib_json/json_value.cpp:727:45:   required from here
/tmp/jsoncpp/src/lib_json/json_value.cpp:61:24: error: conversion to 'double' from 'long long unsigned int' may alter its value [-Werror=conversion]
cc1plus: some warnings being treated as errors
src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/build.make:86: recipe for target 'src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o' failed
make[2]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/tmp/jsoncpp/src/lib_json/json_writer.cpp: In member function 'bool Json::BuiltStyledStreamWriter::isMultineArray(const Json::Value&)':
/tmp/jsoncpp/src/lib_json/json_writer.cpp:1014:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   bool isMultiLine = size * 3 >= rightMargin_;
                      ~~~~~~~~~^~~~~~~~~~~~~~~

/tmp/jsoncpp/src/lib_json/json_writer.cpp:1034:45: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     isMultiLine = isMultiLine || lineLength >= rightMargin_;
                                  ~~~~~~~~~~~^~~~~~~~~~~~~~~

CMakeFiles/Makefile2:109: recipe for target 'src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/all' failed
make[1]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

@cinemast
Copy link
Contributor Author

cinemast commented Feb 7, 2016

Do you have a GCC6 installation available somewhere? GCC6 is available in Debian experimental.

cdunn2001 added a commit to cdunn2001/jsoncpp that referenced this issue Feb 7, 2016
See open-source-parsers#411 (comment)

I was unable to produce a warning in Clang, so I am not certain. But based on a [SO answer](http://stackoverflow.com/questions/25480059/gcc-conversion-warning-when-assigning-to-a-bitfield), I think I've fixed the following:
```
/tmp/jsoncpp/src/lib_json/json_value.cpp: In copy constructor 'Json::Value::CZString::CZString(const Json::Value::CZString&)':
/tmp/jsoncpp/src/lib_json/json_value.cpp:235:18: error: conversion to 'unsigned char:2' from 'unsigned int' may alter its value [-Werror=conversion]
   storage_.policy_ = (other.cstr_
                      ~~~~~~~~~~~~
                  ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      ? noDuplication : duplicate)
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  : static_cast<DuplicationPolicy>(other.storage_.policy_));
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
@cdunn2001
Copy link
Contributor

I don't have easy access to gcc-6. However, I was able to produce all but 1 of those errors via -Werror=xxx, and I think I've fixed the last one too. See #416.

@cdunn2001
Copy link
Contributor

Did those fixes work?

@cinemast
Copy link
Contributor Author

Hi Christopher!

Only partly, this one is still a problem:

/tmp/jsoncpp/src/lib_json/json_value.cpp:235:18: error: conversion to 'unsigned char:2' from 'unsigned int' may alter its value [-Werror=conversion]
   storage_.policy_ = (other.cstr_
                      ~~~~~~~~~~~~
                  ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      ? noDuplication : duplicate)
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  : static_cast<DuplicationPolicy>(other.storage_.policy_));

@cdunn2001 cdunn2001 self-assigned this Feb 23, 2016
cdunn2001 added a commit that referenced this issue Mar 14, 2016
@cdunn2001
Copy link
Contributor

Try again?

Or can you suggest a fix? We definitely need to assign an unsigned int into a 2-bit unsigned field.

ya1gaurav added a commit to ya1gaurav/jsoncpp that referenced this issue Mar 15, 2016
This patch is also needed to build success for GCC 6.0.
Refer issue - open-source-parsers#411
@cdunn2001
Copy link
Contributor

@cinemast, try again. @ya1gaurav has tested the tip of master.

@cinemast
Copy link
Contributor Author

Great! I can confirm it works.

@ya1gaurav
Copy link
Contributor

@cinemast Do you face GGC 6 issues in some other open source also ?

@cinemast
Copy link
Contributor Author

What exactly do you mean by that? In Debian there are currently lots of compile errors due to GCC6.

https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=ftbfs-gcc-6;[email protected]

@ya1gaurav
Copy link
Contributor

I mean I have setup for GCC 6.0, so I can try solving build issues related to GCC 6.0 in other open source softwares also.

@ya1gaurav
Copy link
Contributor

And now it seems - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=811958 got fixed.

@cinemast
Copy link
Contributor Author

Exactly :) I will just wait for the next release instead of patching manually.

@ya1gaurav
Copy link
Contributor

@cdunn2001 Could you help @cinemast with new release featuring GCC 6.0 support.

@cdunn2001 cdunn2001 reopened this Mar 18, 2016
@cdunn2001
Copy link
Contributor

Released and signed 1.7.0.

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

3 participants