Needed help to build gcc cross compiler for powerpc-linux

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Jun 7 12:08:00 GMT 2016



On 24/05/2016 07:59, promila.jangra wrote:
> Hello
> 
> I am building gcc cross-compiler for powerpc-linux. And I am facing problem to install
> Standard C library using glibc package.
> 
> Please, help me out. I will be very thankful to you.
> 
> 
> Note: More details related to problem you can find below.
> 
> Package : glibc-2.23, gcc-5.3.0 
> 
> Commands :
> 
> $ mkdir -p build-gcc
> $ cd build-gcc
> $ ../gcc-5.3.0/configure --prefix=/opt/cross/ --target=powerpc-linux
> --enable-languages=c,c++ --disable-multilib
> $ make -j4 all-gcc
> $ make insall-gcc
> $ cd ..
> $ tar xf glibc-2.23.tar.xz
> $ cd build-glibc/
> $ ../glibc-2.23/configure --prefix=/opt/cross/powerpc-linux --build=$MACHTYPE
> --host=powerpc-linux --target=powerpc-linux
> --with-headers=/opt/cross/powerpc-linux/include --disable-multilib libc_cv_forced_unwind=yes
> $ make install-bootstrap-headers=yes install-headers
> $ make -j4 csu/subdir_lib
> $ install csu/crt1.o csu/crti.o csu/crtn.o /opt/cross/powerpc-linux/lib
> $ powerpc-linux-gcc -nostdlib -nostartfiles -shared -x c /dev/null -o
> /opt/cross/powerpc-linux/lib/libc.so
> $ touch /opt/cross/powerpc-linux/include/gnu/stubs.h
> $ cd ..
> $ cd build-gcc/
> $ make -j4 all-target-libgcc
> $ make install-target-libgcc
> $ cd build-glibc
> $ make -j4                  ////Error occurred here.
> $ make install
> $ cd ..
> 
> -----------------------------------------------------------------------------------
> Error Logs :
> -----------------------------------------------------------------------------------
> /home/cdot/promila/gcc_crossbuild/glibc-2.23/resolv/ns_print.c:99: undefined reference
> to `__stack_chk_guard'
> /home/cdot/promila/gcc_crossbuild/build-glibc/resolv/libresolv_pic.a(gethnamaddr.os): In
> function `addrsort':
> /home/cdot/promila/gcc_crossbuild/glibc-2.23/resolv/gethnamaddr.c:959: undefined
> reference to `__stack_chk_guard'
> /home/cdot/promila/gcc_crossbuild/build-glibc/resolv/libresolv_pic.a(gethnamaddr.os): In
> function `getanswer':
> /home/cdot/promila/gcc_crossbuild/glibc-2.23/resolv/gethnamaddr.c:183: undefined
> reference to `__stack_chk_guard'
> /home/cdot/promila/gcc_crossbuild/build-glibc/resolv/libresolv_pic.a(gethnamaddr.os): In
> function `__GI_res_gethostbyname2':
> /home/cdot/promila/gcc_crossbuild/glibc-2.23/resolv/gethnamaddr.c:505: undefined
> reference to `__stack_chk_guard'
> /home/cdot/promila/gcc_crossbuild/build-glibc/resolv/libresolv_pic.a(gethnamaddr.os): In
> function `res_gethostbyaddr':
> /home/cdot/promila/gcc_crossbuild/glibc-2.23/resolv/gethnamaddr.c:636: undefined
> reference to `__stack_chk_guard'
> /home/cdot/promila/gcc_crossbuild/build-glibc/resolv/libresolv_pic.a(res_debug.os):/home/cdot/promila/gcc_crossbuild/glibc-2.23/resolv/res_debug.c:287:
> more undefined references to `__stack_chk_guard' follow
> collect2: error: ld returned 1 exit status
> ../Makerules:517: recipe for target
> '/home/cdot/promila/gcc_crossbuild/build-glibc/resolv/libresolv.so' failed
> make[2]: *** [/home/cdot/promila/gcc_crossbuild/build-glibc/resolv/libresolv.so] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[2]: Leaving directory '/home/cdot/promila/gcc_crossbuild/glibc-2.23/resolv'
> Makefile:214: recipe for target 'resolv/others' failed
> make[1]: *** [resolv/others] Error 2
> make[1]: Leaving directory '/home/cdot/promila/gcc_crossbuild/glibc-2.23'
> Makefile:9: recipe for target 'all' failed
> make: *** [all] Error 2
> 
> --------------------------------------------------------------------------------
> --------------------------------------------------------------------------------
>  
> On Fri, 20 May 2016 09:32:50 -0600, Jeff Law wrote
>> On 05/20/2016 01:44 AM, Jonathan Wakely wrote:
>>> On 20 May 2016 at 07:49, promila.jangra wrote:
>>>> Hello Sir/Mam
>>>>
>>>> I am trying to install binutils-2.24 on Debian 8.4 to build gcc cross-compiler for
>>>> powerpc-linux.
>>>
>>> Binutils is not part of GCC, so you should have asked on the binutils
>>> mailing list instead.
>>>
>>> If you configure with --disable-werror then that diagnostic will only
>>> be a warning, not an error.
>> Right.
>>
>> This kind of issue comes up commonly when trying to build older code 
>> with newer compilers.  I've long held the opinion that -Werror, while 
>> good for development is wrong for releases.
>>
>> jeff
> 
> 
> Thanks & Regards
> Promila
> CDOT Delhi
> 

The stack protector on GLIBC itself is not really supported (there are
patches that aims to fully enables it in review), so to bootstrap a
compiler in this case you need to explicit disable stack protector if
the bootstrap compiler is using stack-protector flags by default.

You can do it by passing both 'libc_cv_ssp=no libc_cv_ssp_strong=no'
while configuring GLIBC.



More information about the Libc-help mailing list