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

Problem when building with jsoncpp #105

Closed
alexsmartens opened this issue Mar 15, 2017 · 13 comments · Fixed by #111
Closed

Problem when building with jsoncpp #105

alexsmartens opened this issue Mar 15, 2017 · 13 comments · Fixed by #111
Assignees
Labels

Comments

@alexsmartens
Copy link

I've built CPD on my laptop, now I am also trying to build it on my PC. I go along the same path, and I get the successful build. But at the same time compiling the example gives me the following error:

$ cmake .
-- The CXX compiler identification is GNU 5.4.0
-- 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
CMake Error at /usr/local/lib/cmake/cpd/cpd-config.cmake:66 (include):
include could not find load file:

/usr/local/lib/cmake/cpd/cpd-jsoncpp-targets.cmake

Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)

CMake Error at /usr/local/lib/cmake/cpd/cpd-config.cmake:37 (find_package):
By not providing "Findjsoncpp.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "jsoncpp", but
CMake did not find one.

Could not find a package configuration file provided by "jsoncpp" with any
of the following names:

jsoncppConfig.cmake
jsoncpp-config.cmake

Add the installation prefix of "jsoncpp" to CMAKE_PREFIX_PATH or set
"jsoncpp_DIR" to a directory containing one of the above files. If
"jsoncpp" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
/usr/local/lib/cmake/cpd/cpd-config.cmake:67 (find_dependency)
CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/alex/Downloads/libraries/cpd-master/examples/Untitled Folder/CMakeFiles/CMakeOutput.log".

I've also noticed that I have different installation messages when I build CPD on the PC (it does not include jsoncpp):
$ sudo make install
[ 33%] Built target Library-C
[ 40%] Built target gtest
[ 46%] Built target gtest_main
[ 53%] Built target nonrigid-test
[ 60%] Built target normalization-test
[ 66%] Built target gauss_transform-test
[ 73%] Built target affine-test
[ 80%] Built target rigid-test
[ 86%] Built target utils-test
[ 93%] Built target version-test
[100%] Built target gauss_transform_fgt-test
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/cmake/cpd/cpd-config.cmake
-- Installing: /usr/local/lib/cmake/cpd/cpd-config-version.cmake
-- Installing: /usr/local/lib/libcpd.so.0.5.0
-- Up-to-date: /usr/local/lib/libcpd.so.0
-- Up-to-date: /usr/local/lib/libcpd.so
-- Set runtime path of "/usr/local/lib/libcpd.so.0.5.0" to ""
-- Up-to-date: /usr/local/include/cpd
-- Up-to-date: /usr/local/include/cpd/affine.hpp
-- Up-to-date: /usr/local/include/cpd/rigid.hpp
-- Up-to-date: /usr/local/include/cpd/version.hpp
-- Up-to-date: /usr/local/include/cpd/transform.hpp
-- Up-to-date: /usr/local/include/cpd/gauss_transform_fgt.hpp
-- Up-to-date: /usr/local/include/cpd/nonrigid.hpp
-- Up-to-date: /usr/local/include/cpd/gauss_transform.hpp
-- Up-to-date: /usr/local/include/cpd/matrix.hpp
-- Up-to-date: /usr/local/include/cpd/normalization.hpp
-- Up-to-date: /usr/local/include/cpd/utils.hpp
-- Installing: /usr/local/lib/cmake/cpd/cpd-targets.cmake
-- Installing: /usr/local/lib/cmake/cpd/cpd-targets-noconfig.cmake

Might it be the problem of linking jsoncpp? Or it's something else?

@gadomski
Copy link
Owner

To build the examples, cpd must be built with jsoncpp support because the rigid example prints the result as json. On your Windows system, you will need to build and install with jsoncpp (cmake -DWITH_JSONCPP=ON); then the examples should work.

I'm going to leave this open for a moment while I add a README to the examples directory explaining that jsoncpp is required.

@gadomski gadomski self-assigned this Mar 16, 2017
@alexsmartens
Copy link
Author

I have Ubuntu on my PC. Tried to do cmake -DWITH_JSONCPP=ON ..
and I still have an error with JSONCPP, cannot figure out how to deal with it

$ cmake -DWITH_JSONCPP=ON ..
CMake Error at CMakeLists.txt:120 (find_package):
By not providing "Findjsoncpp.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "jsoncpp", but
CMake did not find one.

Could not find a package configuration file provided by "jsoncpp" with any
of the following names:

jsoncppConfig.cmake
jsoncpp-config.cmake

Add the installation prefix of "jsoncpp" to CMAKE_PREFIX_PATH or set
"jsoncpp_DIR" to a directory containing one of the above files. If
"jsoncpp" provides a separate development package or SDK, be sure it has
been installed.

-- Configuring incomplete, errors occurred!
See also "/home/alex/Downloads/libraries/cpd-master/build/CMakeFiles/CMakeOutput.log".
See also "/home/alex/Downloads/libraries/cpd-master/build/CMakeFiles/CMakeError.log".

What do you think?

@gadomski
Copy link
Owner

gadomski commented Mar 16, 2017 via email

@alexsmartens
Copy link
Author

I've tried installing libjsoncpp. Still have the problem with linking the jsoncpp library
What do you think?

$ cmake -DWITH_JSONCPP=ON ..
-- The CXX compiler identification is GNU 5.4.0
-- 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
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0")
-- The C compiler identification is GNU 5.4.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
-- Found PythonInterp: /usr/bin/python (found version "2.7.12")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.11")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/Downloads/libraries/cpd-master/build

$ make
Scanning dependencies of target Library-C
[ 2%] Building CXX object CMakeFiles/Library-C .dir/src/affine.cpp.o
[ 5%] Building CXX object CMakeFiles/Library-C .dir/src/gauss_transform.cpp.o
[ 8%] Building CXX object CMakeFiles/Library-C .dir/src/nonrigid.cpp.o
[ 11%] Building CXX object CMakeFiles/Library-C .dir/src/normalization.cpp.o
[ 14%] Building CXX object CMakeFiles/Library-C .dir/src/rigid.cpp.o
[ 17%] Building CXX object CMakeFiles/Library-C .dir/src/transform.cpp.o
[ 20%] Building CXX object CMakeFiles/Library-C .dir/src/utils.cpp.o
[ 23%] Building CXX object CMakeFiles/Library-C .dir/src/version.cpp.o
[ 26%] Building CXX object CMakeFiles/Library-C .dir/src/gauss_transform_fgt.cpp.o
[ 29%] Linking CXX shared library libcpd.so
[ 29%] Built target Library-C
Scanning dependencies of target gtest
[ 32%] Building CXX object vendor/googletest-release-1.8.0/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 35%] Linking CXX shared library libgtest.so
[ 35%] Built target gtest
Scanning dependencies of target gtest_main
[ 38%] Building CXX object vendor/googletest-release-1.8.0/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 41%] Linking CXX shared library libgtest_main.so
[ 41%] Built target gtest_main
Scanning dependencies of target nonrigid-test
[ 44%] Building CXX object tests/CMakeFiles/nonrigid-test.dir/nonrigid.cpp.o
[ 47%] Linking CXX executable nonrigid
[ 47%] Built target nonrigid-test
Scanning dependencies of target normalization-test
[ 50%] Building CXX object tests/CMakeFiles/normalization-test.dir/normalization.cpp.o
[ 52%] Linking CXX executable normalization
[ 52%] Built target normalization-test
Scanning dependencies of target gauss_transform-test
[ 55%] Building CXX object tests/CMakeFiles/gauss_transform-test.dir/gauss_transform.cpp.o
[ 58%] Linking CXX executable gauss_transform
[ 58%] Built target gauss_transform-test
Scanning dependencies of target affine-test
[ 61%] Building CXX object tests/CMakeFiles/affine-test.dir/affine.cpp.o
[ 64%] Linking CXX executable affine
[ 64%] Built target affine-test
Scanning dependencies of target rigid-test
[ 67%] Building CXX object tests/CMakeFiles/rigid-test.dir/rigid.cpp.o
[ 70%] Linking CXX executable rigid
[ 70%] Built target rigid-test
Scanning dependencies of target utils-test
[ 73%] Building CXX object tests/CMakeFiles/utils-test.dir/utils.cpp.o
[ 76%] Linking CXX executable utils
[ 76%] Built target utils-test
Scanning dependencies of target version-test
[ 79%] Building CXX object tests/CMakeFiles/version-test.dir/version.cpp.o
[ 82%] Linking CXX executable version
[ 82%] Built target version-test
Scanning dependencies of target gauss_transform_fgt-test
[ 85%] Building CXX object tests/CMakeFiles/gauss_transform_fgt-test.dir/gauss_transform_fgt.cpp.o
[ 88%] Linking CXX executable gauss_transform_fgt
[ 88%] Built target gauss_transform_fgt-test
Scanning dependencies of target Jsoncpp
[ 91%] Building CXX object components/jsoncpp/CMakeFiles/Jsoncpp.dir/src/jsoncpp.cpp.o
[ 94%] Linking CXX shared library libcpd-jsoncpp.so
[ 94%] Built target Jsoncpp
Scanning dependencies of target jsoncpp-test
[ 97%] Building CXX object components/jsoncpp/tests/CMakeFiles/jsoncpp-test.dir/jsoncpp.cpp.o
[100%] Linking CXX executable jsoncpp
../libcpd-jsoncpp.so.0.5.0: undefined reference to `Json::Value::Value(unsigned long)'
collect2: error: ld returned 1 exit status
components/jsoncpp/tests/CMakeFiles/jsoncpp-test.dir/build.make:100: recipe for target 'components/jsoncpp/tests/jsoncpp' failed
make[2]: *** [components/jsoncpp/tests/jsoncpp] Error 1
CMakeFiles/Makefile2:652: recipe for target 'components/jsoncpp/tests/CMakeFiles/jsoncpp-test.dir/all' failed
make[1]: *** [components/jsoncpp/tests/CMakeFiles/jsoncpp-test.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

@gadomski
Copy link
Owner

Can you check your jsoncpp version and report it back to this ticket? One way would be:

grep JSONCPP_VERSION_STRING /usr/include/json/version.h

You might have to adjust the file path depending on where jsoncpp is installed.

@alexsmartens
Copy link
Author

alexsmartens commented Mar 16, 2017

$ grep JSONCPP_VERSION_STRING /usr/include/json/version.h
grep: /usr/include/json/version.h: No such file or directory

$ dpkg -l 'json'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
-==============-============-============-=================================
ii gir1.2-json-1. 1.1.2-0ubunt amd64 GLib JSON manipulation library (i
ii libjson-c-dev: 0.11-4ubuntu amd64 JSON manipulation library - devel
ii libjson-c2:amd 0.11-4ubuntu amd64 JSON manipulation library - share
ii libjson-glib-1 1.1.2-0ubunt amd64 GLib JSON manipulation library
ii libjson-glib-1 1.1.2-0ubunt all GLib JSON manipulation library (c
un libjson-pp-per (no description available)
un libjson-rpc-pe (no description available)
ii libjson0:amd64 0.11-4ubuntu amd64 JSON manipulation library (transi
ii libjson0-dev:a 0.11-4ubuntu amd64 JSON manipulation library (transi
ii libjsoncpp-dev 1.7.2-1 amd64 library for reading and writing J
ii libjsoncpp1:am 1.7.2-1 amd64 library for reading and writing J
un libmono-facade (no description available)
ii libmono-system 4.2.1.102 df all Mono System.Json.Microsoft librar
un libmono-system (no description available)
ii libmono-system 4.2.1.102 df all Mono System.Json library (for CLI
ii libunity-scope 7.1.4 16.04. all binding to get places into the la
un unity-scopes-j (no description available)

@gadomski gadomski changed the title Build problem Problem when building with jsoncpp Mar 16, 2017
@gadomski gadomski added bug and removed enhancement labels Mar 20, 2017
@gadomski
Copy link
Owner

I just built jsoncpp version 1.7.2 on Ubuntu Trusty (14.04.5 LTS) and things were ok. I did have to ensure that I built jsoncpp with JSONCPP_WITH_CMAKE_PACKAGE=ON and BUILD_SHARED_LIBS=ON. I added a note about this to the README in 4d04c92.

If you can take the following steps and let me know if you continue to have issues:

  1. Uninstall apt's jsoncpp
  2. Download and install your own jsoncpp (with the options specified above)
  3. Build cpd

If you have errors, let me know, but hopefully that'll work for you.

@gadomski
Copy link
Owner

@alexsmartens are you still having this issue?

@alexsmartens
Copy link
Author

alexsmartens commented Mar 28, 2017 via email

@gadomski
Copy link
Owner

gadomski commented Apr 3, 2017

Even after uninstalling Ubuntu's jsoncpp and building and installing your own?

gadomski added a commit that referenced this issue Apr 3, 2017
Adds cmake variables `CPD_WITH_FGT` and `CPD_WITH_JSONCPP` and updates
the examples cmake to use these variables.

Fixes #105.
@alexsmartens
Copy link
Author

Yes, reinstallation of jsoncpp has not helped

@gadomski
Copy link
Owner

gadomski commented Apr 3, 2017

Did you try my new branch better-jsoncpp-install?

@alexsmartens
Copy link
Author

I ended up with reinstalling Ubuntu (16.04). It looks like now everything works
The issue probably can be closed

@gadomski gadomski closed this as completed Apr 4, 2017
gadomski added a commit that referenced this issue Apr 4, 2017
Adds cmake variables `CPD_WITH_FGT` and `CPD_WITH_JSONCPP` and updates
the examples cmake to use these variables.

Fixes #105.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants