libstdc++ and --with-sysroot
Jon Dufresne
jon.dufresne@gmail.com
Wed Nov 19 04:34:00 GMT 2008
On Tue, Nov 18, 2008 at 11:51 AM, Andrew Haley <aph@redhat.com> wrote:
> Jon Dufresne wrote:
>> On Tue, Nov 18, 2008 at 11:13 AM, Andrew Haley <aph@redhat.com> wrote:
>>> Jon Dufresne wrote:
>>>
>>>> I am creating a cross toolchain using gnu. So far it has been working great.
>>>>
>>>> However, one problem I noticed is that libstdc++ isn't installed into
>>>> the specified sysroot duing "make install".
>>>>
>>>> After I have binutils, a static gcc, linux-headers, and glibc compiled
>>>> this is how I build gcc:
>>>>
>>>> ${BUILD}/gcc-${GCC_VERSION}/configure \
>>>> --prefix=${TOOLS} \
>>>> --build=${HOST} \
>>>> --host=${HOST} \
>>>> --target=${TARGET} \
>>>> --with-sysroot=${ROOTFS} \
>>>> --enable-languages=c,c++ \
>>>> --disable-multilib \
>>>> --disable-nls \
>>>> --enable-shared \
>>>> --enable-threads=posix \
>>>> --enable-__cxa_atexit \
>>>> --disable-libunwind-exceptions \
>>>> --enable-c99 \
>>>> --enable-long-long
>>>>
>>>> make
>>>> make install
>>>>
>>>> The things to notice are that I use the "--with-sysroot" option and enable c++.
>>>>
>>>> After the compile finishes libstdc++ is installed to
>>>> ${TOOLS}/${TARGET}/lib and I need to manually copy it over to the
>>>> ${ROOTFS}/usr/lib. Is this a bug in the gcc Makefile? Should libstdc++
>>>> install to the sysroot by default like the c runtime library does? Or
>>>> is this preferred behavior?
>>> It's doing what it's supposed to do. All target libs are installed in
>>> the prefix, along with the cross-compiler. The libs have to be there because
>>> the cross-compiler needs them.
>>>
>>> So, you need the target libs in two places: in /usr/lib on the target and
>>> in prefix/*lib on the cross compiling host.
>>
>> Makes sense, but why doesn't the Makefile install the target libs into
>> both places, since that is what is needed?
>
> Because usually the place you have to install the target libs is not the
> sysroot but /usr/lib on the target machine: the target machine may be
> in another building or even on another planet. How you get the target
> libs to the target is up to you; it may involve burning a CD, an FTP
> transfer, or a carrier pigeon. ;-)
>
>> Copying them manually is
>> easy enough, but if they libraries are required in two places, it
>> seems the installation should put them in two places.
>
> Sure, but the sysroot isn't the other place! The sysroot is used when
> building the cross-compiler as the source for target libs and headers;
> the destination is the prefix.
>
> Andrew.
>
Ok, thanks for the help. It sounds like I don't fully comprehend what
sysroot really is. I thought sysroot would eventually be where the
target's root filesystem is, which would eventually get copied to the
target.
Thanks,
Jon
More information about the Gcc-help
mailing list