pspdev / psplibraries

A script to automatically build open-source libraries for PSP homebrew development.
47 stars 45 forks source link

pthread-emb fails to build with current toolchain #88

Open isage opened 2 years ago

isage commented 2 years ago
[isage@seven-swords pthreads-emb-1.0]$ make -C platform/psp/
make: Entering directory '/media/2TB/dev/pspdev/build/psplibraries/build/pthreads-emb-1.0/platform/psp'
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include  -G0 -O2 -Wall -g -fno-strict-aliasing -I../.. -I../helper  -D_PSP_FW_VERSION=150   -c -o pthread_mutex_unlock.o ../../pthread_mutex_unlock.c
In file included from /usr/local/pspdev/psp/include/sys/_pthreadtypes.h:23,
                 from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
../../sched.h:90:3: error: expected identifier before numeric constant
   90 |   SCHED_OTHER = 0,
      |   ^~~~~~~~~~~
In file included from ../../pthread.h:49,
                 from ../../pthread_mutex_unlock.c:48:
../../sched.h:97:8: error: redefinition of ‘struct sched_param’
   97 | struct sched_param
      |        ^~~~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/_pthreadtypes.h:23,
                 from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/sched.h:48:8: note: originally defined here
   48 | struct sched_param {
      |        ^~~~~~~~~~~
In file included from ../../pthread_mutex_unlock.c:48:
../../pthread.h:401:39: error: conflicting types for ‘pthread_t’
  401 |     typedef /* pte_handle_t */ void * pthread_t;
      |                                       ^~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/_pthreadtypes.h:32:20: note: previous declaration of ‘pthread_t’ was here
   32 | typedef __uint32_t pthread_t;            /* identify a thread */
      |                    ^~~~~~~~~
In file included from ../../pthread_mutex_unlock.c:48:
../../pthread.h:402:38: error: conflicting types for ‘pthread_attr_t’
  402 |     typedef struct pthread_attr_t_ * pthread_attr_t;
      |                                      ^~~~~~~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/_pthreadtypes.h:75:3: note: previous declaration of ‘pthread_attr_t’ was here
   75 | } pthread_attr_t;
      |   ^~~~~~~~~~~~~~
In file included from ../../pthread_mutex_unlock.c:48:
../../pthread.h:403:36: error: conflicting types for ‘pthread_once_t’
  403 |     typedef struct pthread_once_t_ pthread_once_t;
      |                                    ^~~~~~~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/_pthreadtypes.h:195:3: note: previous declaration of ‘pthread_once_t’ was here
  195 | } pthread_once_t;       /* dynamic package initialization */
      |   ^~~~~~~~~~~~~~
In file included from ../../pthread_mutex_unlock.c:48:
../../pthread.h:404:37: error: conflicting types for ‘pthread_key_t’
  404 |     typedef struct pthread_key_t_ * pthread_key_t;
      |                                     ^~~~~~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/_pthreadtypes.h:190:20: note: previous declaration of ‘pthread_key_t’ was here
  190 | typedef __uint32_t pthread_key_t;        /* thread-specific data keys */
      |                    ^~~~~~~~~~~~~
In file included from ../../pthread_mutex_unlock.c:48:
../../pthread.h:405:39: error: conflicting types for ‘pthread_mutex_t’
  405 |     typedef struct pthread_mutex_t_ * pthread_mutex_t;
      |                                       ^~~~~~~~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/_pthreadtypes.h:154:20: note: previous declaration of ‘pthread_mutex_t’ was here
  154 | typedef __uint32_t pthread_mutex_t;      /* identify a mutex */
      |                    ^~~~~~~~~~~~~~~
In file included from ../../pthread_mutex_unlock.c:48:
../../pthread.h:406:43: error: conflicting types for ‘pthread_mutexattr_t’
  406 |     typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t;
      |                                           ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/_pthreadtypes.h:169:3: note: previous declaration of ‘pthread_mutexattr_t’ was here
  169 | } pthread_mutexattr_t;
      |   ^~~~~~~~~~~~~~~~~~~
In file included from ../../pthread_mutex_unlock.c:48:
../../pthread.h:407:38: error: conflicting types for ‘pthread_cond_t’
  407 |     typedef struct pthread_cond_t_ * pthread_cond_t;
      |                                      ^~~~~~~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/_pthreadtypes.h:176:20: note: previous declaration of ‘pthread_cond_t’ was here
  176 | typedef __uint32_t pthread_cond_t;       /* identify a condition variable */
      |                    ^~~~~~~~~~~~~~
In file included from ../../pthread_mutex_unlock.c:48:
../../pthread.h:408:42: error: conflicting types for ‘pthread_condattr_t’
  408 |     typedef struct pthread_condattr_t_ * pthread_condattr_t;
      |                                          ^~~~~~~~~~~~~~~~~~
In file included from /usr/local/pspdev/psp/include/sys/types.h:223,
                 from /usr/local/pspdev/psp/include/stdio.h:61,
                 from ../../pthread_mutex_unlock.c:45:
/usr/local/pspdev/psp/include/sys/_pthreadtypes.h:186:3: note: previous declaration of ‘pthread_condattr_t’ was here
  186 | } pthread_condattr_t;         /* a condition attribute object */
      |   ^~~~~~~~~~~~~~~~~~
../../pthread.h:428:7: error: expected identifier before numeric constant
  428 |       PTHREAD_CREATE_JOINABLE       = 0,  /* Default */
      |       ^~~~~~~~~~~~~~~~~~~~~~~
make: *** [<builtin>: pthread_mutex_unlock.o] Error 1

reproducible with both newlib 3.3 and newlib 4.1

Moreover, pthread-emb build script doesn't actually check compile result, which leads to headers being installed, but library, obviously, not.

fjtrujy commented 2 years ago

Hello again, @isage I have all these issues solved in my POSIX toolchain. In the following days you will start to see PRs

Thanks

straightarrows commented 2 years ago

I'm having the same problems with the vita toolchains. Can you lay out basically what the problem is here? (for beginners if you can lol) I'm even using an old build with gcc 9.3.0, newlib 3.0.7 and 2019 versions of all packages. Still getting the exact error OP got. Performing this comment in _pthreadtypes.h allows compile but i believe the resulting toolchain is broken

if defined(_POSIX_THREADS)

//|| __POSIX_VISIBLE >= 199506