ROCm / ROCm-CompilerSupport

The compiler support repository provides various Lightning Compiler related services.
47 stars 31 forks source link

cmake can not file existing ClangConfig.cmake file. #26

Closed ggghamd closed 4 years ago

ggghamd commented 4 years ago

From ROCm3.1, the build complains about ClangConfig.cmake but when its location pointed out it still can not find it:

/root/ROCm/hcc/build/lib/cmake/clang total 64 -rw-r--r-- 1 root root 2427 Mar 26 02:32 ClangConfig.cmake -rw-r--r-- 1 root root 59175 Mar 26 02:32 ClangTargets.cmake

root@guyen-desktop:~/ROCm/aomp/rocm-compilersupport/lib/comgr/build# cmake CMAKE_PREFIX_PATH=/root/ROCm/hcc/build/lib/cmake/clang .. CMake Error at CMakeLists.txt:25 (find_package): Could not find a package configuration file provided by "Clang" with any of the following names:

ClangConfig.cmake
clang-config.cmake

Add the installation prefix of "Clang" to CMAKE_PREFIX_PATH or set "Clang_DIR" to a directory containing one of the above files. If "Clang" provides a separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred! See also "/root/ROCm/aomp/rocm-compilersupport/lib/comgr/build/CMakeFiles/CMakeOutput.log".

scott-linder commented 4 years ago

Hi @ggghamd, sorry for the delay in responding!

I think you are just running into the find_package behavior for CMAKE_PREFIX_PATH not directly checking the directory you supply. It instead looks in a platform-dependant set of directory suffixes. For Unix these are:

<prefix>/(lib/<arch>|lib*|share)/cmake/<name>*/                 (U)
<prefix>/(lib/<arch>|lib*|share)/<name>*/                       (U)
<prefix>/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/         (U)

So in this case you should specify -DCMAKE_PREFIX_PATH=/root/ROCm/hcc/build/.

Alternatively, as the diagnostic mentions, you can set <name>_DIR to the directory directly containing the config, so if you want to use the path you mentioned above you can just define -DClang_DIR=/root/ROCm/hcc/build/lib/cmake/clang rather than setting CMAKE_PREFIX_PATH.

I'm not certain whether you need to include the -D prefix in the cmake command line as I have above, or if your version without it is equivalent. If you run into issues, I would try with the -D prefix on the command line as well.

Let me know if you are still having trouble after trying this!

ggghamd commented 4 years ago

it worked but next make step failed as follows: I tried both make -j 8 (concurrent) or plain make.

root@sriov-guest:~/ROCm# find . -name ClangConfig.cmake ./hcc/build/llvm-project/llvm/tools/clang/cmake/modules/CMakeFiles/ClangConfig.cmake ./hcc/build/lib/cmake/clang/ClangConfig.cmake

root@sriov-guest:~/ROCm/aomp/rocm-compilersupport/lib/comgr/build# cmake -DCMAKE_PREFIX_PATH=/root/ROCm/hcc/build/ .. -- Could NOT find AMDDeviceLibs (missing: AMDDeviceLibs_DIR)

------------LLVM_DIR: /root/ROCm/hcc/build/llvm-project/llvm/lib/cmake/llvm ---LLVM_INCLUDE_DIRS: /root/ROCm/hcc/llvm-project/llvm/include;/root/ROCm/hcc/build/llvm-project/llvm/include ---LLVM_LIBRARY_DIRS: /root/ROCm/hcc/build/llvm-project/llvm/./lib -----------Clang_DIR: /root/ROCm/hcc/build/lib/cmake/clang --CLANG_INCLUDE_DIRS: /root/ROCm/hcc/llvm-project/clang/include;/root/ROCm/hcc/build/llvm-project/llvm/tools/clang/include ----LLD_INCLUDE_DIRS: /root/ROCm/hcc/llvm-project/llvm/../lld/include ---AMDDeviceLibs_DIR: AMDDeviceLibs_DIR-NOTFOUND ------------ROCM_DIR: /opt/rocm/share/rocm/cmake

-- Configuring done -- Generating done -- Build files have been written to: /root/ROCm/aomp/rocm-compilersupport/lib/comgr/build root@sriov-guest:~/ROCm/aomp/rocm-compilersupport/lib/comgr/build# make -j 8 Scanning dependencies of target shared Scanning dependencies of target reloc-asm Scanning dependencies of target reloc1 Scanning dependencies of target amd_comgr Scanning dependencies of target shared-v3 Scanning dependencies of target reloc2 [ 3%] Generating reloc1.o [ 3%] Generating reloc-asm.o [ 5%] Generating shared-v3.so [ 7%] Generating shared.so [ 9%] Generating reloc2.o [ 9%] Built target reloc-asm [ 9%] Built target reloc2 [ 9%] Built target reloc1 [ 9%] Built target shared-v3 [ 9%] Built target shared [ 11%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr-elfdump.cpp.o [ 13%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr-symbol.cpp.o [ 15%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr-disassembly.cpp.o [ 16%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr-objdump.cpp.o [ 18%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o [ 20%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr-signal.cpp.o [ 22%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr-env.cpp.o [ 24%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr-metadata.cpp.o [ 26%] Building CXX object CMakeFiles/amd_comgr.dir/src/comgr.cpp.o /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-disassembly.cpp: In member function 'amd_comgr_status_t COMGR::DisassemblyInfo::disassembleInstruction(uint64_t, void, uint64_t&)': /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-disassembly.cpp:142:47: error: no matching function for call to 'llvm::MCDisassembler::getInstruction(llvm::MCInst&, uint64_t&, llvm::SmallVector<unsigned char, 16>&, uint64_t&, llvm::raw_string_ostream&) const' AnnotationsStream) != MCDisassembler::Success) ^ In file included from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-disassembly.h:42:0, from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-disassembly.cpp:36: /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:78:24: note: candidate: virtual llvm::MCDisassembler::DecodeStatus llvm::MCDisassembler::getInstruction(llvm::MCInst&, uint64_t&, llvm::ArrayRef, uint64_t, llvm::raw_ostream&, llvm::raw_ostream&) const virtual DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size, ^~~~~~ /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:78:24: note: candidate expects 6 arguments, 5 provided /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-disassembly.cpp:147:74: error: no matching function for call to 'llvm::MCInstPrinter::printInst(llvm::MCInst, uint64_t&, std::__cxx11::string&, const llvm::MCSubtargetInfo&, llvm::raw_string_ostream&)' IP->printInst(&Inst, Address, AnnotationsStream.str(), STI, InstStream); ^ In file included from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-disassembly.h:43:0, from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-disassembly.cpp:36: /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate: virtual void llvm::MCInstPrinter::printInst(const llvm::MCInst, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&) virtual void printInst(const MCInst *MI, raw_ostream &OS, StringRef Annot, ^~~~~ /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate expects 4 arguments, 5 provided CMakeFiles/amd_comgr.dir/build.make:86: recipe for target 'CMakeFiles/amd_comgr.dir/src/comgr-disassembly.cpp.o' failed make[2]: [CMakeFiles/amd_comgr.dir/src/comgr-disassembly.cpp.o] Error 1 make[2]: Waiting for unfinished jobs.... /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp: In member function 'virtual void {anonymous}::PrettyPrinter::printInst(llvm::MCInstPrinter&, const llvm::MCInst, llvm::ArrayRef, llvm::object::SectionedAddress, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&, {anonymous}::SourcePrinter)': /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:563:52: error: no matching function for call to 'llvm::MCInstPrinter::printInst(const llvm::MCInst&, uint64_t&, const char [1], const llvm::MCSubtargetInfo&, llvm::raw_ostream&)' IP.printInst(MI, Address.Address, "", STI, OS); ^ In file included from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:54:0: /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate: virtual void llvm::MCInstPrinter::printInst(const llvm::MCInst, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&) virtual void printInst(const MCInst MI, raw_ostream &OS, StringRef Annot, ^~~~~ /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate expects 4 arguments, 5 provided /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp: In member function 'virtual void {anonymous}::HexagonPrettyPrinter::printInst(llvm::MCInstPrinter&, const llvm::MCInst, llvm::ArrayRef, llvm::object::SectionedAddress, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&, {anonymous}::SourcePrinter)': /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:596:60: error: no matching function for call to 'llvm::MCInstPrinter::printInst(const llvm::MCInst&, uint64_t&, const char [1], const llvm::MCSubtargetInfo&, llvm::raw_string_ostream&)' IP.printInst(MI, Address.Address, "", STI, TempStream); ^ In file included from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:54:0: /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate: virtual void llvm::MCInstPrinter::printInst(const llvm::MCInst, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&) virtual void printInst(const MCInst MI, raw_ostream &OS, StringRef Annot, ^~~~~ /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate expects 4 arguments, 5 provided /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp: In member function 'virtual void {anonymous}::AMDGCNPrettyPrinter::printInst(llvm::MCInstPrinter&, const llvm::MCInst, llvm::ArrayRef, llvm::object::SectionedAddress, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&, {anonymous}::SourcePrinter)': /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:648:50: error: no matching function for call to 'llvm::MCInstPrinter::printInst(const llvm::MCInst&, uint64_t&, const char [1], const llvm::MCSubtargetInfo&, llvm::raw_svector_ostream&)' IP.printInst(MI, Address.Address, "", STI, IS); ^ In file included from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:54:0: /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate: virtual void llvm::MCInstPrinter::printInst(const llvm::MCInst, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&) virtual void printInst(const MCInst MI, raw_ostream &OS, StringRef Annot, ^~~~~ /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate expects 4 arguments, 5 provided /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp: In member function 'virtual void {anonymous}::BPFPrettyPrinter::printInst(llvm::MCInstPrinter&, const llvm::MCInst, llvm::ArrayRef, llvm::object::SectionedAddress, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&, {anonymous}::SourcePrinter)': /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:680:52: error: no matching function for call to 'llvm::MCInstPrinter::printInst(const llvm::MCInst&, uint64_t&, const char [1], const llvm::MCSubtargetInfo&, llvm::raw_ostream&)' IP.printInst(MI, Address.Address, "", STI, OS); ^ In file included from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:54:0: /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate: virtual void llvm::MCInstPrinter::printInst(const llvm::MCInst, llvm::raw_ostream&, llvm::StringRef, const llvm::MCSubtargetInfo&) virtual void printInst(const MCInst MI, raw_ostream &OS, StringRef Annot, ^~~~~ /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCInstPrinter.h:75:16: note: candidate expects 4 arguments, 5 provided /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp: In member function 'void llvm::DisassemHelper::DisassembleObject(const llvm::object::ObjectFile*, bool)': /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:1598:79: error: no matching function for call to 'llvm::MCDisassembler::getInstruction(llvm::MCInst&, uint64_t&, llvm::ArrayRef, uint64_t, llvm::raw_svector_ostream&)' Inst, Size, Bytes.slice(Index), SectionAddr + Index, CommentStream); ^ In file included from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-objdump.cpp:51:0: /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:78:24: note: candidate: virtual llvm::MCDisassembler::DecodeStatus llvm::MCDisassembler::getInstruction(llvm::MCInst&, uint64_t&, llvm::ArrayRef, uint64_t, llvm::raw_ostream&, llvm::raw_ostream&) const virtual DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size, ^~~~~~ /root/ROCm/hcc/llvm-project/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:78:24: note: candidate expects 6 arguments, 5 provided CMakeFiles/amd_comgr.dir/build.make:182: recipe for target 'CMakeFiles/amd_comgr.dir/src/comgr-objdump.cpp.o' failed make[2]: [CMakeFiles/amd_comgr.dir/src/comgr-objdump.cpp.o] Error 1 /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-compiler.cpp: In function 'amd_comgr_status_t COMGR::linkWithLLD(llvm::ArrayRef<const char>, llvm::raw_ostream&, llvm::raw_ostream&)': /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-compiler.cpp:567:58: error: too many arguments to function 'bool lld::elf::link(llvm::ArrayRef<const char>, bool, llvm::raw_ostream&)' bool LLDRet = lld::elf::link(ArgRefs, false, LogS, LogE); ^ In file included from /root/ROCm/aomp/rocm-compilersupport/lib/comgr/src/comgr-compiler.cpp:41:0: /root/ROCm/hcc/llvm-project/llvm/../lld/include/lld/Common/Driver.h:27:6: note: declared here bool link(llvm::ArrayRef<const char > args, bool canExitEarly, ^~~~ CMakeFiles/amd_comgr.dir/build.make:62: recipe for target 'CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o' failed make[2]: ** [CMakeFiles/amd_comgr.dir/src/comgr-compiler.cpp.o] Error 1 CMakeFiles/Makefile2:131: recipe for target 'CMakeFiles/amd_comgr.dir/all' failed make[1]: [CMakeFiles/amd_comgr.dir/all] Error 2 Makefile:162: recipe for target 'all' failed make: *** [all] Error 2 root@sriov-guest:~/ROCm/aomp/rocm-compilersupport/lib/comgr/build#

scott-linder commented 4 years ago

Can you ensure you are using the latest amd-stg-open branch of both the llvm-project and CompilerSupport repos? There are frequent changes upstream that are fixed as they flow into the amd-stg-open branch, so you need to keep them updated in lockstep.

scott-linder commented 4 years ago

Closing as I believe the latest sources in amd-stg-open build and verify correctly, but please feel free to re-open if you're still seeing the issue.

gggh000 commented 4 years ago

it should re-open when there is no apparent fix.

scott-linder commented 4 years ago

it should re-open when there is no apparent fix.

This is fixed by 300f74409ae2c2feb96f233bf75cf3c2f0127d99, which is required starting at RadeonOpenCompute/llvm-project@6fdd6a7b3f696972edc244488f59532d05136a27.

I was lazy to not confirm that this specific issue had been resolved, and identify the exact revisions where it was resolved. I'll be more explicit about that when closing issues in the future.

We tend to resolve these small incompatibilities in near lock-step on the amd-stg-open branch of the compiler/device-libs/comgr, and using either the same release branch or the latest amd-stg-open branch of each of these projects is what is described in the README.