[llvm] [BOLT] Enable standalone build (PR #87196)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 1 00:29:11 PDT 2024
pca006132 wrote:
I tried the following:
```dockerfile
FROM ubuntu:22.04 AS builder
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates git \
build-essential cmake ninja-build python3 libjemalloc-dev \
python3-psutil && \
rm -rf /var/lib/apt/lists
WORKDIR /home/bolt
COPY . llvm-project
RUN mkdir build && \
cd build && \
cmake -G Ninja ../llvm-project/llvm \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--push-state -Wl,-whole-archive -ljemalloc_pic -Wl,--pop-state -lpthread -lstdc++ -lm -ldl" \
-DCMAKE_INSTALL_PREFIX=/home/bolt/install && \
ninja install
RUN mkdir buildBolt && \
cd buildBolt && \
cmake -G Ninja ../llvm-project/bolt \
-DLLVM_INCLUDE_TESTS=ON \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--push-state -Wl,-whole-archive -ljemalloc_pic -Wl,--pop-state -lpthread -lstdc++ -lm -ldl" \
-DBOLT_CLANG_EXE="/home/bolt/install/bin/clang" \
-DBOLT_LLD_EXE="/home/bolt/install/bin/lld" \
-DCMAKE_INSTALL_PREFIX=/home/bolt/install && \
ninja check-bolt && \
ninja install-llvm-bolt install-perf2bolt install-merge-fdata \
install-llvm-boltdiff install-bolt_rt
FROM ubuntu:20.04
COPY --from=builder /home/bolt/install /usr/local
```
but it failed with
```
CMake Error at /home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:743 (add_dependencies):
The dependency target "AArch64CommonTableGen" of target
"LLVMBOLTTargetAArch64" does not exist.
Call Stack (most recent call first):
/home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:874 (llvm_add_library)
lib/Target/AArch64/CMakeLists.txt:7 (add_llvm_library)
CMake Error at /home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:743 (add_dependencies):
The dependency target "X86CommonTableGen" of target "LLVMBOLTTargetX86"
does not exist.
Call Stack (most recent call first):
/home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:874 (llvm_add_library)
lib/Target/X86/CMakeLists.txt:8 (add_llvm_library)
CMake Error at /home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:1984 (add_dependencies):
The dependency target "FileCheck" of target "check-bolt" does not exist.
Call Stack (most recent call first):
/home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:2050 (add_lit_target)
test/CMakeLists.txt:69 (add_lit_testsuite)
CMake Error at /home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:1984 (add_dependencies):
The dependency target "count" of target "check-bolt" does not exist.
Call Stack (most recent call first):
/home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:2050 (add_lit_target)
test/CMakeLists.txt:69 (add_lit_testsuite)
CMake Error at /home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:1984 (add_dependencies):
The dependency target "llvm-readelf" of target "check-bolt" does not exist.
Call Stack (most recent call first):
/home/bolt/install/lib/cmake/llvm/AddLLVM.cmake:2050 (add_lit_target)
test/CMakeLists.txt:69 (add_lit_testsuite)
...
```
Not sure why. When I compile using nix, it works fine. Maybe some cmake flag is not set correctly?
https://github.com/llvm/llvm-project/pull/87196
More information about the llvm-commits
mailing list