AFLplusplus: Build error with old LLVM versions

Look at the xenial-arm64 Travis build:

afl-llvm-pass.so.cc:39:10: fatal error: 'llvm/IR/DebugInfo.h' file not found

#include "llvm/IR/DebugInfo.h"

Seems that with old LLVM the header is `llvm/DebugInfo.h".

Note that this header is not included in original AFL, so probably we broken the compatibility woth LLVM < 3.7. I say 3.7 cause is the first version with the header inside IR that I’ve found googling.

This needs more investigation, as a quick fix I added

#include <llvm/Config/llvm-config.h>

#if (LLVM_VERSION_MAJOR <= 3) && (LLVM_VERSION_MINOR < 7)
#include <llvm/DebugInfo.h>
#else
#include <llvm/IR/DebugInfo.h>
#endif

But I’m not sure about the LLVM version.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@hexcoder- for travis I set hard:

LLVM_CONFIG=llvm-config-6.0

The LLVM config file lies in:

/usr/include/llvm-6.0/llvm/Config/llvm-config.h

and now llvm_mode works: https://travis-ci.com/vanhauser-thc/AFLplusplus/jobs/289760791

A fix can be also to decide to not support these LLVM versions and fix Travis. IMO this is the most reasonable fix, @vanhauser-thc you should verify the llvm-config that Travis is using and maybe set a proper LLVM_CONFIG for LLVM 6.