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

Build problem in LLVM #4

Open
mhomidi opened this issue Nov 9, 2022 · 0 comments
Open

Build problem in LLVM #4

mhomidi opened this issue Nov 9, 2022 · 0 comments

Comments

@mhomidi
Copy link

mhomidi commented Nov 9, 2022

Hi all,

I have a problem in building LLVM with these parameter.

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=True -DCMAKE_INSTALL_PREFIX=$LLVM_PREFIX -DLLVM_BUILD_TESTS=False -DDEFAULT_SYSROOT=$RISCV_TOOLCHAIN_PATH/riscv32-unknown-elf -DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-unknown-elf" -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm

riscv-toolchain-path is build by this project.

The problem that I face during build process is that it can not link library lib/libLLVMObject.so. The error log is:

[0/5] Performing configure step for 'runtimes'
-- Could NOT find Terminfo (missing: Terminfo_LIBRARIES Terminfo_LINKABLE) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
-- Could NOT find Terminfo (missing: Terminfo_LIBRARIES Terminfo_LINKABLE) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
CMake Warning at /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/cmake/modules/HandleLLVMOptions.cmake:277 (message):
  -fPIC is not supported.
Call Stack (most recent call first):
  /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/cmake/modules/HandleLLVMOptions.cmake:324 (add_flag_or_print_warning)
  CMakeLists.txt:149 (include)


-- Using libunwind testing configuration: /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/libunwind/test/configs/llvm-libunwind-shared.cfg.in
CMake Error at /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/libunwind/src/CMakeLists.txt:109 (message):
  Compiler doesn't support generation of unwind tables if exception support
  is disabled.  Building libunwind DSO with runtime dependency on C++ ABI
  library is not supported.


-- Configuring incomplete, errors occurred!
See also "/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins/CMakeFiles/CMakeOutput.log".
See also "/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins/CMakeFiles/CMakeError.log".
FAILED: runtimes/runtimes-stamps/runtimes-configure 
cd /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins && /usr/bin/cmake -DCMAKE_C_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang -DCMAKE_CXX_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang++ -DCMAKE_ASM_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang -DCMAKE_AR=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-ar -DCMAKE_RANLIB=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-ranlib -DCMAKE_NM=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-nm -DCMAKE_OBJDUMP=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-objcopy -DCMAKE_STRIP=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-strip -DCMAKE_READELF=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_CXX_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_ASM_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_INSTALL_PREFIX=/home/homidi/Desktop/research/projects/llvm-riscv -DLLVM_BINARY_DIR=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build -DLLVM_CONFIG_PATH=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF -DLLVM_LIT_ARGS=-sv -DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=15.0.4 -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja -DCMAKE_C_COMPILER_LAUNCHER= -DCMAKE_CXX_COMPILER_LAUNCHER= -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=OFF -DLLVM_DEFAULT_TARGET_TRIPLE=riscv32-unknown-elf -DLLVM_ENABLE_PROJECTS_USED=ON -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_BUILD_TOOLS=ON -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON -DHAVE_LLVM_LIT=ON "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind" -GNinja /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/runtimes/../../runtimes && /usr/bin/cmake -E touch /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-stamps//runtimes-configure
ninja: build stopped: subcommand failed.

I do not have any idea about the problem and how solve this because everything seems to be ok. Is there anybody who has an idea how I can solve this issue?

shin0403 pushed a commit that referenced this issue Aug 28, 2023
The segmentation fault can be observed with llvm-10, llvm-11 and llvm-12
and seems to be fixed in llvm-13. It happens on the architectures armhf
and armel (both 32-bit) always and on x86_64 sporadically.
The test segfaults only on the first run (i.e. the kernel is not yet in
pocl's kernel cache) while it passes on subsequent execution (with
something already in the kernel cache), emitting only some llvm
diagnostics:

inlinable function call in a function with debug info must have a !dbg location
  %11 = call i32 @_Z12get_local_idj(i32 0)
inlinable function call in a function with debug info must have a !dbg location
  %19 = call i32 @_Z12get_local_idj(i32 1)
inlinable function call in a function with debug info must have a !dbg location
  %27 = call i32 @_Z12get_local_idj(i32 2)

The backtrace of the segmentation fault as observed with llvm-10 and pocl 1.6:
 #0  getEmissionKind () at .../llvm/include/llvm/IR/DebugInfoMetadata.h:1244
 #1  initialize () at .../llvm/lib/CodeGen/LexicalScopes.cpp:53
 #2  0xb14102f0 in computeIntervals () at .../llvm/lib/CodeGen/LiveDebugVariables.cpp:979
 #3  runOnMachineFunction () at .../llvm/lib/CodeGen/LiveDebugVariables.cpp:996
 #4  runOnMachineFunction () at .../llvm/lib/CodeGen/LiveDebugVariables.cpp:1023
 #5  0xb14856c8 in runOnFunction () at .../llvm/lib/CodeGen/MachineFunctionPass.cpp:73
 #6  0xb12ff494 in runOnFunction () at .../llvm/lib/IR/LegacyPassManager.cpp:1481
 #7  0xb12ff750 in runOnModule () at .../llvm/lib/IR/LegacyPassManager.cpp:1517
 #8  0xb12ffba8 in runOnModule () at .../llvm/lib/IR/LegacyPassManager.cpp:1582
 #9  run () at .../llvm/lib/IR/LegacyPassManager.cpp:1694
 #10 0xb6e64c82 in pocl_llvm_codegen (Device=Device@entry=0xdb0010, Modp=0x1361838, Output=Output@entry=0xbefde86c, OutputSize=OutputSize@entry=0xbefde880) at ./lib/CL/pocl_llvm_wg.cc:624
 #11 0xb6e291de in llvm_codegen (output=output@entry=0xdeb898 "...BMDHA/Sdot_kernel/0-0-0/Sdot_kernel.so", device_i=device_i@entry=0, kernel=kernel@entry=0xbefe0240,
     device=0xdb0010, command=command@entry=0xbefe0278, specialize=specialize@entry=0) at ./lib/CL/devices/common.c:158
 #12 0xb6e2ae44 in pocl_check_kernel_disk_cache (command=command@entry=0xbefe0278, specialized=specialized@entry=0) at ./lib/CL/devices/common.c:958
 #13 0xb6e2b262 in pocl_check_kernel_dlhandle_cache (command=0xbefe0278, initial_refcount=0, specialize=0) at ./lib/CL/devices/common.c:1081
 #14 0xb6e033d4 in program_compile_dynamic_wg_binaries (program=program@entry=0xd8ab88) at ./lib/CL/pocl_build.c:179
 #15 0xb6e13f20 in get_binary_sizes (sizes=0xbefe0384, program=0xd8ab88) at ./lib/CL/clGetProgramInfo.c:36
 #16 POclGetProgramInfo (program=0xd8ab88, param_name=4453, param_value_size=128, param_value=0xbefe0384, param_value_size_ret=0xbefe0380) at ./lib/CL/clGetProgramInfo.c:115
 #17 0x00473070 in main () at 975931.c:238

pocl/pocl#889
https://bugs.debian.org/975931
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

1 participant