gadomski / cpd

C++ implementation of the Coherent Point Drift point set registration algorithm.
http://www.gadom.ski/cpd
GNU General Public License v2.0
385 stars 122 forks source link

Problem when building with jsoncpp #105

Closed alexsmartens closed 7 years ago

alexsmartens commented 7 years ago

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 commented 7 years ago

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.

alexsmartens commented 7 years ago

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 commented 7 years ago

Install jsoncpp (might be apt-get install libjsoncpp-dev) then try again.

On Thu, Mar 16, 2017 at 9:27 AM, Alex Martens notifications@github.com wrote:

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?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/gadomski/cpd/issues/105#issuecomment-287093620, or mute the thread https://github.com/notifications/unsubscribe-auth/AADjyjd5IpxEOnlSxC7tbhPADZAFyr40ks5rmVT7gaJpZM4Meqxm .

alexsmartens commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

$ 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 commented 7 years ago

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 4d04c927154b6cb9c1da2dd74ba2a73cc5391448.

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 commented 7 years ago

@alexsmartens are you still having this issue?

alexsmartens commented 7 years ago

Yes, I do

2017-03-28 6:48 GMT-06:00 Pete Gadomski notifications@github.com:

@alexsmartens https://github.com/alexsmartens are you still having this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gadomski/cpd/issues/105#issuecomment-289758601, or mute the thread https://github.com/notifications/unsubscribe-auth/AZC40ktspNtOp3S6xZIYnf3TQlZDMknIks5rqQGNgaJpZM4Meqxm .

gadomski commented 7 years ago

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

alexsmartens commented 7 years ago

Yes, reinstallation of jsoncpp has not helped

gadomski commented 7 years ago

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

alexsmartens commented 7 years ago

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