Skip to content

cmake throws warning treated as error message when executed inside TravisCI #586

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
gigena-git opened this issue Mar 4, 2017 · 3 comments

Comments

@gigena-git
Copy link

I'm trying to use jsoncpp as part of my project. The end goal is to get the following files:

  • dist/jsoncpp.cpp (need to run python amalgamate.py)
  • dist/json/json.h (need to run python amalgamate.py)
  • dist/json/json-forwards.h (need to run python amalgamate.py)
  • src/lib_json/libjsoncpp.a (need to run cmake)

So, I have a .travis.yml file inside my repo (which will always run whenever I push to github) that looks like this:

---
language: java
sudo: true
jdk: oraclejdk8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
- george-edison55-precise-backports # cmake 3.2.3 / doxygen 1.8.3
packages:
- cmake
- cmake-data
- gcc-4.9
- g++-4.9
- clang-3.5
- valgrind
before_install:
- sudo apt-get -qq update
- git clone https://github.com/open-source-parsers/jsoncpp.git
- cd jsoncpp
- python amalgamate.py
- mkdir build
- cd build
- cmake ..
- make
script:
- cp src/lib_json/libjsoncpp.a /usr/local/lib/

The yaml runs perfectly up until the make statement (so I'm able to retrieve the first three files I need), but then it logs the following message:

$ make
Scanning dependencies of target jsoncpp_lib_static
[ 16%] 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
/home/travis/build/fire-d/testDemo/jsoncpp/src/lib_json/json_value.cpp: In copy constructor Json::Value::CZString::CZString(const Json::Value::CZString&)’:
/home/travis/build/fire-d/testDemo/jsoncpp/src/lib_json/json_value.cpp:273:78: error: conversion to unsigned char:2’ from ‘unsigned int’ may alter its value [-Werror=conversion]
cc1plus: some warnings being treated as errors
make[2]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o] Error 1
make[1]: *** [src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/all] Error 2
make: *** [all] Error 2
The command "make" failed and exited with 2 during .

Apparently, the build fails because these two warnings are treated as errors. I have also noticed that versions 4.9 of gcc and gpp are installed correctly, but I don't know if the compiler used is the one I am telling it to use.

Is there any way I can make the "warnings being treated as errors" message go away? Anyone had a similar problem with a similar build? Should I try a different approach to get src/lib_json/libjsoncpp.a? Thank you.

PD: Link to full log here.

@cdunn2001
Copy link
Contributor

@ya1gaurav, let's change the default. I don't think we can fix CZString without a major version bump. Could you submit a PR? (I'm just catching up from vacation.)

ya1gaurav added a commit to ya1gaurav/jsoncpp that referenced this issue Mar 10, 2017
PR for - open-source-parsers#586
Separating the default options for compiler flags.
@aakarsh
Copy link

aakarsh commented Mar 13, 2017

please do this. seeing this error too. Am able to compile fine without -W error on conversion flag

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

4 participants