Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM回归测试-error:use of unknown builtin '__builtin_malloc' #17

Open
xijing21 opened this issue Jun 3, 2021 · 7 comments
Open

Comments

@xijing21
Copy link

xijing21 commented Jun 3, 2021

在按照https://github.com/mollybuild/RISCV-Measurement/blob/master/Build-RISCV-LLVM-and-run-testsuite.md执行测试任务时报错。

测试源码:https://github.com/plctlab/llvm-project.git
测试分支:origin/rvv-iscas
commit id:c360b611314ec39777487d050af6daa24eae811c

测试步骤:


$ git clone https://github.com/plctlab/llvm-project.git

$ cd llvm-project

$ mkdir build && cd build

$ cmake -DLLVM_PARALLEL_LINK_JOBS=3 -DLLVM_TARGETS_TO_BUILD="X86;RISCV" -DLLVM_ENABLE_PROJECTS="clang" -G Ninja ../llvm

$ ninja

$ ninja check  

在执行ninja check的时候,出现issue 16错误;

忽略此错误,继续执行:参考https://llvm.org/docs/TestSuiteGuide.html继续:

xj@e2ba8bd04169:~/RISCV/llvm-project/build$ ./bin/llvm-lit --version
lit 0.12.0dev
xj@e2ba8bd04169:~/RISCV/llvm-project/build$ cd ..
xj@e2ba8bd04169:~/RISCV/llvm-project$  git clone https://github.com/llvm/llvm-test-suite.git test-suite

xj@e2ba8bd04169:~/RISCV/llvm-project$  cd test-suite
xj@e2ba8bd04169:~/RISCV/llvm-project$  mkdir build  && cd build

xj@e2ba8bd04169:~/RISCV/llvm-project/test-suite$  cmake -DCMAKE_C_COMPILER=/home/xj/RISCV/llvm-project/build/bin/clang -C../test-suite/cmake/caches/O3.cmake ../test-suite
loading initial cache file ../test-suite/cmake/caches/O3.cmake
-- The C compiler identification is Clang 12.0.0
-- The CXX compiler identification is Clang 12.0.0
-- Check for working C compiler: /home/xj/RISCV/llvm-project/build/bin/clang
-- Check for working C compiler: /home/xj/RISCV/llvm-project/build/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/xj/RISCV/llvm-project/build/bin/clang++
-- Check for working CXX compiler: /home/xj/RISCV/llvm-project/build/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:71 (message):
  In-source builds are not allowed.

  CMake would overwrite the makefiles distributed with LLVM.

  Please create a directory and run cmake from there, passing the path

  to this source directory as the last argument.

  This process created the file `CMakeCache.txt' and the directory
  `CMakeFiles'.

  Please delete them.

-- Configuring incomplete, errors occurred!
See also "/home/xj/RISCV/llvm-project/test-suite/CMakeFiles/CMakeOutput.log".

按照提示修改:

xj@e2ba8bd04169:~/RISCV/llvm-project/test-suite$  rm -rf CMakeFiles  && rm CMakeCache.txt


xj@e2ba8bd04169:~/RISCV/llvm-project/test-suite/build$  cmake -DCMAKE_C_COMPILER=/home/xj/RISCV/llvm-project/build/bin/clang -C../../test-suite/cmake/caches/O3.cmake ../../test-suite

cmake成功,按照操作指导中的【注意事项】进行修改,除了
image

改了执行报错,又改回去了。

继续执行make:

xj@e2ba8bd04169:~/RISCV/llvm-project/test-suite/build$ make
报错:
image

@xijing21
Copy link
Author

xijing21 commented Jun 3, 2021

补充下,以上执行make之前的~/RISCV/llvm-project/test-suite/build/CMakeCache.txt
image

@xijing21
Copy link
Author

xijing21 commented Jun 3, 2021

llvm/llvm-project.git 上make test-suite也在同样的位置报错:

image

@xijing21
Copy link
Author

xijing21 commented Jun 3, 2021

llvm/llvm-project.git 上make test-suite也在同样的位置报错:

image

这里我自己的原因,犯了错误,编译的指定错了路径

@xijing21
Copy link
Author

xijing21 commented Jun 3, 2021

同样的问题参考:#15

@lazyparser
Copy link
Member

good
所有的过程就这么多积累issues的记录。

注意尽量截图之后把里面的内容也文字形式贴出来,方便后人检索。

类似 make 或者 ninja 的工作可以使用

make-or-other-command 2>&1 | tee make-log-DATE.txt

保留一份。之后可以使用 pastebinit 之类的小工具直接上传到类似 paste.ubuntu.com 这样的站点。提供一个 url 可以看到完整的log

@zhangyu-liu
Copy link

请问您解决这个问题了吗?

@oldhe777
Copy link

oldhe777 commented Jul 16, 2021

我尝试官方的12.0.1版本,能够通过。大概和 test-suite的版本有关。

realqhc pushed a commit to realqhc/llvm-project-plct that referenced this issue Nov 1, 2022
Found by msan -fsanitize-memory-use-after-dtor.

==8259==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55dbec54d2b8 in dtorRecord(clang::interp::Block*, char*, clang::interp::Descriptor*) clang/lib/AST/Interp/Descriptor.cpp:150:22
    plctlab#1 0x55dbec54bfcf in dtorArrayDesc(clang::interp::Block*, char*, clang::interp::Descriptor*) clang/lib/AST/Interp/Descriptor.cpp:97:7
    plctlab#2 0x55dbec508578 in invokeDtor clang/lib/AST/Interp/InterpBlock.h:79:7
    plctlab#3 0x55dbec508578 in clang::interp::Program::~Program() clang/lib/AST/Interp/Program.h:55:19
    plctlab#4 0x55dbec50657a in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5
    plctlab#5 0x55dbec50657a in std::__msan::unique_ptr<clang::interp::Program, std::__msan::default_delete<clang::interp::Program>>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7
    plctlab#6 0x55dbec5035a1 in clang::interp::Context::~Context() clang/lib/AST/Interp/Context.cpp:27:22
    plctlab#7 0x55dbebec1daa in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5
    plctlab#8 0x55dbebec1daa in std::__msan::unique_ptr<clang::interp::Context, std::__msan::default_delete<clang::interp::Context>>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7
    plctlab#9 0x55dbebe285f9 in clang::ASTContext::~ASTContext() clang/lib/AST/ASTContext.cpp:1038:40
    plctlab#10 0x55dbe941ff13 in llvm::RefCountedBase<clang::ASTContext>::Release() const llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:101:7
    plctlab#11 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:159:38
    plctlab#12 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:224:7
    plctlab#13 0x55dbe94353ef in ~IntrusiveRefCntPtr llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:191:27
    plctlab#14 0x55dbe94353ef in clang::CompilerInstance::setASTContext(clang::ASTContext*) clang/lib/Frontend/CompilerInstance.cpp:178:3
    plctlab#15 0x55dbe95ad0ad in clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:1100:8
    plctlab#16 0x55dbe9445fcf in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1047:11
    plctlab#17 0x55dbe6b3afef in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:25
    plctlab#18 0x55dbe6b13288 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) clang/tools/driver/cc1_main.cpp:250:15
    plctlab#19 0x55dbe6b0095f in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) clang/tools/driver/driver.cpp:319:12
    plctlab#20 0x55dbe6aff41c in clang_main(int, char**) clang/tools/driver/driver.cpp:395:12
    plctlab#21 0x7f9be07fa632 in __libc_start_main
    plctlab#22 0x55dbe6a702e9 in _start

  Member fields were destroyed
    #0 0x55dbe6a7da5d in __sanitizer_dtor_callback_fields compiler-rt/lib/msan/msan_interceptors.cpp:949:5
    plctlab#1 0x55dbec5094ac in ~SmallVectorImpl llvm/include/llvm/ADT/SmallVector.h:479:7
    plctlab#2 0x55dbec5094ac in ~SmallVectorImpl llvm/include/llvm/ADT/SmallVector.h:612:3
    plctlab#3 0x55dbec5094ac in llvm::SmallVector<clang::interp::Record::Base, 8u>::~SmallVector() llvm/include/llvm/ADT/SmallVector.h:1207:3
    plctlab#4 0x55dbec508e79 in clang::interp::Record::~Record() clang/lib/AST/Interp/Record.h:24:7
    plctlab#5 0x55dbec508612 in clang::interp::Program::~Program() clang/lib/AST/Interp/Program.h:49:26
    plctlab#6 0x55dbec50657a in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5
    plctlab#7 0x55dbec50657a in std::__msan::unique_ptr<clang::interp::Program, std::__msan::default_delete<clang::interp::Program>>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7
    plctlab#8 0x55dbec5035a1 in clang::interp::Context::~Context() clang/lib/AST/Interp/Context.cpp:27:22
    plctlab#9 0x55dbebec1daa in operator() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:55:5
    plctlab#10 0x55dbebec1daa in std::__msan::unique_ptr<clang::interp::Context, std::__msan::default_delete<clang::interp::Context>>::~unique_ptr() third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/unique_ptr.h:261:7
    plctlab#11 0x55dbebe285f9 in clang::ASTContext::~ASTContext() clang/lib/AST/ASTContext.cpp:1038:40
    plctlab#12 0x55dbe941ff13 in llvm::RefCountedBase<clang::ASTContext>::Release() const llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:101:7
    plctlab#13 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:159:38
    plctlab#14 0x55dbe94353ef in release llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:224:7
    plctlab#15 0x55dbe94353ef in ~IntrusiveRefCntPtr llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:191:27
    plctlab#16 0x55dbe94353ef in clang::CompilerInstance::setASTContext(clang::ASTContext*) clang/lib/Frontend/CompilerInstance.cpp:178:3
    plctlab#17 0x55dbe95ad0ad in clang::FrontendAction::EndSourceFile() clang/lib/Frontend/FrontendAction.cpp:1100:8
    plctlab#18 0x55dbe9445fcf in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) clang/lib/Frontend/CompilerInstance.cpp:1047:11
    plctlab#19 0x55dbe6b3afef in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:266:25
    plctlab#20 0x55dbe6b13288 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) clang/tools/driver/cc1_main.cpp:250:15
    plctlab#21 0x55dbe6b0095f in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) clang/tools/driver/driver.cpp:319:12
    plctlab#22 0x55dbe6aff41c in clang_main(int, char**) clang/tools/driver/driver.cpp:395:12
    plctlab#23 0x7f9be07fa632 in __libc_start_main
    plctlab#24 0x55dbe6a702e9 in _start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants