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

How to build with llvm-11.1.0 #814

Open
zcfh opened this issue Aug 14, 2023 · 2 comments
Open

How to build with llvm-11.1.0 #814

zcfh opened this issue Aug 14, 2023 · 2 comments
Labels
Question Further information is requested

Comments

@zcfh
Copy link

zcfh commented Aug 14, 2023

❓How to build with llvm-11.1.0

I read the install.md and the build was successful with llvm-10.
I want to build with llvm-11, refer to the issus 788, I performed some steps, and met two problems, how to solve it?

My build command build
branch release/v0.2.5

 cmake3   -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -S . -B build  -DCOMPILER_GYM_LLVM_PROVIDER=external -DLLVM_DIR=/home/distcc/clang-11.1.0/lib/cmake/llvm   -DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld"  -DCOMPILER_GYM_BUILD_EXAMPLES=ON

Problems

  1. Through the shell of the generator, I get the 608 flag, Is this my usage error?
$ python3 build_tools/llvm/legacy_pass_manager/extract_passes_from_llvm_source_tree.py /llvm-11-srcs-/llvm  |  python3  build_tools/llvm/legacy_pass_manager/make_action_space_genfiles.py  compiler_gym/envs/llvm/service/passes/11.1.0
$ wc -l compiler_gym/envs/llvm/service/passes/11.1.0/flags.txt
608 compiler_gym/envs/llvm/service/passes/11.1.0/flags.txt
  1. link error about external/programl.
    I encountered the following error, read some BUILD files, because the programl depends on llvm-10, I see it does not seem to support llvm11, do I need to modify it myself?
ld.lld: error: undefined symbol: llvm::parseIR(llvm::MemoryBufferRef, llvm::SMDiagnostic&, llvm::LLVMContext&, bool, llvm::StringRef)
>>> referenced by llvm.cc
>>>               llvm.pic.o:(programl::ir::llvm::BuildProgramGraph(llvm::MemoryBuffer const&, programl::ProgramGraph*, programl::ProgramGraphOptions const&)) in archive external/programl/programl/src/programl/bazel-bin/programl/ir/llvm/libllvm-10.a
@zcfh zcfh added the Question Further information is requested label Aug 14, 2023
@zcfh
Copy link
Author

zcfh commented Aug 14, 2023

Problems

  1. Through the shell of the generator, I get the 608 flag, Is this my usage error?
$ python3 build_tools/llvm/legacy_pass_manager/extract_passes_from_llvm_source_tree.py /llvm-11-srcs-/llvm  |  python3  build_tools/llvm/legacy_pass_manager/make_action_space_genfiles.py  compiler_gym/envs/llvm/service/passes/11.1.0
$ wc -l compiler_gym/envs/llvm/service/passes/11.1.0/flags.txt
608 compiler_gym/envs/llvm/service/passes/11.1.0/flags.txt

Problem 1 has been solved, there is a usage method in pass/BUILD, but the release/v0.2.5 does not have this file.

And it needs to add include to take effect, why should this branch be deleted?

`header = Path("llvm/" + str(source_path)[len("lib") : -len("cpp")] + "h")` 
>>>
`header = Path("include/llvm/" + str(source_path)[len("lib") : -len("cpp")] + "h")`

@zcfh
Copy link
Author

zcfh commented Aug 15, 2023

  1. link error about external/programl.
    I encountered the following error, read some BUILD files, because the programl depends on llvm-10, I see it does not seem to support llvm11, do I need to modify it myself?
ld.lld: error: undefined symbol: llvm::parseIR(llvm::MemoryBufferRef, llvm::SMDiagnostic&, llvm::LLVMContext&, bool, llvm::StringRef)
>>> referenced by llvm.cc
>>>               llvm.pic.o:(programl::ir::llvm::BuildProgramGraph(llvm::MemoryBuffer const&, programl::ProgramGraph*, programl::ProgramGraphOptions const&)) in archive external/programl/programl/src/programl/bazel-bin/programl/ir/llvm/libllvm-10.a

Problem 2 has been solved.
Modify deps @llvm//10.0.0 to custom clang11.1.0 bazel workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant