Errors compiling c++ torch frontend with Boost library

Hi there,
I’m having issues with compiling a c++ code with the torch c++ (libtorch) frontend with libboost.
Specifically, I was trying to compile the minimal torch c++ example code with a few boost headers included.
I was able to compile it with libtorch or boost alone, but not together.
See my code below:

#include <torch/torch.h>
#include <iostream>
#include <boost/program_options.hpp>
#include <boost/tokenizer.hpp>
#include <boost/heap/pairing_heap.hpp>
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>

using boost::heap::pairing_heap;
using boost::heap::compare;
using boost::unordered_map;

int main() {
  namespace po = boost::program_options; 
	// Declare the supported options.
	po::options_description desc("Allowed options");
  torch::Tensor tensor = torch::rand({2, 3});
  std::cout << tensor << std::endl;
}

Also this is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(test) 

find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

find_package( Boost 1.49.0 REQUIRED COMPONENTS program_options system filesystem)
include_directories( ${Boost_DIR} )
include_directories( ${Boost_INCLUDE_DIRS} )

add_executable(test test.cpp)
target_link_libraries(test "${Boost_LIBRARIES}")
target_link_libraries(test "${TORCH_LIBRARIES}")

I’ve tried using gcc 8.3.0/gcc 11.3.0, libtorch Pre-cxx11 ABI / cxx11 ABI versions.
All the errors I got are either related to GLIBC or undefined references to some boost functions:

[taoanhua@discovery2 build]$ make
[ 50%] Building CXX object CMakeFiles/test.dir/test.cpp.o
[100%] Linking CXX executable test
CMakeFiles/test.dir/test.cpp.o: In function `main':
test.cpp:(.text+0x11c): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
/home1/taoanhua/.conda/envs/RL-LNS-test/lib/libboost_program_options.so.1.82.0: undefined reference to `std::__throw_bad_array_new_length()@GLIBCXX_3.4.29'
collect2: error: ld returned 1 exit status
make[2]: *** [test] Error 1
make[1]: *** [CMakeFiles/test.dir/all] Error 2
make: *** [all] Error 2

And also this:

[taoanhua@discovery2 build]$ make
[ 50%] Building CXX object CMakeFiles/test.dir/test.cpp.o
[100%] Linking CXX executable test
/project/dilkina_438/taoanhua/RL-LNS/libtorch/lib/libtorch_cpu.so: undefined reference to `powf@GLIBC_2.27'
/project/dilkina_438/taoanhua/RL-LNS/libtorch/lib/libtorch_cpu.so: undefined reference to `log2f@GLIBC_2.27'
/project/dilkina_438/taoanhua/RL-LNS/libtorch/lib/libtorch_cpu.so: undefined reference to `lgammaf@GLIBC_2.23'
/project/dilkina_438/taoanhua/RL-LNS/libtorch/lib/libtorch_cpu.so: undefined reference to `expf@GLIBC_2.27'
/project/dilkina_438/taoanhua/RL-LNS/libtorch/lib/libtorch_cpu.so: undefined reference to `exp2f@GLIBC_2.27'
/project/dilkina_438/taoanhua/RL-LNS/libtorch/lib/libtorch_cpu.so: undefined reference to `lgamma@GLIBC_2.23'
/project/dilkina_438/taoanhua/RL-LNS/libtorch/lib/libtorch_cpu.so: undefined reference to `logf@GLIBC_2.27'
collect2: error: ld returned 1 exit status
make[2]: *** [test] Error 1
make[1]: *** [CMakeFiles/test.dir/all] Error 2
make: *** [all] Error 2

I would appreciate it if anyone has experienced these issues before and could help with resolving it. Thanks!