Error when compiling glow on Ubuntu 18.04

It seems llvm headers are not in the include path even though I provide the -DLLVM_DIR path to LLVM config i.e /lib/cmake/llvm

Are there other options I need to provide to enable llvm include headers are correctly sourced ?

When I run ninja all, I get errors like

glow/include/glow/Graph/PlaceholderBindings.h:44:36: error: no template named 'StringMap' in namespace 'llvm'
  using PlaceholderNameMap = llvm::StringMap<Placeholder *>;

I had ran cmake as follows
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug …/glow -DLLVM_DIR=<path/to/llvm>/local/lib/cmake/llvm

I interpret the error differently: it looks like your version of LLVM is not the version needed by Glow (as it is complaining StringMap is missing, not that the header is missing.)

Sure. Basically, I had verified that the necessary header llvm/ADT/StringMap.h is present in my llvm path and the file does have StringMap symbol defined inside llvm namespace. Hence, I feel the issue is perhaps, the header file path is not correctly setup. When I look at the CC commands, I see -isystem <llvm/include/path> - is this sufficient ? I was expecting it should have been - -I<llvm/include/path> ?

(btw, I am using llvm 9.0)

Looks like glow/include/glow/Quantization/Base/Base.h is using llvm::StringMap without including header file for it.

When I explicitly added "#include “llvm/ADT/StringMap.h” to this file, I was able to compile. But there are few other such files as well. So I am not sure the right place to add this include to address all these files depending on it.

Thanks for catching this @yetanadur – I’d suggest just adding it to the file if it uses StringMap. Better to have dependences listed explicitly anyway. Feel free to put up a PR with a fix :slight_smile: