morganstanley / hobbes

A language and an embedded JIT compiler
http://hobbes.readthedocs.io/
Apache License 2.0
1.16k stars 105 forks source link

Revert "move llvm include to end of search path to prevent cxxabi.h c… #427

Closed mo-xiaoming closed 2 years ago

mo-xiaoming commented 2 years ago

…onflicts (#425)"

PR #425 adds llvm headers by -idirafter to make them lowest priority in path search, however this introduces a new problem

in this case, the search order is

#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/9/include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include                             <<-- llvm-dev version 10, wrong headers
 /home/ubuntu/llvm-12.0.1/install/include <<-- here is the correct path
End of search list.

compiler will use llvm10's header file, and link against llvm12's lib, which causes undefined reference linking error

It occurs to me that with multiple (versions?) of toolchains mixed together, there is no (easy?) way to cover all permutations

I'm thinking of making CMakeLists.txt as simple as possible, and just covers most common cases might not be the worst idea