Undefined symbol SmallVectorBase

Hello and thanks for reading this.
I’ve been using Torchscrip for a C++ projet for 1 month now. I don’t know what i’ve done but suddenty i can’t execute my code. I have created another small project simpler for this topic.

Here is my cmake

cmake_minimum_required(VERSION 3.0)

project(aanet)

# add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

set(CMAKE_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0")
set(Torch_DIR ${CMAKE_SOURCE_DIR}/libtorch/share/cmake/Torch)
find_package(Torch REQUIRED)

add_executable(${PROJECT_NAME} main.cpp)

target_link_libraries(${PROJECT_NAME} "${TORCH_LIBRARIES}")

set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)

my code

#include <torch/torch.h>
#include <iostream>

int main() {
  torch::Tensor tensor = torch::rand({2, 3});
  std::cout << tensor << std::endl;
}

cmake …

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- 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  
-- Found Torch: libtorch/lib/libtorch.so  
-- Configuring done
-- Generating done
-- Build files have been written to: build

make

Consolidate compiler generated dependencies of target myproject
[ 50%] Linking CXX executable myproject
[100%] Built target myproject

./myproject

./myproject: symbol lookup error: ./myproject: undefined symbol: _ZN3c1015SmallVectorBaseIjE8grow_podEPvmm

I tested all the version of libtorch and all have the same problem.

I would be very grateful if someone can help me. I am blocked for 2 days on this and i m totally lost.

Thank you :slight_smile: !

Probleme résolu. L’executable C++ utilisait la lib python qui était dans une version différente de celle utilisait par cmake