This is an archive of the discontinued LLVM Phabricator instance.

[cmake] make FindLibEdit.cmake more robust
ClosedPublic

Authored by upsj on May 26 2022, 1:16 AM.

Details

Summary

FindLibEdit uses pkg-config to find the necessary flags, but this may break with cross-compilation, because the PkgConfig module in CMake doesn't respect the SYSROOT specified in a toolchain file. Instead of taking the parameters from pkg-config for granted, we check whether our compiler can actually include and link against the library.

Diff Detail

Event Timeline

upsj created this revision.May 26 2022, 1:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2022, 1:16 AM
upsj requested review of this revision.May 26 2022, 1:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2022, 1:16 AM
MaskRay accepted this revision.May 26 2022, 5:42 PM
MaskRay added a subscriber: paulkirth.

LGTM. @paulkirth can you whether this helps your build?

This revision is now accepted and ready to land.May 26 2022, 5:42 PM

Hi, this works for me. I successfully cross-compiling llvm from x86 to riscv by applying this patch. Thanks a lot.
But you may still need to wait for paulkirth's comment to verify that it works on Fuchsia's clang CI as well.

I think this is probably fine. Locally it seems to work as expected. so LGTM from me.

I'll try restoring the old config after this lands to confirm.

This revision was landed with ongoing or failed builds.May 27 2022, 1:07 PM
This revision was automatically updated to reflect the committed changes.