From: Vlad Ivanov <vlad@ivanov.email>
To: "newlib@sourceware.org" <newlib@sourceware.org>
Subject: Re: Configuring newlib for cross-compilation with clang
Date: Tue, 03 Nov 2020 17:01:42 +0300 [thread overview]
Message-ID: <19355181604411963@mail.yandex.ru> (raw)
In-Reply-To: <2582251604400981@mail.yandex.ru>
For anyone stumbling upon this, the problem was caused by wrong options. Instead
of CC and CFLAGS, one must use CC_FOR_TARGET and CFLAGS_FOR_TARGET.
One thing I noticed is that newlib is largely gcc-centric, and while it seems it can be
built with clang for some targets, that is not the case with powerpc.
03.11.2020, 14:08, "Vlad Ivanov" <vlad@ivanov.email>:
> Hello,
>
> I'm trying to build newlib for a PowerPC embedded target to assemble a complete
> toolchain with clang. I need to use clang as a cross compiler; clang and llvm
> are the only tools available. The resulting toolchain targets bare metal
> environment.
>
> Here's the command I'm using:
>
> ../newlib-cygwin/configure \
> --prefix=/opt/newlib-powerpc/install \
> --disable-libstdcxx \
> --disable-shared \
> --enable-static \
> --disable-multilib \
> --target=powerpc-none-eabi \
> --disable-newlib-supplied-syscalls \
> --enable-newlib-nano-malloc \
> --enable-target-optspace \
> --disable-newlib-multithread \
> --disable-newlib-io-float \
> --enable-lite-exit \
> CC='/usr/bin/clang'
> CFLAGS='--target=powerpc-none-eabi'
>
> I see an error early during configuration:
>
> checking for C compiler default output file name...
> configure: error: in `/opt/newlib-powerpc/build':
> configure: error: C compiler cannot create executables
> See `config.log' for more details.
>
> Now, this error occurs because the configure script tries to compile an
> executable and it's expecting to see something like a.out. But for an
> embedded target, to link an executable, one needs a linker scripts to define
> the memory layout, since there's no OS loading the binary. So any tests
> that create executables will fail.
>
> Is it possible to tell newlib to not compile any executables? Or should I
> use something like a dummy linker script?
>
> Best Regards,
>
> Vlad
prev parent reply other threads:[~2020-11-03 14:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 11:08 Vlad Ivanov
2020-11-03 14:01 ` Vlad Ivanov [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=19355181604411963@mail.yandex.ru \
--to=vlad@ivanov.email \
--cc=newlib@sourceware.org \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).