[Lldb-commits] [PATCH] D70764: build: reduce CMake handling for zlib

Khem Raj via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 7 09:08:59 PST 2020


raj.khem added a comment.

In D70764#1807405 <https://reviews.llvm.org/D70764#1807405>, @smeenai wrote:

> In D70764#1803559 <https://reviews.llvm.org/D70764#1803559>, @raj.khem wrote:
>
> > this is now in master, and I am seeing build failures in cross-building clang, e.g. when building clang for arm on a x86_64 host. its resorting to finding, libz from buildhost instead of target sysroot ( using --sysroot) and failing in link step. e.g.
> >
> > FAILED: bin/llvm-config
> >  ...
> >  .... -o bin/llvm-config  -Wl,-rpath,"\$ORIGIN/../lib"  lib/libLLVMSupport.a  /usr/lib/libz.so  -lrt  -ldl  -ltinfo  -lm  lib/libLLVMDemangle.a
> >  ...
> >
> > aarch64-yoe-linux-musl/aarch64-yoe-linux-musl-ld: /usr/lib/libz.so: error adding symbols: file in wrong format
> >  clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
> >
> > you can see that its adding /usr/lib/libz.so to linker cmdline while cross linking.
>
>
> Have you set `CMAKE_SYSROOT` appropriately?


That is not the problem. Since in cases of target its finding is properly.
there are multiple pieces where some are being built for native( build host) some for target so it thinks its building for
buildhost (native) llvm-config e.g. is one such case. Replacing it with -lz fixes it becasue compile environment is providing
right --sysroot for native or cross cases and it always links with correct libs.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70764/new/

https://reviews.llvm.org/D70764





More information about the lldb-commits mailing list