[libcxx-commits] [PATCH] D113253: [runtimes] Fix building initial libunwind+libcxxabi+libcxx with compiler implied -lunwind
Petr Hosek via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 9 11:11:22 PST 2021
phosek added a comment.
In D113253#3137287 <https://reviews.llvm.org/D113253#3137287>, @mstorsjo wrote:
> I managed to reproduce the issue. @phosek, can you advise how to proceed from here?
>
> One part of the issue, is that setting `CMAKE_TRY_COMPILE_TARGET_TYPE` to `STATIC_LIBRARY` makes the initial detection step detect less things. In particular, if doing full link tests, cmake sets the `CMAKE_LIBRARY_ARCHITECTURE` variable to `x86_64-linux-gnu`. This seems to be vital for some parts of library detection. To show off the issue, one can execute this minimal standalone cmake snippet:
>
> set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
> project(Runtimes)
> cmake_minimum_required(VERSION 3.10)
> find_package(ZLIB)
>
> On Ubuntu, it fails to find zlib, but if the `set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)` line is uncommented, it finds it as expected.
I don't know the answer but I did some experiments.
This fails:
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
project(Runtimes)
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
cmake_minimum_required(VERSION 3.10)
find_package(ZLIB)
This succeeds:
project(Runtimes)
cmake_minimum_required(VERSION 3.10)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
find_package(ZLIB)
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
So it seems like this is somehow related to the `project` configuration rather than the `find_package` implementation.
I'm looking into CMake implementation to see if I can figure what's going on.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113253/new/
https://reviews.llvm.org/D113253
More information about the libcxx-commits
mailing list