This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Can I compile newlib as a shared library on x86_64 linux-gnu?
- From: Jeff Johnston <jjohnstn at redhat dot com>
- To: Kai Yu <yukaigoforit at gmail dot com>
- Cc: newlib at sourceware dot org
- Date: Fri, 18 Nov 2016 12:24:05 -0500 (EST)
- Subject: Re: Can I compile newlib as a shared library on x86_64 linux-gnu?
- Authentication-results: sourceware.org; auth=none
- References: <CAMW3DFvLcLrMDKX8btFWEqdgLDanYQSf6FVMwR+wfiLcrA4=QA@mail.gmail.com>
The shared library version of newlib has only been set up for ix86 linux,
but not for x86_64 linux. There hasn't been much feedback regarding it so
I am not sure many people are/were using it. It should be relatively straight-forward to
make an x86_64 version if you want to give it a try. Basically, you need to create
an x86_64 directory in each of the machine directories under libc/sys/linux. You can
base files on the x86 versions.
That said, the x86 code hasn't been modified for a while and will likely need some
patching as it includes local system glibc header files which will have
been updated and may cause build issues.
-- Jeff J.
----- Original Message -----
> In newlib README file, it says that:
>
> Shared newlib
> =============
>
> newlib uses libtool when it is being compiled natively (with
> --target=i[34567]86-pc-linux-gnu) on an i[34567]86-pc-linux-gnu
> host. This allows newlib to be compiled as a shared library.
>
> To configure newlib, do the following from your build directory:
>
> $(source_dir)/src/configure --with-newlib --prefix=$(install_dir)
>
> configure will recognize that host == target ==
> i[34567]86-pc-linux-gnu, so it will tell newlib to compile itself using
> libtool. By default, libtool will build shared and static versions of
> newlib.
>
> Does it mean that we can build newlib shared library only on
> i[34567]86-pc-linux-gnu host?
> I tried to build newlib on x86_64-unknown-linux-gun just the way
> above, but the Makefile generated
> did nothing for newlib target. I also tried x86_64-unknown-linux-gun
> as --target with cross-compiling
> on i686-pc-linux-gnu, the Makefile still did nothing.
> So please tell me can't we build newlib on x86_64 linux-gnu??
>
> Thanks
> Yu Kai
>