mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jeffrey Walton <noloader@gmail.com>
To: musl@lists.openwall.com
Subject: Re: [musl] Newbie cross compiling with LLVM
Date: Mon, 11 Oct 2021 13:40:06 -0400	[thread overview]
Message-ID: <CAH8yC8=5Rq=kgA8-b1FBRs2wF2AmtAKzTSSDChq7mN=ueLfCtg@mail.gmail.com> (raw)
In-Reply-To: <CAD0C5PBjeuENe7bdX+Li1L0DRcZJv8w4j5bb9mN1ikXHAMD6gQ@mail.gmail.com>

On Sun, Oct 10, 2021 at 7:22 PM Matt Andrews <mattandrews@gmail.com> 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

  parent reply	other threads:[~2021-10-11 17:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-10 20:56 Matt Andrews
2021-10-10 22:43 ` Quentin Rameau
2021-10-10 23:21   ` Matt Andrews
2021-10-11 17:20     ` Khem Raj
2021-10-11 17:40     ` Jeffrey Walton [this message]
2021-10-11 23:55       ` Matt Andrews
2021-10-12  0:24         ` Jeffrey Walton
2021-10-12  4:53           ` Nagakamira
2021-10-12  4:57             ` Matt Andrews
2021-10-12  5:00               ` Nagakamira
2021-10-12  5:55                 ` Matt Andrews
2021-10-12  6:09                   ` Nagakamira
2021-10-13  2:34                     ` Matt Andrews
2021-10-13  5:35                       ` Nagakamira

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='CAH8yC8=5Rq=kgA8-b1FBRs2wF2AmtAKzTSSDChq7mN=ueLfCtg@mail.gmail.com' \
    --to=noloader@gmail.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).