Libtorch conflict with other lib

username: DongkyuLee
cooked: <p>Hi</p>
<p>I’m making some code which is using various libs(libtorch, casadi, etc…)</p>
<p>However, now I face a problem.</p>
<p>There is conflict, when I use libtorch and casadi both.</p>
<p>I faced similar error before(conflict with ROS), I installed CXX11 ABI version libtorch and solved it.</p>
<p>Is it similar case?? If yes, how should I do to build casadi lib which isn’t conflict with libtorch.</p>
<p>Please let me know anybody have solution for this.</p>
<p>Thanks.</p>
<p>P.S. Here is the error outputs<br>
[main] Building folder: test_casadi<br>
[build] Starting build<br>
[proc] Executing command: /usr/local/bin/cmake --build /home/ldk/my_code/normal/test_casadi/build --config Release --target all –<br>
[build] [1/2  50% :: 7.435] Building CXX object CMakeFiles/test_casadi.dir/src/main.cpp.o<br>
[build] FAILED: CMakeFiles/test_casadi.dir/src/main.cpp.o<br>
[build] /usr/bin/g+±9  -I/home/ldk/my_code/normal/test_casadi/src -isystem /usr/local/include/opencv4 -isystem /home/ldk/libtorch/include -isystem /home/ldk/libtorch/include/torch/csrc/api/include -isystem /usr/local/cuda/include -O3 -DNDEBUG -D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++17 -MD -MT CMakeFiles/test_casadi.dir/src/main.cpp.o -MF CMakeFiles/test_casadi.dir/src/main.cpp.o.d -o CMakeFiles/test_casadi.dir/src/main.cpp.o -c /home/ldk/my_code/normal/test_casadi/src/main.cpp<br>
[build] In file included from /home/ldk/libtorch/include/c10/util/Logging.h:28,<br>
[build]                  from /home/ldk/libtorch/include/c10/core/TensorImpl.h:19,<br>
[build]                  from /home/ldk/libtorch/include/ATen/core/TensorBody.h:13,<br>
[build]                  from /home/ldk/libtorch/include/ATen/Tensor.h:3,<br>
[build]                  from /home/ldk/libtorch/include/ATen/Context.h:4,<br>
[build]                  from /home/ldk/libtorch/include/ATen/ATen.h:9,<br>
[build]                  from /home/ldk/libtorch/include/torch/csrc/api/include/torch/types.h:3,<br>
[build]                  from /home/ldk/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,<br>
[build]                  from /home/ldk/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,<br>
[build]                  from /home/ldk/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,<br>
[build]                  from /home/ldk/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,<br>
[build]                  from /home/ldk/libtorch/include/torch/csrc/api/include/torch/data.h:3,<br>
[build]                  from /home/ldk/libtorch/include/torch/csrc/api/include/torch/all.h:8,<br>
[build]                  from /home/ldk/libtorch/include/torch/csrc/api/include/torch/torch.h:3,<br>
[build]                  from /home/ldk/my_code/normal/test_casadi/src/main.cpp:8:<br>
[build] /home/ldk/libtorch/include/c10/util/logging_is_not_google_glog.h:225:22: error: redefinition of ‘template&lt;class First, class Second&gt; std::ostream&amp; std::operator&lt;&lt;(std::ostream&amp;, const std::pair&lt;_T1, _T2&gt;&amp;)’<br>
[build]   225 | inline std::ostream&amp; operator&lt;&lt;(<br>
[build]       |                      ^~~~~~~~<br>
[build] In file included from /usr/local/include/casadi/core/matrix_fwd.hpp:29,<br>
[build]                  from /usr/local/include/casadi/core/sx_elem.hpp:33,<br>
[build]                  from /usr/local/include/casadi/core/core.hpp:30,<br>
[build]                  from /usr/local/include/casadi/casadi.hpp:29,<br>
[build]                  from /home/ldk/my_code/normal/test_casadi/src/main.cpp:5:<br>
[build] /usr/local/include/casadi/core/casadi_misc.hpp:476:12: note: ‘template&lt;class T1, class T2&gt; std::ostream&amp; std::operator&lt;&lt;(std::ostream&amp;, const std::pair&lt;_T1, _T2&gt;&amp;)’ previously declared here<br>
[build]   476 |   ostream&amp; operator&lt;&lt;(ostream&amp; stream, const pair&lt;T1, T2&gt;&amp; p) {<br>
[build]       |            ^~~~~~~~<br>
[build] ninja: build stopped: subcommand failed.<br>
[proc] The command: /usr/local/bin/cmake --build /home/ldk/my_code/normal/test_casadi/build --config Release --target all – exited with code: 1<br>
[driver] Build completed: 00:00:07.458<br>
[build] Build finished with exit code 1</p>

username: chenpengyu2000222
cooked: <p>I got the same question. Have you solve this problem yet?</p>