C++ Cmake can't find "libc10.so.1.8.0"

Hi,

I have 2 separate cmake files, one for my development project and one for my unit testing w/ Boost.Test. I followed the instructions in the docs for the development cmake file and it works flawlessly. However, I am trying to build a separate Cmake file for my unit testing and I keep seeing the following error, I am pulling the TWS API in as well:

Cmake Error in CmdLine:

CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Caffe2/Caffe2Targets.cmake:116 (message):
The imported target “c10” references the file

 "/usr/lib/lib/libc10.so.1.8.0"

but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.

  • An install or uninstall procedure did not complete successfully.

  • The installation package was faulty and contained

    “/usr/lib/x86_64-linux-gnu/cmake/Caffe2/Caffe2Targets.cmake”

but not all the files it references.

Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/Caffe2/Caffe2Config.cmake:116 (include)
/usr/lib/x86_64-linux-gnu/cmake/Torch/TorchConfig.cmake:68 (find_package)
CMakeLists.txt:4 (find_package)

– Configuring incomplete, errors occurred!
Error: could not load cache

My CMake File:

cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(myProject/tests)

find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}”)
find_package(Boost REQUIRED COMPONENTS unit_test_framework)

set(TWS_SOURCE “~/TWS_API/IBJts/source/cppclient/client”)

file(GLOB SOURCES .cpp ${TWS_SOURCE}/.cpp)
file(GLOB TEST_SOURCES “Test_*.cpp”)

include_directories(${TWS_SOURCE})
include_directories(“~/TWS_API/IBJts/source/cppclient/”)

foreach(TEST_SOURCE ${TEST_SOURCES})
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)

add_executable(${TEST_NAME} ${TEST_SOURCE})

target_link_libraries(${TEST_NAME} PRIVATE Boost::unit_test_framework ${TORCH_LIBRARIES})
target_include_directories(${TEST_NAME} PRIVATE ${TORCH_INCLUDE_DIRS})

add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})

endforeach()

runtests.sh file to build and run the test_suite

if [ ! -d “build” ]; then
mkdir -p build
fi
cd build
cmake -DCMAKE_PREFIX_PATH=~/libtorch …
cmake --build . --config Release
if [ $? -eq 0 ]; then
clear
ctest
fi

Any help would be appreciated!

Thanks,
Brendan

$ sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/lib

Since libc10.so.1.8.0 is located in /usr/lib/x86…, making a soft link solves the problem