colin-daniels / sp2

Computational condensed matter research code written in C++. Primary applications relate to low-dimensional carbon nanomaterials, phonons, and structural optimization.
0 stars 0 forks source link

Trouble building in ubuntu 20.04 #28

Open ExpHP opened 3 years ago

ExpHP commented 3 years ago

Commands run

sudo apt install cmake libopenmpi-dev libboost-all-dev libfreetype-dev

git clone https://github.com/colin-daniels/sp2
cd sp2

python3 -m venv venv
. ./venv/bin/activate
python3 -m pip install wheel
python3 -m pip install -r <(grep numpy requirements.txt)
python3 -m pip install -r requirements.txt

mkdir build
cd build

cmake .. -DCMAKE_BUILD_TYPE=Release

Versions

   $ cmake --version
cmake version 3.16.3
   $ mpic++ --version
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
   $ grep 'e BOOST_LIB_VERSION' /usr/include/boost/version.hpp
#define BOOST_LIB_VERSION "1_71"
   $ python3 --version
Python 3.8.10

What happens

cmake generates a large number of warnings that look like this:

CMake Warning (dev) at deps/boost-mpi/CMakeLists.txt:24 (target_link_libraries):
  Policy CMP0079 is not set: target_link_libraries allows use with targets in
  other directories.  Run "cmake --help-policy CMP0079" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target

    project-deps

  is not created in this directory.  For compatibility with older versions of
  CMake, link library

    /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so

  will be looked up in the directory in which the target was created rather
  than in this calling directory.
This warning is for project developers.  Use -Wno-dev to suppress it.

until finally the following occurs:

-- Performing Test SP2_CAN_HASH_ENUM
-- Performing Test SP2_CAN_HASH_ENUM - Success
-- VERSION: sp2_VERSION
-- VERSION: 0.1
-- Configuring done
CMake Error at src/CMakeLists.txt:192 (add_executable):
  Target "sp2" links to target "Boost::mpi" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?

CMake Error at src/CMakeLists.txt:192 (add_executable):
  Target "sp2" links to target "Boost::serialization" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at src/CMakeLists.txt:192 (add_executable):
  Target "sp2" links to target "Boost::mpi" but the target was not found.
  Perhaps a find_package() call is missing for an IMPORTED target, or an
  ALIAS target is missing?

CMake Error at src/CMakeLists.txt:192 (add_executable):
  Target "sp2" links to target "Boost::serialization" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

Full CMake output

Full cmake output ``` -- The CXX compiler identification is GNU 9.3.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 MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version "3.1") -- Found MPI: TRUE (found version "3.1") -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: mpi serialization CMake Warning (dev) at deps/boost-mpi/CMakeLists.txt:24 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at deps/boost-mpi/CMakeLists.txt:24 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at deps/boost-mpi/CMakeLists.txt:24 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library Boost::mpi will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at deps/boost-mpi/CMakeLists.txt:24 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library Boost::serialization will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. Cloning into 'cxxopts-src'... Note: switching to 'v2.2.0'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at e6858d3 Add to changelog for #170 -- cxxopts version 2.2.0 -- The C compiler identification is GNU 9.3.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 CMake Warning (dev) at deps/cxxopts/CMakeLists.txt:12 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library cxxopts will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. Cloning into 'jsoncpp-src'... Note: switching to '1.8.3'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 2de1802 Merge pull request #655 from cdunn2001/fix-649 -- JsonCpp Version: 1.8.3 -- Looking for C++ include clocale -- Looking for C++ include clocale - found -- Looking for localeconv -- Looking for localeconv - found -- Looking for C++ include sys/types.h -- Looking for C++ include sys/types.h - found -- Looking for C++ include stdint.h -- Looking for C++ include stdint.h - found -- Looking for C++ include stddef.h -- Looking for C++ include stddef.h - found -- Check size of lconv -- Check size of lconv - done -- Performing Test HAVE_DECIMAL_POINT -- Performing Test HAVE_DECIMAL_POINT - Success CMake Warning (dev) at deps/jsoncpp/CMakeLists.txt:16 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library jsoncpp_lib_static will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5") CMake Warning (dev) at deps/lammps/CMakeLists.txt:81 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library lammps will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. -- Found PythonInterp: /home/exp/asd/clone/thpages/sp2/venv/bin/python3 (found suitable version "3.8.10", minimum required is "3") -- Found PYMOD_PHONOPY: /home/exp/asd/clone/thpages/sp2/venv/lib/python3.8/site-packages/phonopy -- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so (found suitable version "3.8.10", minimum required is "3") -- Found NumPy: /home/exp/asd/clone/thpages/sp2/venv/lib/python3.8/site-packages/numpy/core/include (found version "1.16.4") CMake Warning (dev) at deps/python/CMakeLists.txt:8 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library /usr/lib/x86_64-linux-gnu/libpython3.8.so will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at deps/randutils/CMakeLists.txt:9 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library randutils will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. Cloning into 'templ-src'... Note: switching to '5c2dd1d36b107cbeb5fc46a99b5775bbee355cad'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 5c2dd1d Standardized some names in basic.hpp, added is_reference_wrapper and ic. -- Performing Test TEMPL_CAN_DEDUCT_SELECT -- Performing Test TEMPL_CAN_DEDUCT_SELECT - Success CMake Warning (dev) at deps/templ/CMakeLists.txt:11 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library templ will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. Cloning into 'yaml-cpp-src'... Note: switching to 'yaml-cpp-0.6.3'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 9a36242 Update version to 0.6.3. -- Performing Test FLAG_WEXTRA -- Performing Test FLAG_WEXTRA - Success -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- 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 CMake Warning (dev) at deps/yaml-cpp/CMakeLists.txt:15 (target_link_libraries): Policy CMP0079 is not set: target_link_libraries allows use with targets in other directories. Run "cmake --help-policy CMP0079" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Target project-deps is not created in this directory. For compatibility with older versions of CMake, link library yaml-cpp will be looked up in the directory in which the target was created rather than in this calling directory. This warning is for project developers. Use -Wno-dev to suppress it. -- Performing Test SP2_CAN_HASH_ENUM -- Performing Test SP2_CAN_HASH_ENUM - Success -- VERSION: sp2_VERSION -- VERSION: 0.1 -- Configuring done CMake Error at src/CMakeLists.txt:192 (add_executable): Target "sp2" links to target "Boost::mpi" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? CMake Error at src/CMakeLists.txt:192 (add_executable): Target "sp2" links to target "Boost::serialization" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? CMake Error at src/CMakeLists.txt:192 (add_executable): Target "sp2" links to target "Boost::mpi" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? CMake Error at src/CMakeLists.txt:192 (add_executable): Target "sp2" links to target "Boost::serialization" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? -- Generating done CMake Generate step failed. Build files cannot be regenerated correctly. ```

Further details

I'm not sure that the warnings are actually related to the final error; I tried adding

cmake_policy(SET CMP0079 OLD)

to the CMakeLists.txt and this eliminates most of the warnings, but not the Boost errors that prevent compilation.

ExpHP commented 3 years ago

Tried upgrading to cmake 3.20, as well as downgrading to cmake 3.8 (the lowest version that supports CXX17). No dice with either. (same error message)

colin-daniels commented 3 years ago

Hmm, I'll take a look at this tomorrow. Doesn't totally surprise me that there are issues, since I didn't do the greatest job of pinning versions and CMake doesn't exactly make this easy.

ExpHP commented 3 years ago

Thanks. I also forgot to mention that I am on WSL 2.

(Which is a surprisingly reliable environment for linux, and has yet to present me with any unique challenges for building or installing anything with the exception of perf. gcc -dumpmachine identifies the target as x86_64-linux-gnu)