1

I would like to add a 3rd party lib (called taco) to my project. In the CMakeLists.txt of my project I did the following:

FetchContent_Declare(
  taco
  GIT_REPOSITORY https://github.com/tensor-compiler/taco.git
  GIT_TAG master
)
FetchContent_MakeAvailable(taco)

When compiling, the compiler complains

[ 48%] Building CXX object _deps/taco-build/src/CMakeFiles/taco.dir/lower/tensor_path.cpp.o
/home/miaodi/repo/mfemMechanics/release/_deps/taco-src/src/lower/lowerer_impl_imperative.cpp: In member function ‘std::vector<taco::ir::Stmt> taco::LowererImplImperative::constructInnerLoopCasePreamble(taco::ir::Expr, taco::IndexVar, taco::MergeLattice, std::map<taco::Iterator, taco::ir::Expr>&)’:
/home/miaodi/repo/mfemMechanics/release/_deps/taco-src/src/lower/lowerer_impl_imperative.cpp:1935:21: error: reference to ‘conjunction’ is ambiguous
 1935 |       nonZeroCase = conjunction({coordComparisons[i], valueComparisons[i]});
      |                     ^~~~~~~~~~~
In file included from /home/miaodi/repo/mfemMechanics/release/_deps/taco-src/src/lower/lowerer_impl_imperative.cpp:12:
/home/miaodi/repo/mfemMechanics/release/_deps/taco-src/include/taco/ir/ir_generators.h:20:6: note: candidates are: ‘taco::ir::Expr taco::ir::conjunction(std::vector<taco::ir::Expr>)’
   20 | Expr conjunction(std::vector<Expr> exprs);
      |      ^~~~~~~~~~~
In file included from /usr/include/c++/9/bits/move.h:55,
                 from /usr/include/c++/9/bits/stl_pair.h:59,
                 from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/vector:60,
                 from /home/miaodi/repo/mfemMechanics/release/_deps/taco-src/include/taco/lower/mode_format_impl.h:4,
                 from /home/miaodi/repo/mfemMechanics/release/_deps/taco-src/include/taco/lower/mode_format_compressed.h:4,
                 from /home/miaodi/repo/mfemMechanics/release/_deps/taco-src/src/lower/lowerer_impl_imperative.cpp:1:
/usr/include/c++/9/type_traits:155:12: note:                 ‘template<class ... _Bn> struct std::conjunction’
  155 |     struct conjunction
      |            ^~~~~~~~~~~

If I build this library (taco) without using FetchContent_Declare (mkdir build && cd build && cmake ..), this issue won't show up.

After I fixed this by adding the scope 'taco::ir::' to conjunction, I got the second issue:

/home/miaodi/repo/mfemMechanics/release/_deps/taco-src/tools/taco.cpp:35:10: fatal error: taco/version.h: No such file or directory
   35 | #include "taco/version.h"
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [_deps/taco-build/tools/CMakeFiles/taco-tool.dir/build.make:76: _deps/taco-build/tools/CMakeFiles/taco-tool.dir/taco.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:889: _deps/taco-build/tools/CMakeFiles/taco-tool.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

which also does not happen when I compile it without using FetchContent_Declare.

My question is: how can I fix these issues without touching the source code?

Di Miao
  • 206
  • 2
  • 7

0 Answers0