This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Pass bugreport URL to standalone clang build
ClosedPublic

Authored by mgorny on Jul 30 2020, 3:19 PM.

Details

Summary

BUG_REPORT_URL is currently used both in LLVM and in Clang but declared
only in the latter. This means that it's missing in standalone clang
builds and the driver ends up outputting:

PLEASE submit a bug report to and include [...]

(note the missing URL)

To fix this, include LLVM_PACKAGE_BUGREPORT in LLVMConfig.cmake
(similarly to how we pass PACKAGE_VERSION) and use it to fill
BUG_REPORT_URL when building clang standalone.

Diff Detail

Event Timeline

mgorny created this revision.Jul 30 2020, 3:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2020, 3:19 PM
mgorny requested review of this revision.Jul 30 2020, 3:19 PM

I am not familiar with the standalone clang build. Can you share a command?

I am not familiar with the standalone clang build. Can you share a command?

You install LLVM first, then run cmake <llvm-project-path>/clang and build it.

I am not familiar with the standalone clang build. Can you share a command?

You install LLVM first, then run cmake <llvm-project-path>/clang and build it.

Can you elaborate? The so-called "standalone build" isn't documented anywhere. My llvm-config is in /tmp/RelA/bin/llvm-config. I run PATH=/tmp/RelA/bin:$PATH cmake -GNinja -H/path/to//clang -BTest, it fails:

-- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
CMake Error at /tmp/RelA/lib/cmake/llvm/AddLLVM.cmake:823 (add_executable):
  add_executable cannot create target "clang-tblgen" because an imported
  target with the same name already exists.
Call Stack (most recent call first):
  /tmp/RelA/lib/cmake/llvm/TableGen.cmake:148 (add_llvm_executable)
  utils/TableGen/CMakeLists.txt:3 (add_tablegen)


CMake Error at /tmp/RelA/lib/cmake/llvm/LLVM-Config.cmake:105 (target_link_libraries):
  Cannot specify link libraries for target "clang-tblgen" which is not built
  by this project.
Call Stack (most recent call first):
  /tmp/RelA/lib/cmake/llvm/LLVM-Config.cmake:93 (explicit_llvm_config)
  /tmp/RelA/lib/cmake/llvm/AddLLVM.cmake:867 (llvm_config)
  /tmp/RelA/lib/cmake/llvm/TableGen.cmake:148 (add_llvm_executable)
  utils/TableGen/CMakeLists.txt:3 (add_tablegen)


-- Configuring incomplete, errors occurred!
See also "/tmp/c/Test/CMakeFiles/CMakeOutput.log".
See also "/tmp/c/Test/CMakeFiles/CMakeError.log".
mgorny added a comment.Aug 1 2020, 2:53 PM

Is RelA an actual result of install target, or just the build tree? I think it needs to be the former.

MaskRay accepted this revision.Aug 1 2020, 5:08 PM

Verified. I added CMAKE_PREFIX_PATH to my /tmp/RelA/CMakeCache.txt and invoked ninja install (this installed a bunch of unrelated files. I don't know know how to just install-cmake-exports and files it requires (.e.g LLVMDemangler.a)).

A standalone build of clang prints: PLEASE submit a bug report to and include the crash backtrace, preprocessed source , and associated run script. running on a file with #pragma clang __debug parser_crash

This patch fixes it.

This revision is now accepted and ready to land.Aug 1 2020, 5:08 PM
MaskRay retitled this revision from Pass bugreport URL to standalone clang build to [CMake] Pass bugreport URL to standalone clang build.Aug 1 2020, 5:08 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 1 2020, 11:33 PM