morganstanley / hobbes

A language and an embedded JIT compiler

Home Page:http://hobbes.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build failure in MacOS with llvm6

jimmylikes opened this issue · comments

Hello experts,

I was trying to build the Hobbes in my laptop with different versions of llvms, I found there seems some interfaces gaps in llvm8 and llvm10 with current Hobbes, so I tried to use the llvm6 to do build, but still always got failure when the make tries to link the hobbies test or hi/hog, could you please help to show some lights on this ?

Here is my env status:
llvm : 6.0.1
cmake: 3.18.0
clang: 11.0.3

Here is the build log failures:
[ 40%] Linking CXX static library libhobbes.a
[ 40%] Built target hobbes
Scanning dependencies of target hobbes-test
[ 41%] Building CXX object CMakeFiles/hobbes-test.dir/test/Arrays.C.o
[ 41%] Building CXX object CMakeFiles/hobbes-test.dir/test/Compiler.C.o
[ 42%] Building CXX object CMakeFiles/hobbes-test.dir/test/Convert.C.o
[ 42%] Building CXX object CMakeFiles/hobbes-test.dir/test/Definitions.C.o
[ 43%] Building CXX object CMakeFiles/hobbes-test.dir/test/Existentials.C.o
^[[B[ 44%] Building CXX object CMakeFiles/hobbes-test.dir/test/Hog.C.o
[ 44%] Building CXX object CMakeFiles/hobbes-test.dir/test/MC.C.o
[ 45%] Building CXX object CMakeFiles/hobbes-test.dir/test/Main.C.o
[ 45%] Building CXX object CMakeFiles/hobbes-test.dir/test/Matching.C.o
[ 46%] Building CXX object CMakeFiles/hobbes-test.dir/test/Net.C.o
[ 46%] Building CXX object CMakeFiles/hobbes-test.dir/test/Objects.C.o
[ 47%] Building CXX object CMakeFiles/hobbes-test.dir/test/PREPL.C.o
[ 47%] Building CXX object CMakeFiles/hobbes-test.dir/test/Prelude.C.o
[ 48%] Building CXX object CMakeFiles/hobbes-test.dir/test/Python.C.o
[ 48%] Building CXX object CMakeFiles/hobbes-test.dir/test/Recursives.C.o
[ 49%] Building CXX object CMakeFiles/hobbes-test.dir/test/Storage.C.o
[ 49%] Building CXX object CMakeFiles/hobbes-test.dir/test/Structs.C.o
[ 50%] Building CXX object CMakeFiles/hobbes-test.dir/test/TypeInf.C.o
[ 50%] Building CXX object CMakeFiles/hobbes-test.dir/test/Variants.C.o
[ 51%] Linking CXX executable hobbes-test
Undefined symbols for architecture x86_64:
"typeinfo for llvm::CallbackVH", referenced from:
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(bindings.C.o)
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(jitcc.C.o)
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(cexpr.C.o)
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(signals.C.o)
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(dfa.C.o)
"typeinfo for llvm::JITEventListener", referenced from:
typeinfo for hobbes::LenWatch in libhobbes.a(jitcc.C.o)
"typeinfo for llvm::SectionMemoryManager", referenced from:
typeinfo for hobbes::jitmm in libhobbes.a(jitcc.C.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It looks like travis is able to build on OSX using llvm@6 (using clang-9). Not a macos expert here unfortunately, but can you run the following and compare your output against travis output?

$ export DEPS="${DEPS} readline llvm@6"
$ export LLVM_DIR=/usr/local/opt/llvm@6/lib/cmake/llvm/
$ export CXX=${CXX:-clang++}
$ export CXX_FOR_BUILD=${CXX_FOR_BUILD:-clang++}
$ export CC=${CC:-clang}
$ export CC_FOR_BUILD=${CC_FOR_BUILD:-clang}

$ brew update && brew install -v ${DEPS} && find /usr/local/opt/llvm@6/ | grep cmake;

$ mkdir build && cd build/ && cmake .. && make && make test

Thanks for your quick feedback, I tried the commands as you suggest. Unfortunetely I got error when run home-brew install, I assume this should not be as expected, any ideas, please?

hobbes-master % brew install -v ${DEPS}
hobbes-master % brew install -v ${DEPS}
Error: No available formula with the name " readline llvm@6"
==> Searching for a previously deleted formula (in the last month)...
readline llvm@6 was deleted from homebrew/core in commit 4a992dc515:
wpscan: delete (https://github.com/Homebrew/homebrew-core/issues/59328)==> Searching for a previously deleted formula (in the last month)...
readline llvm@6 was deleted from homebrew/core in commit 4a992dc515:
wpscan: delete (Homebrew/homebrew-core#59328)

I tried to run left commands to make and build, seems still got the same errors:
[ 51%] Linking CXX executable hobbes-test
Undefined symbols for architecture x86_64:
"llvm::DisableABIBreakingChecks", referenced from:
llvm::VerifyDisableABIBreakingChecks in Arrays.C.o
llvm::VerifyDisableABIBreakingChecks in Compiler.C.o
llvm::VerifyDisableABIBreakingChecks in Definitions.C.o
llvm::VerifyDisableABIBreakingChecks in Existentials.C.o
llvm::VerifyDisableABIBreakingChecks in Hog.C.o
llvm::VerifyDisableABIBreakingChecks in MC.C.o
llvm::VerifyDisableABIBreakingChecks in Matching.C.o
...
"typeinfo for llvm::CallbackVH", referenced from:
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(bindings.C.o)
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(jitcc.C.o)
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(cexpr.C.o)
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(signals.C.o)
typeinfo for llvm::ValueMapCallbackVH<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex > > in libhobbes.a(dfa.C.o)
"typeinfo for llvm::JITEventListener", referenced from:
typeinfo for hobbes::LenWatch in libhobbes.a(jitcc.C.o)
"typeinfo for llvm::SectionMemoryManager", referenced from:
typeinfo for hobbes::jitmm in libhobbes.a(jitcc.C.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [hobbes-test] Error 1
make[1]: *** [CMakeFiles/hobbes-test.dir/all] Error 2

Hi jimmy!

That’s a strange formula name, “ readline llvm@6”, maybe two dependencies are getting joined there?

It looks like homebrew still supports 6:
https://formulae.brew.sh/formula/llvm@6#default

Providence also has a nice way to install through nix if you’re interested in trying that path (I think it’s a little more reliable than brew).

Those errors about undefined typeinfo values at link time look like an issue with LLVM not being built with RTTI enabled. Since hobbes uses RTTI (to make some cases of C++ type binding work), it makes that assumption about LLVM as well.

Hi Kthielen,

Thanks for your suggestions on the RTTI for LLVM building, I tired to remove the brew llvm and download the official llvm6 and do build myself, turn on the option for LLVM_ENABLE_RTTI, then do the Hobbes build again, it works!

Thanks for your help, appreciate it.