[oe] Strange header file error

E Robertson e.robertson.svg at gmail.com
Tue Jul 15 16:08:34 UTC 2008


On Tue, Jul 15, 2008 at 10:22 AM, Khem Raj <raj.khem at gmail.com> wrote:
> On Tue, 2008-07-15 at 10:06 -0500, E Robertson wrote:
>
>> > Its not clear from your email what you might be facing. You can
>> > preprocess your source file with -E and see whats getting included
>> >
>> > what happens when you use  -D_GNU_SOURCE ?
>>
>> I've always used -D_GNU_SOURCE to get around the problem but "why?" is
>> the question I'm trying to answer.
>
> These are Non Posix noticed (_NP) ? thats why you need _GNU_SOURCE which
> tells compiler that you want this code.
>
>> Clearly USE_GNU is defined so the only way I can try to determine
>> problem is to dig deeper.
>
> Can you formulate the problem once again

Sure.
I got the error 'PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' undeclared
from src/nanox/srvmain.c
when compiling the microwindow source. For threadsafe support,
pthread.h is needed which is included
in lock.h. Here is also where USE_GNU is defined so as to include the
thread _NP.
In any case in this file (lock.h) I added several directives similar to this one
#ifndef __USE_GNU
#error USE_GNU not defines
#endif
I this this for the _NPs as well, before and after the include. It's a
bit crude but it works.
I noticed __USE_GNU was defined before and after the pthread.h is
included but not inside pthread.h (edited for #ifdef).
as a result the _NPs are not defined.

Now this sort of make sense because #include <features.h> undefined
__USE_GNU and if __GNU_SOURCE is not defined
then __USE_GNU will remain undefined. In such a case the the __USE_GNU
should not be defined after the header file, correct?
This behaviour is consistent because if I define _GNU_SOURCE also
before the pthread.h is defined but it did not have any effect.

Thanks.

>> I must point out however that if I use I define _GNU_SOURCE just
>> before the pthread.h header file is included
>> I get the same result (as oppose to -D_GNU_SOURCE in the cc path).
>
> having this define on GCC commandline is correct thing to do.
>>
>> I tried the -E option and it appears that all the necessary files are
>> included. I don't see anything unusual.
>
> Khem
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>




More information about the Openembedded-devel mailing list