2011-01-21 08:10:16     Error when compiling Xenomai app with bfin-linux-uclinuc-g++

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-01-21 08:10:16     Error when compiling Xenomai app with bfin-linux-uclinuc-g++

Kolja Waschk (GERMANY)

Message: 97602   

 

Hi,

 

I'm having problems to compile Xenomai apps with POSIX skin "the right way": The compiler should be told to search for the "pthread.h" header in the Xenomai include/posix directory first before searching in the standard include directories.

 

However, if I try to compile one liner "a.c": #include <stdio.h> with the following command

 

PREFIX=/opt/uClinux/blackfin-linux-dist/staging

bfin-linux-uclibc-g++ -D_GNU_SOURCE -D_REENTRANT -D__XENO__ \

    -I$PREFIX/usr/include -I$PREFIX/usr/include/posix -c a.c

 

the following error is the result:

 

 

 

In file included from /opt/uClinux/blackfin-linux-dist/staging/usr/include/nucleus/thread.h:25,

                 from /opt/uClinux/blackfin-linux-dist/staging/usr/include/posix/pthread.h:136,

                 from /opt/uClinux-2010R1-RC5_tools-RC4/bfin-linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/include/bits/uClibc_mutex.h:15,

                 from /opt/uClinux-2010R1-RC5_tools-RC4/bfin-linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/include/bits/uClibc_stdio.h:107,

                 from /opt/uClinux-2010R1-RC5_tools-RC4/bfin-linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/include/stdio.h:72,

                 from a.c:1:

/opt/uClinux/blackfin-linux-dist/staging/usr/include/nucleus/types.h: In function ‘void xnobject_copy_name(char*, const char*)’:

/opt/uClinux/blackfin-linux-dist/staging/usr/include/nucleus/types.h:113: error: ‘snprintf’ was not declared in this scope

 

 

 

The error doesn't occur if gcc was used instead of g++, so I assume there's something wrong in the toolchain, not with Xenomai headers. But I reported the problem on the xenomai-help list as well.

 

Kolja

QuoteReplyEditDelete

 

 

2011-01-21 09:59:25     Re: Error when compiling Xenomai app with bfin-linux-uclinuc-g++

Mike Frysinger (UNITED STATES)

Message: 97604   

 

it's a dependency loop issue.  both compilers have it, the only difference is that C++ makes missing prototypes a fatal error.

 

simply include pthread.h yourself before stdio.h

QuoteReplyEditDelete

 

 

2011-01-21 10:06:25     Re: Error when compiling Xenomai app with bfin-linux-uclinuc-g++

Kolja Waschk (GERMANY)

Message: 97605   

 

Thanks. Another solution just came in via xenomai-help - to patch types.h in Xenomai:  https://mail.gna.org/public/xenomai-help/2011-01/msg00186.html - Kolja

QuoteReplyEditDelete

 

 

2011-01-21 10:26:14     Re: Error when compiling Xenomai app with bfin-linux-uclinuc-g++

Mike Frysinger (UNITED STATES)

Message: 97607   

 

yes, delaying the expansion of the function to after all the headers have been included would work as well

QuoteReplyEditDelete

Attachments

    Outcomes