[gccsdk] Problems running C++ programs compiled with GCC4

Lee Noar leenoar at sky.com
Thu Jul 31 12:45:00 PDT 2008

John Tytgat wrote:
> Would it be possible to craft a small C++ testcase showing this problem
> so that I could have a further look please ?

The following code shows the problem and must be compiled as c++.

--8<-- test.cc ----

#include <stdio.h>
#include <pthread.h>

extern void dummy(void)
   /* Never called, just needs to be present. */

int main(void)
   printf("Hello World\n");

   return 0;


I compiled with:

arm-unknown-riscos-g++ test.cc -static -O2 -o test,e1f

The gthread implementation checks for an active thread system by 
checking for the existence of pthread_cancel (__gthread_active_p() 
gthr-posix.h). Tutris and I suspect Wesnoth use threads and therefore 
pthread_cancel is linked in. If pthread_cancel is not present in the 
binary, then the offending code is skipped and the program works.


More information about the gcc mailing list