Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD0C5PCJs8RPwommytoprzWU+NLQn2Zv5kS36KpkaO-zG_+BCg@mail.gmail.com>
Date: Tue, 12 Oct 2021 10:55:06 +1100
From: Matt Andrews <mattandrews@...il.com>
To: musl@...ts.openwall.com
Subject: Re: Newbie cross compiling with LLVM

>> 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 <noloader@...il.com> wrote:

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

Content of type "text/html" skipped

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.