# Cmake generates invalid linker tasks with clang on arm64

**URL:** https://discourse.cmake.org/t/cmake-generates-invalid-linker-tasks-with-clang-on-arm64/4019
**Category:** Code
**Tags:** comp:clang
**Created:** [September 2, 2021, 5:35pm UTC](https://discourse.cmake.org/t/cmake-generates-invalid-linker-tasks-with-clang-on-arm64/4019 "2021-09-02T17:35:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Pierre\_Joye](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pierre_joye/32/1710_2.png) [@Pierre\_Joye](https://discourse.cmake.org/u/Pierre_Joye)
#### Post date: [September 2, 2021, 5:35pm UTC](https://discourse.cmake.org/t/cmake-generates-invalid-linker-tasks-with-clang-on-arm64/4019/1 "2021-09-02T17:35:48Z")

</div>

Hello,

I initially thought it was a bug but apparently not

[https://gitlab.kitware.com/cmake/cmake/-/issues/22589](https://gitlab.kitware.com/cmake/cmake/-/issues/22589)

It works on other platform but somehow on arm64, cmake generates something different and the linker failed. Did anyone see that too?

Or does it have to be taken care manually? as in cmake std functions do not support this setup.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [September 2, 2021, 6:10pm UTC](https://discourse.cmake.org/t/cmake-generates-invalid-linker-tasks-with-clang-on-arm64/4019/2 "2021-09-02T18:10:39Z")

</div>

The workaround you proposed looks like it is bogus and just hides the problem because it tells it to look for libraries in a non-existent directory (as nothing is named `/usr/lib/clang /usr/lib/libfoo.so …`). Can you provide the CMake code that triggered this? If you can minimize it by removing extraneous details and still happening, that’d be even better.

---

<div class="post-metadata">

### Author: ![Pierre\_Joye](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pierre_joye/32/1710_2.png) [@Pierre\_Joye](https://discourse.cmake.org/u/Pierre_Joye)
#### Post date: [September 3, 2021, 2:28am UTC](https://discourse.cmake.org/t/cmake-generates-invalid-linker-tasks-with-clang-on-arm64/4019/3 "2021-09-03T02:28:32Z")

</div>

Hi Ben,

Thank you for the reply. 🙂

I will try to reproduce with the smallest possible Cmake script. In the meantime, if anything obvious can be found ;), here is the one the CMake script used:

[https://github.com/libgd/libgd/blob/master/src/CMakeLists.txt](https://github.com/libgd/libgd/blob/master/src/CMakeLists.txt) (included from the main CMake in the src root dir).
