OSVR / OSVR-Core

The core libraries, applications, and plugins of the OSVR software platform.
Apache License 2.0
328 stars 124 forks source link

Build errors with any recent version of JsonCpp or OpenCV on Linux #414

Open valentindavid opened 8 years ago

valentindavid commented 8 years ago

Here is an example of error message:

make[2]: *** No rule to make target 'jsoncpp_lib-NOTFOUND', needed by 'bin/osvr_json_to_c'.  Stop.
CMakeFiles/Makefile2:1451: recipe for target 'devtools/CMakeFiles/osvr_json_to_c.dir/all' failed

It failed for me on both Debian Sid and Gentoo.

Both OpenCV and JsonCpp provide cmake scripts that use build types. Those cmake files are generated and may depends on the version of cmake used when installing them (>= 3.3 perhaps).

It seems MapImportedReleaseVariants causes issues since it will disable the build types used by the cmake scripts. Moving find_package of JsonCpp and OpenCV before include of MapImportedReleaseVariants solves the issue.

rpavlik commented 8 years ago

MapImportedReleaseVariants isn't supposed to disable the build types, it's supposed to compensate for the fact that nobody ever builds and ships all four distinct build types (correction: 5 build types on makefile-style generators, since "None" is a build type there, but not, say, in Visual Studio where you're forced to pick from a list), yet in most cases, you can use 1 or 2 (max - Visual C++ uses a different, incompatible runtime/settings for full Debug builds vs. everything else) builds to satisfy all types.

I'm not terribly surprised that MapImportedReleaseVariants is interacting poorly with those libraries now, though it is a bummer, since I'm pretty sure jsoncpp is why I wrote that in the first place - I've already had to move some libraries above it already. Can you just double-check and make sure this still happens on the master branch, from a totally clean build directory? (I committed some fixes to the JsonCpp finder script, which does use the jsoncpp config modules if they're made available, but it doesn't always work the smoothest in an earlier build tree, and this honestly looks like FindJsonCpp getting confused.)

Of course, it could be that's what I get for pulling off onto Debian Jessie instead of staying pointed upstream... Haven't used Gentoo personally, but I know there are community members (on the chat and elsewhere on Github) that use Arch, which I think shares a similar "keep it up to date" rolling release mentality.

We may need a more targeted version of MapImportedReleaseVariants - it's the "axe" version (using cmake variables that affect all imported targets created after it), whereas we could do a target-by-target "scalpel" equivalent (setting target properties to do equivalent) which might be required if the same behavior that breaks newer Linux releases is needed to keep Windows building.

Conzar commented 8 years ago

I have just written a script that compiles and installs OSVR-Core on Ubuntu 14.04. It heavily relies on PPAs in order to get the latest CMAKE, gcc and g++. Its only using opencv from the ubuntu repos so perhaps this doesn't work on later versions of Ubuntu. I will create a vagrant environment (in the repo) and test this out on multiple Ubuntu's which will certainly have more update to date opencv versions.

Conzar commented 8 years ago

I have added to the osvr-core-ubuntu-build-script project a test suite environment. The following OS's are tested:

The test environment leverages vagrant to do the following:

All OS's passed the test and compile.

This test suite might be helpful for tracking down problems with other distros like gentoo, redhat, etc. Note, the install script will need to be changed or perhaps create a new install script for the OS family.

ppaalanen commented 8 years ago

Hi,

here's a me too:

I cloned OSVR-Core fresh for the first time ever, and tried to build it, failing at

[ 10%] Building CXX object devtools/CMakeFiles/osvr_json_to_c.dir/osvr_json_to_c.cpp.o
make[2]: *** No rule to make target 'jsoncpp_lib-NOTFOUND', needed by 'bin/osvr_json_to_c'.  Stop.
CMakeFiles/Makefile2:1579: recipe for target 'devtools/CMakeFiles/osvr_json_to_c.dir/all' failed
make[1]: *** [devtools/CMakeFiles/osvr_json_to_c.dir/all] Error 2

This is on Gentoo with dev-libs/jsoncpp-1.7.3. Earlier when running cmake, it reports -- Found JsonCpp: /usr/lib64/cmake/jsoncpp.

So, I uninstalled jsoncpp from Gentoo and built it manually like suggested in https://github.com/OSVR/OSVR-Docs/blob/master/Getting-Started/Installing/Linux-Build-Instructions.md and now it works.

Then I hit the same issue with OpenCV...

[ 32%] Building CXX object plugins/opencv/CMakeFiles/com_osvr_VideoCapture_OpenCV.dir/com_osvr_VideoCapture_OpenCV.cpp.o
make[2]: *** No rule to make target 'opencv_core-NOTFOUND', needed by 'lib64/osvr-plugins-0/com_osvr_VideoCapture_OpenCV.manualload.so'.  Stop.
CMakeFiles/Makefile2:3039: recipe for target 'plugins/opencv/CMakeFiles/com_osvr_VideoCapture_OpenCV.dir/all' failed
make[1]: *** [plugins/opencv/CMakeFiles/com_osvr_VideoCapture_OpenCV.dir/all] Error 2

Needless to say, OpenCV 3.1.0 has been installed as a Gentoo package. cmake is version 3.3.1 and I just installed OpenCV today, so cmake version has not changed.

Then I did what @valentindavid suggested and just moved the find_package(opencv) line up.

scpeters commented 8 years ago

For ubuntu/debian, installing libjsoncpp-dev instead of building from source may get around this error. This depends on which version is required (#58) and should be added to the installation instructions (#305).

scpeters commented 8 years ago

Actually, I still need to move the find_package(JsonCpp REQUIRED) above include(MapImportedReleaseVariants), as the others have suggested.

toastedcrumpets commented 7 years ago

Can you just double-check and make sure this still happens on the master branch, from a totally clean build directory?

Just confirming that I'm running into this issue on a clean build of the current master/deployed branch (0cae00952a4badf1f22642473370d5e7962467b6) on Ubuntu 16.04.

The proposed fix of moving find_package(JsonCpp REQUIRED) (as in the commit to my fork above) does resolve this issue for me. How can I help move this issue along?

rpavlik commented 7 years ago

Iirc, I think I have a pull request open that improves/fixes the build on 16.04 using the system provided jsoncpp, if you want to test it and verify.

On Sun, Oct 16, 2016, 4:17 PM Marcus Bannerman notifications@github.com wrote:

Can you just double-check and make sure this still happens on the master branch, from a totally clean build directory?

Just confirming that I'm running into this issue on a clean build of the current master/deployed branch (0cae009 https://github.com/OSVR/OSVR-Core/commit/0cae00952a4badf1f22642473370d5e7962467b6) on Ubuntu 16.04.

The proposed fix of moving find_package(JsonCpp REQUIRED) (as in the commit to my fork above) does resolve this issue for me. How can I help move this issue along?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OSVR/OSVR-Core/issues/414#issuecomment-254075649, or mute the thread https://github.com/notifications/unsubscribe-auth/AADuyUa2LrLDruj-bhKO6hEwYEDqJeHHks5q0pR7gaJpZM4H-olI .

Ryan A. Pavlik, Ph.D. CTO - OSVR Platform Sensics, Inc. www.sensics.com

Latest news and blog posts (subscribe here http://sensics.com/subscribe-to-our-mailing-list/ to get weekly updates):

Oct 14: Peeking inside the Goggles for Public VR http://sensics.com/goggles-public-vr-pre-production-run/

Sep 13: Why WebVR? http://sensics.com/why-webvr/

Aug 30: TechCrunch: VR from the battlefield to the couch and back https://techcrunch.com/2016/08/30/vr-on-the-battlefield-to-the-couch-and-back-again-sort-of/

toastedcrumpets commented 7 years ago

So this bug is closely related to issue #458 and is resolved by pull request #482? I've checked out the proposed pull request and it certainly fixes this issue for me, so I think either this issue or #458 can be closed.