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

Compiler error - Ubuntu 16.04 #594

Open
BenoitGeslain opened this issue Dec 11, 2018 · 6 comments
Open

Compiler error - Ubuntu 16.04 #594

BenoitGeslain opened this issue Dec 11, 2018 · 6 comments

Comments

@BenoitGeslain
Copy link

I'm getting this error while compiling OSVR from source following this guide.
On make, I get this:

In file included from /home/isir/Documents/OSVR-Core/devtools/osvr_json_to_c.cpp:33:0:
/usr/local/include/json/writer.h:352:45: error: ‘PrecisionType’ is not a class or namespace
               PrecisionType precisionType = PrecisionType::significantDigits);

OS: Ubuntu 16.04
cmake: version 3.13.0-rc3
Compiler: GNU 5.4.0

@godbyk
Copy link
Contributor

godbyk commented Dec 11, 2018

Can you run make VERBOSE=1 and paste the compiler command as well? I want to make sure that it's compiling with -std=c++11 (or newer).

@BenoitGeslain
Copy link
Author

Here is the result for make VERBOSE=1
I also included the result for the whole command as a log file.

It doesn't seem like it's compiling with -std=c++11. Should I add the flag myself?

cd /home/isir/Documents/OSVR-Core/build/devtools && /usr/bin/c++   -isystem /usr/local/include  -O2 -g -DNDEBUG   -o CMakeFiles/osvr_json_to_c.dir/osvr_json_to_c.cpp.o -c /home/isir/Documents/OSVR-Core/devtools/osvr_json_to_c.cpp
In file included from /home/isir/Documents/OSVR-Core/devtools/osvr_json_to_c.cpp:33:0:
/usr/local/include/json/writer.h:352:45: error: ‘PrecisionType’ is not a class or namespace
               PrecisionType precisionType = PrecisionType::significantDigits);
                                             ^
/home/isir/Documents/OSVR-Core/devtools/osvr_json_to_c.cpp: In function ‘void convertJsonToLiteral(const string&, std::istream&, std::ostream&)’:
/home/isir/Documents/OSVR-Core/devtools/osvr_json_to_c.cpp:65:18: warning: ‘Json::Reader::Reader()’ is deprecated: Use CharReader and CharReaderBuilder instead [-Wdeprecated-declarations]
     Json::Reader reader;
                  ^
In file included from /home/isir/Documents/OSVR-Core/devtools/osvr_json_to_c.cpp:32:0:
/usr/local/include/json/reader.h:56:3: note: declared here
   Reader();
   ^
/home/isir/Documents/OSVR-Core/devtools/osvr_json_to_c.cpp:72:22: warning: ‘FastWriter’ is deprecated: Use StreamWriterBuilder instead [-Wdeprecated-declarations]
     Json::FastWriter writer;
                      ^
In file included from /home/isir/Documents/OSVR-Core/devtools/osvr_json_to_c.cpp:33:0:
/usr/local/include/json/writer.h:168:70: note: declared here
 class JSONCPP_DEPRECATED("Use StreamWriterBuilder instead") JSON_API FastWriter
                                                                      ^
devtools/CMakeFiles/osvr_json_to_c.dir/build.make:62: recipe for target 'devtools/CMakeFiles/osvr_json_to_c.dir/osvr_json_to_c.cpp.o' failed
make[2]: *** [devtools/CMakeFiles/osvr_json_to_c.dir/osvr_json_to_c.cpp.o] Error 1
make[2]: Leaving directory '/home/isir/Documents/OSVR-Core/build'
CMakeFiles/Makefile2:1617: recipe for target 'devtools/CMakeFiles/osvr_json_to_c.dir/all' failed
make[1]: *** [devtools/CMakeFiles/osvr_json_to_c.dir/all] Error 2
make[1]: Leaving directory '/home/isir/Documents/OSVR-Core/build'
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

log.txt

@godbyk
Copy link
Contributor

godbyk commented Dec 13, 2018

I installed Ubuntu 16.04 on a virtual machine to test this out. I used g++ version 5.4.0 and libjsoncpp-dev version 1.7.2—both from the Ubuntu repositories—and it compiled successfully for me (without the -std=c++11 flag).

Which versions of g++ and jsoncpp are you using?

@BenoitGeslain
Copy link
Author

gcc version 5.4.0 20160609
I'm not sure about the jsoncpp version I'm using, I thought it was a submodule but I can't seem to find it , if it's not I'm using the current master version of the repo.

@rpavlik
Copy link
Member

rpavlik commented Dec 19, 2018

Fwiw, Travis ci is now doing the same thing. (There is a submodule of vrpn but we don't use it, iirc)
https://travis-ci.org/OSVR/OSVR-Core/jobs/469323721

Assuming this is an API break in jsoncpp (or a bug there) - did they go to version 2? Pretty sure 0.y.z and 1.x worked last time I checked.

@godbyk
Copy link
Contributor

godbyk commented Dec 19, 2018

@rpavlik That's odd. Travis CI is building with jsoncpp version 1.8.4. When I build within my VM, I used that same branch and everything worked okay.

My guess is that the master branch of jsoncpp is using newer C++ features that gcc 5.4.0 doesn't yet support.

@BenoitGeslain Instead of using the master branch of jsoncpp, try checking out and building the 1.8.4 branch and building OSVR against that.

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