g++ cross distro compilation problem

Jonathan Wakely jwakely.gcc@gmail.com
Fri Jan 21 09:16:00 GMT 2011


On 21 January 2011 02:03, Nick Stokes wrote:
>>
>> But unfortunately this didn't work either. The reason is subtle (and
>> elusive!): On CentOS (where gcc is built) the GCC features.h header is
>> defining __USE_XOPEN2K, and not __USE_XOPEN2K8  conditioned on
>> _XOPEN_SOURCE (or _POSIX_C_SOURCE) being defined.   But on the
>> front-end SUSE, the /usr/include/locale.h is expecting __USE_XOPEN2K8,
>> hence fails.

By "GCC features.h header" do you mean one under the GCC installation
tree in /opt, or /usr/include/features.h?  If the former, that
explains the problem - you have a fixinclude'd features.h created on
the old system, which has a glibc that predates POSIX 2008, so
_GNU_SOURCE doesn't define __USE_XOPEN2K8 (as I think it would on a
newer glibc)

> I guess I can sweep under the rug for now by defining __USE_XOPEN2K8.
> Incidentally, I need to make this transparent for users. Is it
> possible to add such "custom" definitions to gcc at configure time (or
> is there some other way to accomplish this)?

http://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html

Or you can provide a wrapper script which invokes the actual gcc
driver with the additional flags you need.

Rather than defining __USE_XOPEN2K8 (which is definitely not meant to
be defined/undefined by users) I would consider modifying the
features.h file so that _GNU_SOURCE sets __XOPEN28K.  You could try
building the same GCC on a login machine, and compare the features.h
from that build (if it has one, otherwise just use
/usr/include/features.h)



More information about the Gcc-help mailing list