Hi all,
I would like to report a build issue when linking an application that uses both libtorch and boost.
tensor_test.cpp:
#include <boost/program_options/options_description.hpp>

int main() {
    boost::program_options::options_description d("");
}

CMakeLists.txt:
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(torch_example)

set(Torch_DIR "${CMAKE_SOURCE_DIR}/libtorch/share/cmake/Torch")
set(Caffe2_DIR "${CMAKE_SOURCE_DIR}/libtorch/share/cmake/Caffe2")
find_package(Torch REQUIRED)

message(STATUS ${TORCH_LIBRARIES})

find_package(Boost COMPONENTS program_options REQUIRED)

add_executable(main tensor_test.cpp)
target_link_libraries(main Boost::program_options ${TORCH_LIBRARIES})

set_property(TARGET main PROPERTY CXX_STANDARD 11)

This is the link error I get:
Scanning dependencies of target main
[ 50%] Building CXX object CMakeFiles/main.dir/tensor_test.cpp.o
[100%] Linking CXX executable main
CMakeFiles/main.dir/tensor_test.cpp.o: In function `main':
tensor_test.cpp:(.text+0x6b): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'

When removing the ${TORCH_LIBRARIES} variable from target_link_libraries linking works correctly.
The same issue arises with other shared libraries.
I guess this is a similar issue to the one reported here:

  
    
    
    Compile libtorch with pcl cause segmentation fault 
  
  
    I try to compile libtorch with PCL library. Both the libraries work fine when compiled dependently, but segmentation fault occurs when complie these libraries together. 

cmake file:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(custom_ops)
SET(CMAKE_BUILD_TYPE "Debug")

list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libtorch)

find_package(Torch REQUIRED)
find_package(PCL 1.8 REQUIRED COMPONENTS common io visualization)

include_directories(
        ${PCL_INCLUDE_DIRS}
)

…
  


I am on Ubuntu18.04 and I am using libtorch 1.0.0.dev20181022, boost 1.65.1