33d / gbsim-win

An obsolete environment for building gbsim with Windows - use https://github.com/33d/gbsim instead
6 stars 3 forks source link

unknown type name 'pid_t' #1

Open Grahack opened 9 years ago

Grahack commented 9 years ago

Hi, Maybe my praying skills are not sharp enough, I got this after following the build instructions and trying a make.

gcc -c -o pthread.o -g -O0 -DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB -I. -DHAVE_CONFIG_H -Wall  pthread.c
In file included from pthread.h:288:0,
                 from pthread.c:39:
./sched.h:152:47: error: unknown type name 'pid_t'
 PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
                                               ^
./sched.h:154:47: error: unknown type name 'pid_t'
 PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
                                               ^
In file included from implement.h:76:0,
                 from pthread.c:40:
semaphore.h:149:8: error: unknown type name 'mode_t'
        mode_t mode,
        ^
make[2]: *** [pthread.o] Error 1
Grahack commented 9 years ago

Removing the condition #if PTW32_LEVEL >= PTW32_LEVEL_MAX in pthreads-.../sched.h at line 117 suppresses the problem. Maybe there is an option to pass to set PTW32_LEVEL to avoid this?

This may be interesting too (but dated 2008): https://sourceware.org/ml/pthreads-win32/2008/msg00046.html

mougino commented 8 years ago

Hi, exact same problem here (1Y+ later) but removing the condition in sched.h:117 was not enough, I had to keep the # include <sys/types.h> from that condition and add a typedef int pid_t; as well.

I also had to comment the #ifndef HAVE_STRUCT_TIMESPEC (the whole block) in pthread.h:305

And finally, replace the call to usleep(usec) in sim_avr.c:305 by a call to Sleep(usec) as reported in issue #2 since the Windows Sleep() function uses milliseconds as input.

Oh, and comment the definition of sleep() in sim_network.h:42 (redundant with MinGW's sleep())