[libcxx-commits] [clang] [compiler-rt] [libcxx] [cmake] Add hexagon-linux cmake cache files (PR #98712)

Brian Cain via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 5 10:01:25 PDT 2024


================
@@ -0,0 +1,25 @@
+
+set(LLVM_DEFAULT_TARGET_TRIPLE hexagon-unknown-linux-musl CACHE STRING "")
----------------
androm3da wrote:

Hmm, so I already have `CMAKE_CXX_COMPILER_TARGET` set this way in `hexagon-linux-cross.cmake` (I left this cache out of this PR but I could include it if it's useful).

So omitting `LLVM_DEFAULT_TARGET_TRIPLE` results in the failure below.  
```
cmake -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DLLVM_CMAKE_DIR:PATH=${TOOLCHAIN_LIB} \
		-DCMAKE_INSTALL_PREFIX:PATH=${HEX_TOOLS_TARGET_BASE} \
		-DCMAKE_CROSSCOMPILING:BOOL=ON \
		-DCMAKE_CXX_COMPILER_FORCED:BOOL=ON \
		-C ./hexagon-linux-cross.cmake \
		-C ./hexagon-linux-runtimes.cmake \
		-B ./obj_libs \
		-S ./llvm-project/runtimes
...
-- Configuring done
CMake Error at /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>

  Objects of target "RTSanitizerCommon.x86_64" referenced but no such target
  exists.
Call Stack (most recent call first):
  /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)


CMake Error at /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>

  Objects of target "RTSanitizerCommon.x86_64" referenced but no such target
  exists.
Call Stack (most recent call first):
  /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)


CMake Error at /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library):
  Error evaluating generator expression:

    $<TARGET_OBJECTS:RTSanitizerCommon.x86_64>

  Objects of target "RTSanitizerCommon.x86_64" referenced but no such target
  exists.
Call Stack (most recent call first):
  /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)


CMake Error at /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/cmake/Modules/AddCompilerRT.cmake:357 (add_library):
  No SOURCES given to target: clang_rt.ctx_profile-x86_64
Call Stack (most recent call first):
  /local/mnt/workspace/upstream/toolchain_for_hexagon/llvm-project/compiler-rt/lib/ctx_profile/CMakeLists.txt:25 (add_compiler_rt_runtime)
```

But `llvm-project/runtimes/CMakeLists.txt` has this, which I think is how I determined that I should be using `LLVM_DEFAULT_TARGET_TRIPLE` (or `LLVM_TARGET_TRIPLE` eventually?).

```
# Host triple is used by tests to check if they are running natively.
include(GetHostTriple)
get_host_triple(LLVM_HOST_TRIPLE)
message(STATUS "LLVM host triple: ${LLVM_HOST_TRIPLE}")

# TODO: We shouldn't be using LLVM_DEFAULT_TARGET_TRIPLE for runtimes since we
# aren't generating code, LLVM_TARGET_TRIPLE is a better fit.
set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING
    "Default target for which the runtimes will be built.")
message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}")

set(LLVM_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
```


https://github.com/llvm/llvm-project/pull/98712


More information about the libcxx-commits mailing list