g++ cross distro compilation problem

Jonathan Wakely jwakely.gcc@gmail.com
Thu Jan 20 19:58:00 GMT 2011

On 20 January 2011 19:28, Nick Stokes wrote:
> Great! This indeed revealed it.  In /usr/include/locale.h (same
> location, line  133, in both distros actually)  there is #ifdef
> __USE_GNU  on CentOS version, which is  #ifdef __USE_XOPEN2K8 in
> SUSE's version.   So, in fact if I define `__USE_XOPEN2K8'  while
> compiling on SUSE, it works. Hmm, go figure.. This can not be the
> right way to do this. What am I missing?

I don't know why they're different (on my glibc 2.12 system the
uselocale definition is guarded by __USE_GNU, just like your CentOS
system) but it looks like you've found the solution.

Users are not supposed to use the __USE_XXX macros, instead you should
define _GNU_SOURCE to enable __USE_GNU and _POSIX_C_SOURCE=200809L (or
greater) to enable __USE_XOPEN2K8.

More information about the Gcc-help mailing list