mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Chunlin Zhu <simon_0214@hotmail.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [musl] Failed to build musl 1.2.2 by using clang cross compiler
Date: Sat, 30 Oct 2021 10:53:31 +0000	[thread overview]
Message-ID: <SY4P282MB35176C8F922D25970E6A78BDE1889@SY4P282MB3517.AUSP282.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <CAH8yC8mtntLLbubJf-tkHcTC60O=QU39bV_6_LtZJe8ePRXNTA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2650 bytes --]

Hello,

I made a change to the Makefile of musl 1.2.2 at line 162, just remove the CFLAGS_ALL.
[cid:2dca1e1f-1f39-4eed-bd01-3a2e4eabe70f]
Note: The reason why I remove the CFLAGS_ALL, because I find on my computer when "clang --target=aarch64 -fuse-ld=/usr/local/bin/ld.lld -Wl,....." is used, gcc linker will be invoked, but when  --target=aarch64 is removed, ld.lld will be invoked as expect. Since CFLAGS_ALL contains the option --target=aarch64, so I modify the Makefile.

And use the below configuration:
./configure CC=clang --target=aarch64 CFLAGS="--target=aarch64 --rtlib=compiler-rt" AR=/usr/local/bin/llvm-ar LDFLAGS="-fuse-ld=/usr/local/bin/ld.lld -Wl,-z,noexecstack -m elf64-littleaarch64" RANLIB=/usr/local/bin/llvm-ranlib LIBCC=  --syslibdir=/usr/local/lib

Then ld.lld is invoked but still report the below error, does anyone have encounter the same problem?
[cid:b4dacdde-8d7d-424d-a30a-197c7c38aeaf]

Thanks,
Simon
________________________________
From: Jeffrey Walton <noloader@gmail.com>
Sent: Saturday, October 30, 2021 12:25
To: musl@lists.openwall.com <musl@lists.openwall.com>
Subject: Re: [musl] Failed to build musl 1.2.2 by using clang cross compiler



On Fri, Oct 29, 2021 at 11:46 PM Chunlin Zhu <simon_0214@hotmail.com<mailto:simon_0214@hotmail.com>> wrote:
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:17ccf705cf7cb971f163]

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

./configure CC=clang

make -j4

Set LD to clang, too. It sounds like GCC is creeping in because it is a default.

For the link error with --noexecstack, the linker needs -z,noexecstack. So add -Wl,-z,noexecstack to LDFLAGS. See the ld(1) man page at https://www.man7.org/linux/man-pages/man1/ld.1.html.

ASFLAGS should continue to use --noexecstack.

Jeff

[-- Attachment #1.2: Type: text/html, Size: 9291 bytes --]

[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 236690 bytes --]

[-- Attachment #3: image.png --]
[-- Type: image/png, Size: 14293 bytes --]

[-- Attachment #4: image.png --]
[-- Type: image/png, Size: 192618 bytes --]

      reply	other threads:[~2021-10-30 10:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-24  3:34 Zhu Chunlin
2021-10-24 14:22 ` Markus Wichmann
2021-10-25  5:03   ` 回复: " Zhu Chunlin
2021-10-25  8:44     ` Jeffrey Walton
2021-10-25 13:26       ` 回复: " Zhu Chunlin
2021-10-30  3:46         ` Chunlin Zhu
2021-10-30  4:25           ` Jeffrey Walton
2021-10-30 10:53             ` Chunlin Zhu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SY4P282MB35176C8F922D25970E6A78BDE1889@SY4P282MB3517.AUSP282.PROD.OUTLOOK.COM \
    --to=simon_0214@hotmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).