Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 30 Oct 2021 03:46:12 +0000
From: Chunlin Zhu <simon_0214@...mail.com>
To: "musl@...ts.openwall.com" <musl@...ts.openwall.com>
Subject: Re: Failed to build musl 1.2.2 by using clang cross compiler

Hello,

On my computer I have built and install the llvm toolchain from the source code by using the below configuration, the llvm lib is installed in the /usr/local/lib folder.
cmake -S llvm -B build -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;compiler-rt;lld" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="ARM;X86;AArch64"

And I am trying to build musl libc 1.2.2 for aarch64 by using llvm/clang, and I use the below configure:
./configure CC=clang --target=aarch64 CFLAGS="-v --target=aarch64 --rtlib=compiler-rt" AR=/usr/local/bin/llvm-ar RANLIB=/usr/local/bin/llvm-ranlib LIBCC=-lcompiler_rt --syslibdir=/usr/local/lib

It report the error as below:
[cid:ef74a00d-14e8-4a0a-b304-d1d3f4cb73f7]

And I find the compile phase is OK, the problem occurs during the link phase, I don't understand why finally gcc is invoked.
[cid:904980bd-5393-439f-b7a6-6735617f6c5b]

By the way, the below configure works on my computer:

./configure CC=clang

make -j4


Best Regards,
Simo
________________________________
发件人: Zhu Chunlin <simon_0214@...mail.com>
发送时间: 2021年10月25日 21:26
收件人: musl@...ts.openwall.com <musl@...ts.openwall.com>
抄送: nullplan@....net <nullplan@....net>
主题: 回复: [musl] Failed to build musl 1.2.2 by using clang cross compiler

Hello Jeff,

Thanks! But when I update the config as you suggest:

AR=/usr/local/bin/llvm-ar \
RANLIB=/usr/local/bin/llvm-ranlib \
CC=/usr/local/bin/clang \
CFLAGS="--rtlib=compiler-rt --target=aarch64" \
ASFLAGS="-Wa,--noexecstack" \
LDFLAGS="-Wl,-fuse-ld=/usr/local/bin/ld.lld --rtlib=compiler-rt --target=aarch64" \
LIBCC=-lcompiler_rt \
./configure --target=aarch64 \
&& make

It still reports the error as below:
[cid:919d9698-56e2-49d2-85c5-8b12ac33e65f]

Another question, if I want to use LLVM tool chain instead of GCC, how should I config? Acutally I don't understand why there is gcc error, because I have specify to use clang and ld.lld.

Thanks,
Simon
________________________________
发件人: Jeffrey Walton <noloader@...il.com>
发送时间: 2021年10月25日 16:44
收件人: musl@...ts.openwall.com <musl@...ts.openwall.com>
抄送: nullplan@....net <nullplan@....net>
主题: Re: [musl] Failed to build musl 1.2.2 by using clang cross compiler



On Mon, Oct 25, 2021 at 1:04 AM Zhu Chunlin <simon_0214@...mail.com<mailto:simon_0214@...mail.com>> wrote:
Hello Markus,

Thanks!

AR=/usr/local/bin/llvm-ar \
RANLIB=/usr/local/bin/llvm-ranlib \
CC=/usr/local/bin/clang \
CFLAGS="-fuse-ld=/usr/local/bin/ld.lld --rtlib=compiler-rt --target=aarch64" \
LIBCC=-lcompiler_rt \
./configure --target=aarch64 \
&& make

But when I use the above config, it reports the below error, but I don't understand why there are gcc error, I have explict specify to use clang and ld.lld
[cid:17cb69be492cb971f161]

-fuse-ld=/usr/local/bin/ld.lld is a LDFLAG. Since you are using GCC to drive link, set:

    LDFLAGS = "-Wl,-fuse-ld=/usr/local/bin/ld.lld "
--rtlib=compiler-rt and --target=aarch64may need to go into LDFLAGS, too.

--noexecstack is a ASFLAG. Use:

    ASFLAGS = "-Wa,--noexecstack"

Jeff

Content of type "text/html" skipped

Download attachment "image.png" of type "image/png" (44398 bytes)

Download attachment "image.png" of type "image/png" (15169 bytes)

Download attachment "image.png" of type "image/png" (15169 bytes)

Download attachment "image.png" of type "image/png" (236690 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.