The opencv and torch problem continues to persist with the libtorch that comes torch installed via pip. I use conan as my package manager for most packages, so naturally i install opencv via conan. But when i try to link both torch installed via pip (cmake … -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'
…) and opencv from conan i get the usual error that everyone faces. I need to specify in my conan profile the cxx flag CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 which builds opencv without the cxx11 abi and then everything compiles as expected. I have seen many threads that suggest to use the libtorch cpp package from the site with abi libtorch-cxx11-abi-shared-with-deps (see Library conflict between libtorch and opencv? - #8 by lzl_jnu), but i like the idea of using the libtorch that comes with pip, it would reduce duplicates of the package. I was wondering why the libtorch that comes torch pip is not compile with -D_GLIBCXX_USE_CXX11_ABI=1 ? I use opencv/4.8.1 (conan) and torch==2.4.0 (pip). My conan profile for the curious:
[settings]
os=Linux
arch=x86_64
compiler=gcc
compiler.version=11
compiler.libcxx=libstdc++11
compiler.cppstd=17
build_type=Release
[options]
[tool_requires]
[buildenv]
CC=/usr/bin/gcc-11
CXX=/usr/bin/g++-11
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0 # I need it for the moment to tell conan to install opencv withouth cxx abi
As you can see i am pretty up to date with gcc version and all. So just curious, is it a miss that the libtorch packaged with torch pip is not the one installed with abi, or is it because it would break something?