Hello
I am noob to LLVM/MLIR. I am trying to get into MLIR world for last couple of days. And members from this community are helping me a lot. I am really grateful to all.
I am getting these errors (in tons… ) while I am trying to build the MLIR standalone template
ld.lld: error: undefined symbol: __asan_set_shadow_f5
....
ld.lld: error: undefined symbol: __asan_version_mismatch_check_v8
...
ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
[14/19] Building CXX object standalone...tandalone-opt.dir/standalone-opt.cpp.o
ninja: build stopped: subcommand failed.
What I understood from the error is, linker (ld.lld
) cannot find the definitions for certain symbols that are referenced in the code. And this kind of stuff typically happens when there is a mismatch between the declarations and the definitions of functions, variables, or classes.
But I don’t know where to look for it, and where to make changes.
So now let me tell you, how my dev env is designed and setup
- Downloaded llvm-project prebuilt binaries for 16.0.0 version and added them to
$PATH
. I am using the binslld
,clang
to build the llvm-project. - Built
llvm-project
of version16.x
with followingcmake
config
cmake \
-G Ninja \
-S ../llvm \
-B . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=../installation \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_PROJECTS="mlir;clang;lldb" \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_ENABLE_LLD=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_PARALLEL_LINK_JOBS=1 \
-DLLVM_TARGETS_TO_BUILD="Native;NVPTX" \
-DLLVM_CACHE_BUILD=ON \
-DLLVM_USE_SANITIZER="Address;Undefined" \
-DMLIR_INCLUDE_INTEGRATION_TESTS=ON \
-DLLVM_BUILD_EXAMPLE=ON \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_INCLUDE_TESTS=ON \
-DMLIR_INCLUDE_TESTS=ON
- For MLIR standalone template, I copied it from cloned
llvm-project/mlir/examples/standalone/* to someplace outside of MLIR project
~/compiler-projects/learn/mlir-standalone/. I am using the following
cmake` config
# Where I build llvm-project
export LLVM_PROJECT_ROOT=~/compiler-projects/learn/mlir-intro
export BUILD_DIR=$LLVM_PROJECT_ROOT/build
export PREFIX=$LLVM_PROJECT_ROOT/installation/lib/cmake/mlir
cmake \
-G Ninja \
-S ../ \
-B . \
-DCMAKE_BUILD_TYPE=Release \
-DMLIR_DIR=$PREFIX \
-DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_PARALLEL_LINK_JOBS=1 \
-DLLVM_ENABLE_LLD=ON
cmake --build . --target check-standalone
- Even if I try to build mlir-standalone template inside the
llvm-project
(i.e. herellvm-project/mlir/examples/standalone/
), it is still being ended up with the same error.
Now, What can I do to solve it? Your suggestions, advises are greatly appreciated.
Thanks in advance!