Am I crazy? Does newlib build nothing? SOLVED
Bryan Ischo
bryan@ischo.com
Thu Aug 4 22:15:00 GMT 2011
On 08/04/11 14:56, DJ Delorie wrote:
>> Anyway, taking your advice as I understand it, I have tried adding a
>> "--target=i686-pc-linux-gnu" option when I run newlib configure on my
> newlib is an embedded library. As such, there's a limit to which
> targets it supports - it won't build on just anything. If you want to
> build newlib for something specific, specify that as --host (for
> natives) or --target (for crosses). As a special exception, to
> prevent naive users from building newlib when they probably don't want
> it, you have to jump through a few hoops to enable newlib (as a
> target) when building for linux (as a host):
>
> ../src/configure --host=i686-pc-linux --with-newlib
>
> If you specify only --target, the top-level configure thinks you're
> cross-compiling, and disables newlib. If you naively configure for
> linux (the top-level configure is shared among many projects), it
> assumes you don't want newlib unless you explicitly ask for it.
>
> Jeff: any reason why you can't cross-compile to a linux-newlib target?
> That seems like a reasonable thing to want to do.
Thank you for your response.
Turns out that there are two options that I was missing:
1) --with-newlib: incredibly, newlib's own configure script requires
--with-newlib as a configuration option, or else the resulting Makefiles
do nothing
2) --host=<cross-compiling-host>: Turns out that newlib won't do
anything at all if it doesn't think it is cross-compiling, so on my
x86_64 system, adding --host=i686-unknown-linux-gnu is necessary to get
the resulting Makefile to do anything
Of course, even after all of this, there are serious problems in the
newlib configure script; it has tests for building and linking programs
all over the place, and all of them are unnecessary and also impossible
to satisfy when cross-compiling using a minimal compiler. I have hacked
my newlib configure script to fix these, and can now get configure to
finish correctly, but am now running into build errors in newlib of the
form:
make[6]: Entering directory
`/tmp/foo/i686-unknown-linux-gnu/newlib/libc/machine/i386'
cc -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\"
-DPACKAGE_VERSION=\"1.19.0\" -DPACKAGE_STRING=\"newlib\ 1.19.0\"
-DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I.
-I/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386 -I
/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/../../../libm/common
-DMISSING_SYSCALL_NAMES -fno-builtin -I
/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/../../../libm/common
-DMISSING_SYSCALL_NAMES -fno-builtin -g -O2 -c -o lib_a-memchr.o `test
-f 'memchr.S' || echo
'/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/'`memchr.S
/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/memchr.S:
Assembler messages:
/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/memchr.S:17:
Error: invalid instruction suffix for `push'
/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/memchr.S:19:
Error: invalid instruction suffix for `push'
/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/memchr.S:69:
Error: invalid instruction suffix for `push'
/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/memchr.S:87:
Error: invalid instruction suffix for `pop'
/home/bji/buildtools/newlib-1.19.0/newlib/libc/machine/i386/memchr.S:112: Error:
invalid instruction suffix for `pop'
make[6]: *** [lib_a-memchr.o] Error 1
I will continue to investigate.
Might I politely ask what verification of newlib is done before a
December release is made? Because I can't comprehend on newlib in an
un-hacked form could ever work, unless it's being 'cross-compiled' on a
system that already has a working cross-compiler ...
Bryan
More information about the Newlib
mailing list