Search code examples
gccpowerpc

unknown type name __locale_ ( while building gcc for powerpc)


I am trying to build gcc 4.3-74 for powerpc using cross compilation. I used the following configure command to configure the make file.

./configure --build=i686-pc-linux-gnu --target=powerpc-linux --host=powerpc-linux --with-gmp=/xxx/include --with-gmp-include=/xxx/include --with-gmp-lib=/xxx/lib

configuration is done successfully, but when I do a make, it failed with the following message

In file included from ../.././libiberty/floatformat.c:31:0:
/usr/include/string.h:548:5: error: unknown type name ‘__locale_t’
     __locale_t __loc)
     ^
/usr/include/string.h:552:18: error: unknown type name ‘__locale_t’

It seems like it is not fetching the right header file for powerpc.

I had similar issue with building binutils when I did configure without option --host=powerpc-linux. As soon as I used an option --host=powerpc-linux in configure, the same error is gone in case of binutils.


Solution

  • In my case, it was using some pretty old compiler for compilation. This old compiler was set to PATH variable in my user profile. Hence when I was executing gcc, it was executing old one and it resulted in this error.

    I removed PATH setting in my user profile. Now when I run gcc, it is executing the latest gcc. The problem is solved now.