From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14581 invoked from network); 11 Oct 2021 23:55:33 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 11 Oct 2021 23:55:33 -0000 Received: (qmail 23642 invoked by uid 550); 11 Oct 2021 23:55:30 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 23611 invoked from network); 11 Oct 2021 23:55:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=o6XQypYoR9iWzTnVaIxYJlpUsosZ6WfzuUsm7OFbnbU=; b=cssp7XQ3an17pLNpGsnByf5d///I0f6mwEcE8WlD796ILeo05DHjcbfh9t/zgxMaam xIgOqPzUuRp5qJ1s2Ntr8bMPJRMYyjDn8GsFF14xB0GpHJ+uK1+ZCoscFUMH842YqVtY nXElbVIISNv/EhviB8STK3gN7IUVViI59/lEkAlRpvBJhRAgRW0vkvo0ZEc1Fpket3T5 S7ZarpjhUj/P3iFxmub/ajFJS48nFdZ/flD7zg9zq/RZaa0btJLvTDvQ9Fop1SsP7ay5 a/qP9ouBzFApiVQF7Lb101FZYyJ5Wv4599zVZ9vPt0Z5N3O2F4dr0OHis6o+V6eYNzpv 1xNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=o6XQypYoR9iWzTnVaIxYJlpUsosZ6WfzuUsm7OFbnbU=; b=0ZxmA1tgDbR2VrNmP9B+I4S3joVXd1DjS/NrKmdKKXJnK4hg/jjsJbBxpEF3YQJLMs maq0eb7lsDTN621hFSeLvGIbZZqbumaN/dAAUQdbtsWOod/5uoRYdOJR7mnpg0LuW09o BeWtWlSyKwthaf4jJDuwgYTGsHpyciFQnPJaFxEBNIjzGXfdA4o+O5ByJqSqrTNXXyVq 3jgXNjld/w5ZsTQckzzoh689c9QS7Pyi9jDwrLswcx1PsiMj8DkB95hjW09Kxljx564z Ah4eRsFupf5RapWihq3QYJfQipr/OuVhgHus6qK719JEPtXtd+LsGPaD3wRliz+18gt3 aNNQ== X-Gm-Message-State: AOAM533BH3LXnTvN4NqrW7l0ChVmlB3xvN2QO+2r0PtGpdAnr1lcdyH9 g1RTA8Oh9Dj3nFQWEJUVBmidqjKH+A5dyq0JNie4Y8Q2e7Q= X-Google-Smtp-Source: ABdhPJxc4Q+auq3c8pJKQhNOVB1eKnIJHkSoRNvYTxHMsBuzfBRS6fPnkAH9cT2DCtmsCap7taWaRpRu6qylQAyhmws= X-Received: by 2002:a50:d984:: with SMTP id w4mr45359382edj.375.1633996518408; Mon, 11 Oct 2021 16:55:18 -0700 (PDT) MIME-Version: 1.0 References: <20211011004346.13768de6@tpx.quinq.eu.org> In-Reply-To: From: Matt Andrews Date: Tue, 12 Oct 2021 10:55:06 +1100 Message-ID: To: musl@lists.openwall.com Content-Type: multipart/alternative; boundary="0000000000000b473b05ce1c7615" Subject: Re: [musl] Newbie cross compiling with LLVM --0000000000000b473b05ce1c7615 Content-Type: text/plain; charset="UTF-8" >> How do I specify which linker to use? > >LD. Also see https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html. Looking at the ./configure for musl (which is not based on autoconf according to the docs), there is no mention of LD. Setting LD for ./configure and/or the call to make still results in the error. Who calls the linker? The compiler or make? Shouldn't clang know where it's linker is? How to tell clang which linker to use? On Tue, Oct 12, 2021 at 4:41 AM Jeffrey Walton wrote: > On Sun, Oct 10, 2021 at 7:22 PM Matt Andrews > wrote: > > > > > Have try with setting passing AR=clang-ar? > > > > I actually set > > > > AR=/usr/lib/llvm-13/bin/llvm-ar > > > > Then I set > > > > RANLIB=/usr/lib/llvm-13/bin/llvm-ranlib > > > > That got me a little further down the road, but now I'm getting this > error > > > > /usr/bin/ld: unrecognised emulation mode: armelf_linux_eabi > > Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu > elf_l1om elf_k1om i386pep i386pe > > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > > > I added this to CFLAGS > > > > -B/usr/lib/llvm-13/bin > > > > But it still uses the system linker. > > That's a linker flag. It should be added to LDFLAGS, not CFLAGS. > > > How do I specify which linker to use? > > LD. Also see > https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html > . > > Typically, during a cross-compile of a C/C++ program, you set the > following variables: > > * CC > * CXX > * CPP (C preprocessor) > * CPPFLAGS (this is where you put --isysroot) > * CFLAGS > * CXXFLAGS > * LD > * LDFLAGS (this is where you put --sysroot) > > --isysroot tells the build system where to find the target's header > files. --sysroot tells the build system where to find the target's > libraries. > > Set all the variables. Do not leave anything to chance. > > If you set your variables properly and the build fails, then the > makefile or Autotool's configure.ac is broken. That happens a lot. > > Jeff > --0000000000000b473b05ce1c7615 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>> How do I specify which l= inker to use?
>
>LD. Also see https://w= ww.gnu.org/software/make/manual/html_node/Implicit-Variables.html.

Looking at the ./configure for musl (which is not base= d on autoconf according to the docs), there is no mention of LD. Setting LD= for ./configure and/or the call to make still results in the error.
<= div>
Who calls the linker? The compiler or make? Shouldn'= t clang know where it's linker is? How to tell clang which linker to us= e?

On Tue, Oct 12, 2021 at 4:41 AM Jeffrey Walton <noloader@gmail.com> wrote:
On Sun, Oct 10, 2021 at 7:22 PM= Matt Andrews <mattandrews@gmail.com> wrote:
>
> > Have try with setting passing AR=3Dclang-ar?
>
> I actually set
>
>=C2=A0 =C2=A0 =C2=A0AR=3D/usr/lib/llvm-13/bin/llvm-ar
>
> Then I set
>
>=C2=A0 =C2=A0 =C2=A0RANLIB=3D/usr/lib/llvm-13/bin/llvm-ranlib
>
> That got me a little further down the road, but now I'm getting th= is error
>
>=C2=A0 =C2=A0 =C2=A0/usr/bin/ld: unrecognised emulation mode: armelf_li= nux_eabi
>=C2=A0 =C2=A0 =C2=A0Supported emulations: elf_x86_64 elf32_x86_64 elf_i= 386 elf_iamcu elf_l1om elf_k1om i386pep i386pe
>=C2=A0 =C2=A0 =C2=A0clang: error: linker command failed with exit code = 1 (use -v to see invocation)
>
> I added this to CFLAGS
>
>=C2=A0 =C2=A0 =C2=A0-B/usr/lib/llvm-13/bin
>
> But it still uses the system linker.

That's a linker flag. It should be added to LDFLAGS, not CFLAGS.

> How do I specify which linker to use?

LD. Also see https://www.g= nu.org/software/make/manual/html_node/Implicit-Variables.html.

Typically, during a cross-compile of a C/C++ program, you set the
following variables:

* CC
* CXX
* CPP (C preprocessor)
* CPPFLAGS (this is where you put --isysroot)
* CFLAGS
* CXXFLAGS
* LD
* LDFLAGS (this is where you put --sysroot)

--isysroot tells the build system where to find the target's header
files. --sysroot tells the build system where to find the target's
libraries.

Set all the variables. Do not leave anything to chance.

If you set your variables properly and the build fails, then the
makefile or Autotool's configure.ac is broken. That happens a lot.

Jeff
--0000000000000b473b05ce1c7615--