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 error] using llvm-18 toolchain build compiler get lld error #149

Closed
zhoujingya opened this issue Oct 8, 2024 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@zhoujingya
Copy link
Collaborator

zhoujingya commented Oct 8, 2024

How to reproduce

First, download llvm-18(maybe higher version too), then use clang-18/clang++-18 as c/cxx compiler

# Build llvm
build_llvm() {
  if [ ! -d "${VENTUS_BUILD_DIR}" ]; then
    mkdir ${VENTUS_BUILD_DIR}
  fi
  cd ${VENTUS_BUILD_DIR}
  cmake -G Ninja -B ${VENTUS_BUILD_DIR} ${DIR}/llvm \
    -DLLVM_CCACHE_BUILD=ON \
    -DCMAKE_C_COMPILER=clang \        <-----------
    -DCMAKE_CXX_COMPILER=clang++ \ <-----------
    -DCMAKE_LINKER=mold \
    -DLLVM_OPTIMIZED_TABLEGEN=ON \
    -DLLVM_PARALLEL_LINK_JOBS=12 \
    -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
    -DLLVM_ENABLE_PROJECTS="clang;lld;libclc" \
    -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86;RISCV" \
    -DLLVM_TARGET_ARCH=riscv32 \
    -DBUILD_SHARED_LIBS=ON \
    -DLLVM_BUILD_LLVM_DYLIB=ON \
    -DCMAKE_INSTALL_PREFIX=${VENTUS_INSTALL_PREFIX}
  ninja
  ninja install
}

Bug info

: && /usr/lib/llvm-18/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=lld -Wl,--color-diagnostics    -Wl,--version-script,"/home/triton/work/llvm-project/build/tools/lto/LTO.exports" -shared -Wl,-soname,libLTO.so.16git -o lib/libLTO.so.16git tools/lto/CMakeFiles/LTO.dir/LTODisassembler.cpp.o tools/lto/CMakeFiles/LTO.dir/lto.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib"  lib/libLLVMAMDGPUAsmParser.so.16git  lib/libLLVMX86AsmParser.so.16git  lib/libLLVMRISCVAsmParser.so.16git  lib/libLLVMAMDGPUCodeGen.so.16git  lib/libLLVMX86CodeGen.so.16git  lib/libLLVMRISCVCodeGen.so.16git  lib/libLLVMX86Desc.so.16git  lib/libLLVMAMDGPUDisassembler.so.16git  lib/libLLVMX86Disassembler.so.16git  lib/libLLVMRISCVDisassembler.so.16git  lib/libLLVMX86Info.so.16git  lib/libLLVMLTO.so.16git  lib/libLLVMMCDisassembler.so.16git  lib/libLLVMAMDGPUDesc.so.16git  lib/libLLVMAMDGPUInfo.so.16git  lib/libLLVMRISCVDesc.so.16git  lib/libLLVMRISCVInfo.so.16git  lib/libLLVMCodeGen.so.16git  lib/libLLVMTarget.so.16git  lib/libLLVMMC.so.16git  lib/libLLVMBitReader.so.16git  lib/libLLVMCore.so.16git  lib/libLLVMSupport.so.16git  -Wl,-rpath-link,/home/triton/work/llvm-project/build/lib && :
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasm' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasmCPU' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMDisasmDispose' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMDisasmInstruction' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMSetDisasmOptions' failed: symbol not defined
ld.lld: error: version script assignment of 'LLVM_16' to symbol 'LLVMCreateDisasmCPUFeatures' failed: symbol not defined
@zhoujingya zhoujingya self-assigned this Oct 8, 2024
@zhoujingya
Copy link
Collaborator Author

zhoujingya commented Oct 8, 2024

https://reviews.llvm.org/D135402, I think this patch is a better way

@zhoujingya zhoujingya removed their assignment Oct 10, 2024
@zhoujingya zhoujingya added the bug Something isn't working label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant