Installing kim-api from source

Hello,

I am new to Open KIM and am trying to install the KIM-API to use KLIFF. I am trying to build from v2.2.1 from source, however I can’t seem to get it to work

Below are the steps I performed on my cluster

mkdir kim-api && cd kim-api
wget https://s3.openkim.org/kim-api/kim-api-2.2.1.txz
tar -Jxf kim-api-2.2.1.txz && cd kim-api-2.2.1
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD
make
make install
make test (all the tests pass!)
source bin/kim-api-activate

I cant do sudo ldconfig, in lieu of that I have a module file that appends the below variables

|prepend-path| PATH /home/kavalurav//kim-api/kim-api-2.2.1/build/utils |
|---|---|
|prepend-path| LD_LIBRARY_PATH /home/kavalurav//kim-api/kim-api-2.2.1/build:/home/kavalurav//kim-api/kim-api-2.2.1/build/lib64/:/home/kavalurav//kim-api/kim-api-2.2.1/build/libexec |
|prepend-path| LIBRARY_PATH /home/kavalurav//kim-api/kim-api-2.2.1/build:/home/kavalurav//kim-api/kim-api-2.2.1/build/lib64/:/home/kavalurav//kim-api/kim-api-2.2.1/build/libexec |
|prepend-path| PKG_CONFIG_PATH /home/kavalurav//kim-api/kim-api-2.2.1/build/pkg-config |
|prepend-path| CPLUS_INCLUDE_PATH /home/kavalurav//kim-api/kim-api-2.2.1/cpp/include|

However, when I try to run
kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_006 I get errors about missing files, I am slowly working through them, so far I have done this from the build dir/install directory

cp cmake/CMakeFiles/Export/share/cmake/kim-api/kim-api-targets.cmake cmake
cp ../cmake/item-info.txt.in cmake
cp cmake/build-tree-package-config-files-items/item-wrapper.cpp.in cmake

However, now I am stuck on

[kavalurav@scfocus18 build]$ kim-api-collections-management install user SW_StillingerWeber_1985_Si__MO_405512056662_006
Downloading.............. SW_StillingerWeber_1985_Si__MO_405512056662_006
CMake Warning at /lstr/home/kavalurav/kim-api/kim-api-2.2.1/build/cmake/kim-api-pre-2.2-compatibility.cmake:51 (message):
  

  Pre 2.2.0 KIM-API package behavior is deprecated and will be removed in
  3.0.0.  Please update your CMakeLists.txt file to use a find_package()
  signature similar to one of the following:

     find_package(KIM-API 2.2 REQUIRED CONFIG)
     find_package(KIM-API-ITEMS 2.2 REQUIRED CONFIG)

  See the examples in the KIM API source package for more details.

Call Stack (most recent call first):
  /lstr/home/kavalurav/kim-api/kim-api-2.2.1/build/cmake/kim-api-config.cmake:52 (include)
  CMakeLists.txt:37 (find_package)


-- The CXX compiler identification is GNU 8.2.0
-- The C compiler identification is GNU 8.2.0
-- The Fortran compiler identification is GNU 8.2.0
-- Check for working CXX compiler: /usr/nic/compiler/gcc/8.2/bin/c++
-- Check for working CXX compiler: /usr/nic/compiler/gcc/8.2/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/nic/compiler/gcc/8.2/bin/gcc
-- Check for working C compiler: /usr/nic/compiler/gcc/8.2/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working Fortran compiler: /usr/nic/compiler/gcc/8.2/bin/gfortran
-- Check for working Fortran compiler: /usr/nic/compiler/gcc/8.2/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/nic/compiler/gcc/8.2/bin/gfortran supports Fortran 90
-- Checking whether /usr/nic/compiler/gcc/8.2/bin/gfortran supports Fortran 90 -- yes
-- Found xxd: (/bin/xxd)
CMake Error at /lstr/home/kavalurav/kim-api/kim-api-2.2.1/build/cmake/kim-api-items-macros.cmake:673 (message):
  Unable to locate 'collections-info' utility
Call Stack (most recent call first):
  /lstr/home/kavalurav/kim-api/kim-api-2.2.1/build/cmake/kim-api-items-macros.cmake:814 (_determine_collection_install_prefix_and_output_name)
  /lstr/home/kavalurav/kim-api/kim-api-2.2.1/build/cmake/kim-api-items-macros.cmake:114 (_add_kim_api_library)
  /lstr/home/kavalurav/kim-api/kim-api-2.2.1/build/cmake/kim-api-pre-2.2-compatibility.cmake:82 (add_kim_api_model_library_pre22)
  CMakeLists.txt:47 (add_kim_api_model_library)


-- Configuring incomplete, errors occurred!
See also "/tmp/kavalurav/kim-api-build-y2bNN94oSy/SW_StillingerWeber_1985_Si__MO_405512056662_006/build/CMakeFiles/CMakeOutput.log".

Aborting!

I am clearly missing some step, would appreciate any insight!

Hello,

I believe that installing directly into the build directory is causing some sort of problem:

Please try adjusting this line (and updating the rest of your settings accordingly) to something like:

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/install

Ryan

Hi Ryan,

Thanks for the prompt reply! That resolved it. I am not entirely sure what the underlying issue is because there is no overlapping files/directories in the build and install directories that could be getting overwritten, however I guess its not a good practice to have build and install directories point to the same location.

build dir

[kavalurav@scfocus18 build]$ ls
c                 CMakeDoxygenDefaults.cmake  cpp                  examples              kim-api-configuration-detailed.log  libkim-api.so.2.2.1  utils
cmake             CMakeFiles                  CTestTestfile.cmake  fortran               kim-api-configuration-summary.log   Makefile
CMakeCache.txt    cmake_install.cmake         docs                 install               libkim-api.so                       pkg-config
CMakeDoxyfile.in  completions                 editors              install_manifest.txt  libkim-api.so.2                     Testing

install dir

[kavalurav@scfocus18 build]$ ls install
bin  etc  include  lib64  libexec  share

Thanks!
Aditya